Now fetch for User class use id like other classes.

This commit is contained in:
Laurent Destailleur 2010-05-05 17:36:20 +00:00
parent b0a065ce02
commit e4bba520f7
22 changed files with 48 additions and 67 deletions

View File

@ -771,8 +771,7 @@ class Adherent extends CommonObject
// This member is linked with a user, so we also update users informations
// if this is an update.
$luser=new User($this->db);
$luser->id=$this->user_id;
$result=$luser->fetch();
$result=$luser->fetch($this->user_id);
if ($result >= 0)
{

View File

@ -130,8 +130,7 @@ if ($objectid > 0)
$act->societe=$company;
$author=new User($db);
$author->id=$act->author->id;
$author->fetch();
$author->fetch($act->author->id);
$act->author=$author;
$contact=new Contact($db);

View File

@ -1337,8 +1337,7 @@ else
$soc->fetch($commande->socid);
$author = new User($db);
$author->id = $commande->user_author_id;
$author->fetch();
$author->fetch($commande->user_author_id);
$head = commande_prepare_head($commande);
dol_fiche_head($head, 'order', $langs->trans("CustomerOrder"), 0, 'order');

View File

@ -139,8 +139,7 @@ if ($id > 0 || ! empty($ref))
$soc->fetch($commande->socid);
$author = new User($db);
$author->id = $commande->user_author_id;
$author->fetch();
$author->fetch($commande->user_author_id);
$head = commande_prepare_head($commande);
dol_fiche_head($head, 'accountancy', $langs->trans("CustomerOrder"), 0, 'order');
@ -150,7 +149,7 @@ if ($id > 0 || ! empty($ref))
*/
$nbrow=7;
if ($conf->projet->enabled) $nbrow++;
//Local taxes
if ($mysoc->pays_code=='ES' && $conf->global->MAIN_FEATURES_LEVEL >= 1)
{
@ -375,8 +374,8 @@ if ($id > 0 || ! empty($ref))
print '<td align="right">'.price($propal->total_localtax2).'</td>';
print '<td>'.$langs->trans("Currency".$conf->monnaie).'</td></tr>';
}
}
}
// Total TTC
print '<tr><td>'.$langs->trans('AmountTTC').'</td><td align="right">'.price($commande->total_ttc).'</td>';
print '<td>'.$langs->trans('Currency'.$conf->monnaie).'</td></tr>';
@ -580,7 +579,7 @@ if ($id > 0 || ! empty($ref))
* Linked object block
*/
$commande->load_object_linked($commande->id,$commande->element);
foreach($commande->linked_object as $object => $objectid)
{
if($conf->$object->enabled && $object != $commande->element)

View File

@ -1978,8 +1978,7 @@ else
$author = new User($db);
if ($fac->user_author)
{
$author->id = $fac->user_author;
$author->fetch();
$author->fetch($fac->user_author);
}
$facidnext=$fac->getIdReplacingInvoice();

View File

@ -74,8 +74,7 @@ if ($_GET["facid"] > 0)
$author = new User($db);
if ($fac->user_author)
{
$author->id = $fac->user_author;
$author->fetch();
$author->fetch($fac->user_author);
}
$head = facture_prepare_head($fac);

View File

@ -2221,7 +2221,8 @@ class Facture extends CommonObject
global $conf, $db, $langs;
$langs->load("bills");
if (empty($conf->global->FACTURE_ADDON))
// Clean parameters (if not defined or using deprecated value)
if (empty($conf->global->FACTURE_ADDON) || $conf->global->FACTURE_ADDON=='terre')
{
$conf->global->FACTURE_ADDON='mod_facture_terre';
}
@ -2253,7 +2254,11 @@ class Facture extends CommonObject
}
//print "xx".$mybool.$dir.$file."-".$classname;
if (! $mybool) dol_print_error('',"Failed to include file ".$file);
if (! $mybool)
{
dol_print_error('',"Failed to include file ".$file);
return '';
}
$obj = new $classname();
@ -2267,7 +2272,7 @@ class Facture extends CommonObject
else
{
dol_print_error($db,"Facture::getNextNumRef ".$obj->error);
return "";
return '';
}
}

View File

@ -339,8 +339,7 @@ else
$soc = new Societe($db, $fac->socid);
$soc->fetch($fac->socid);
$author = new User($db);
$author->id = $fac->user_author;
$author->fetch();
$author->fetch($fac->user_author);
print_titre($langs->trans("PredefinedInvoices").': '.$fac->titre);
print '<br>';

View File

@ -110,8 +110,7 @@ if ($_GET["facid"] > 0)
$author = new User($db);
if ($fac->user_author)
{
$author->id = $fac->user_author;
$author->fetch();
$author->fetch($fac->user_author);
}
$head = facture_prepare_head($fac);

View File

@ -649,16 +649,13 @@ else
$nbofservices=sizeof($contrat->lignes);
$author = new User($db);
$author->id = $contrat->user_author_id;
$author->fetch();
$author->fetch($contrat->user_author_id);
$commercial_signature = new User($db);
$commercial_signature->id = $contrat->commercial_signature_id;
$commercial_signature->fetch();
$commercial_signature->fetch($contrat->commercial_signature_id);
$commercial_suivi = new User($db);
$commercial_suivi->id = $contrat->commercial_suivi_id;
$commercial_suivi->fetch();
$commercial_suivi->fetch($contrat->commercial_suivi_id);
$head = contract_prepare_head($contrat);
@ -1329,16 +1326,16 @@ else
print "</div>";
print '<br>';
}
/*
* Linked object block
*/
$contrat->load_object_linked($contrat->id,$contrat->element);
if (! empty($contrat->linked_object))
{
print '<table width="100%"><tr><td width="50%" valign="top">';
foreach($contrat->linked_object as $object => $objectid)
{
if($conf->$object->enabled && $object != $contrat->element)
@ -1346,7 +1343,7 @@ else
$somethingshown=$contrat->showLinkedObjectBlock($object,$objectid,$somethingshown);
}
}
print '</td><td valign="top" width="50%">';
print '</td></tr></table>';
}

View File

@ -268,8 +268,7 @@ if ($_GET["action"] == 'create')
$soc->fetch($object->socid);
$author = new User($db);
$author->id = $object->user_author_id;
$author->fetch();
$author->fetch($object->user_author_id);
if ($conf->stock->enabled) $entrepot = new Entrepot($db);

View File

@ -147,8 +147,7 @@ if ($id > 0 || ! empty($ref))
$soc->fetch($commande->socid);
$author = new User($db);
$author->id = $commande->user_author_id;
$author->fetch();
$author->fetch($commande->user_author_id);
$head = commande_prepare_head($commande);
dol_fiche_head($head, 'shipping', $langs->trans("CustomerOrder"), 0, 'order');

View File

@ -103,8 +103,7 @@ if ($id > 0 || ! empty($ref))
$soc->fetch($commande->socid);
$author = new User($db);
$author->id = $commande->user_author_id;
$author->fetch();
$author->fetch($commande->user_author_id);
$head = ordersupplier_prepare_head($commande);

View File

@ -134,9 +134,8 @@ if ($id > 0 || ! empty($ref))
$soc = new Societe($db);
$soc->fetch($commande->socid);
$author = new User($db);
$author->id = $commande->user_author_id;
$author->fetch();
$author = new User($db);
$author->fetch($commande->user_author_id);
$head = ordersupplier_prepare_head($commande);

View File

@ -546,8 +546,7 @@ if ($id > 0 || ! empty($ref))
$soc->fetch($commande->socid);
$author = new User($db);
$author->id = $commande->user_author_id;
$author->fetch();
$author->fetch($commande->user_author_id);
$head = ordersupplier_prepare_head($commande);
@ -637,14 +636,14 @@ if ($id > 0 || ! empty($ref))
*/
$nbrow=8;
if ($conf->projet->enabled) $nbrow++;
//Local taxes
if ($mysoc->pays_code=='ES' && $conf->global->MAIN_FEATURES_LEVEL >= 1)
{
if($mysoc->localtax1_assuj=="1") $nbrow++;
if($mysoc->localtax2_assuj=="1") $nbrow++;
}
print '<table class="border" width="100%">';
// Ref

View File

@ -61,8 +61,7 @@ if ($id > 0 || ! empty($ref))
$soc->fetch($commande->socid);
$author = new User($db);
$author->id = $commande->user_author_id;
$author->fetch();
$author->fetch($commande->user_author_id);
llxHeader('',$langs->trans("History"),"CommandeFournisseur");

View File

@ -86,8 +86,7 @@ if ($id > 0 || ! empty($ref))
$soc->fetch($commande->socid);
$author = new User($db);
$author->id = $commande->user_author_id;
$author->fetch();
$author->fetch($commande->user_author_id);
$head = ordersupplier_prepare_head($commande);

View File

@ -110,8 +110,8 @@ Class pdf_expedition_merou extends ModelePdfExpedition
//Creation du livreur
$idcontact = $object->commande->getIdContact('internal','LIVREUR');
$this->livreur = new User($this->db,$idcontact[0]);
if ($idcontact[0]) $this->livreur->fetch();
$this->livreur = new User($this->db);
if ($idcontact[0]) $this->livreur->fetch($idcontact[0]);
// Definition de $dir et $file

View File

@ -98,8 +98,7 @@ function dol_print_object_info($object)
else
{
$userstatic=new User($db);
$userstatic->id=$object->user_creation;
$userstatic->fetch();
$userstatic->fetch($object->user_creation);
print $userstatic->getNomUrl(1);
}
print '<br>';
@ -120,8 +119,7 @@ function dol_print_object_info($object)
else
{
$userstatic=new User($db);
$userstatic->id=$object->user_modification;
$userstatic->fetch();
$userstatic->fetch($object->user_modification);
print $userstatic->getNomUrl(1);
}
print '<br>';
@ -142,8 +140,7 @@ function dol_print_object_info($object)
else
{
$userstatic=new User($db);
$userstatic->id=$object->user_validation;
$userstatic->fetch();
$userstatic->fetch($object->user_validation);
print $userstatic->getNomUrl(1);
}
print '<br>';
@ -164,8 +161,7 @@ function dol_print_object_info($object)
else
{
$userstatic=new User($db);
$userstatic->id=$object->user_cloture;
$userstatic->fetch();
$userstatic->fetch($object->user_cloture);
print $userstatic->getNomUrl(1);
}
print '<br>';
@ -186,8 +182,7 @@ function dol_print_object_info($object)
else
{
$userstatic=new User($db);
$userstatic->id=$object->user_rappro;
$userstatic->fetch();
$userstatic->fetch($object->user_rappro);
print $userstatic->getNomUrl(1);
}
print '<br>';

View File

@ -216,8 +216,7 @@ if ($_GET["action"] == 'create')
$soc = new Societe($db);
$soc->fetch($commande->socid);
$author = new User($db);
$author->id = $commande->user_author_id;
$author->fetch();
$author->fetch($commande->user_author_id);
if (!$conf->expedition_bon->enabled && $conf->stock->enabled)
{

View File

@ -562,7 +562,6 @@ if ($_REQUEST["amount"] == 'membersubscription')
else
{
$subscription=new Cotisation($db);
//$result=$subscription->fetch();
}
$amount=$subscription->total_ttc;

View File

@ -626,7 +626,8 @@ class User extends CommonObject
/**
* \brief Supprime completement un utilisateur
* \brief Delete the user
* \param int <0 if KO, >0 if OK
*/
function delete()
{
@ -634,7 +635,7 @@ class User extends CommonObject
$this->db->begin();
$this->fetch();
$this->fetch($this->id);
// Supprime droits
$sql = "DELETE FROM ".MAIN_DB_PREFIX."user_rights WHERE fk_user = ".$this->id;