diff --git a/htdocs/adherents/class/adherent.class.php b/htdocs/adherents/class/adherent.class.php index 61ce837d60c7102f4356129fb72a704907882c5b..c7b15aa7bcb63fa377ef1f377613d26e06fc4d51 100644 --- a/htdocs/adherents/class/adherent.class.php +++ b/htdocs/adherents/class/adherent.class.php @@ -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) { diff --git a/htdocs/comm/action/document.php b/htdocs/comm/action/document.php index 1f84efa42493732bc528d9808184b64e61575e8d..9583779955871728a60f97699d9b001c30da2c2a 100755 --- a/htdocs/comm/action/document.php +++ b/htdocs/comm/action/document.php @@ -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); diff --git a/htdocs/commande/fiche.php b/htdocs/commande/fiche.php index 1f7784e905b862a7a58aa64d84ace4aa70ddadf2..c6f97ed89a475fcdb44a296c19d45418cc83a6e1 100644 --- a/htdocs/commande/fiche.php +++ b/htdocs/commande/fiche.php @@ -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'); diff --git a/htdocs/compta/commande/fiche.php b/htdocs/compta/commande/fiche.php index 2438637df7d32454f8f39d4f8b7194d732544382..5a3a76478f9250ae97d374e7e1c09d09df5c2a88 100644 --- a/htdocs/compta/commande/fiche.php +++ b/htdocs/compta/commande/fiche.php @@ -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) diff --git a/htdocs/compta/facture.php b/htdocs/compta/facture.php index 103b39615108995e17166b84572da2fd4433dfbc..a7a07f35d7cd37954315bc8dc6baae436cccb2a8 100644 --- a/htdocs/compta/facture.php +++ b/htdocs/compta/facture.php @@ -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(); diff --git a/htdocs/compta/facture/apercu.php b/htdocs/compta/facture/apercu.php index 72ab25a1af3cd5944c097b63602af1e836bbcf32..85fb4b7d74046cf9a325482851df87e22b2c8116 100644 --- a/htdocs/compta/facture/apercu.php +++ b/htdocs/compta/facture/apercu.php @@ -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); diff --git a/htdocs/compta/facture/class/facture.class.php b/htdocs/compta/facture/class/facture.class.php index 2ae7ef1d3dd535049bb8414a9ec305a684138dc8..fec912c296d9f0b3a3f06a6a106e200573caf172 100644 --- a/htdocs/compta/facture/class/facture.class.php +++ b/htdocs/compta/facture/class/facture.class.php @@ -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 ''; } } diff --git a/htdocs/compta/facture/fiche-rec.php b/htdocs/compta/facture/fiche-rec.php index 38e4b8f5d985e5e26d7d9d25fb3087a6e15ef6a1..8ce412a5dd23e02a8c5ec65a7dd2c494d3f0f375 100644 --- a/htdocs/compta/facture/fiche-rec.php +++ b/htdocs/compta/facture/fiche-rec.php @@ -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>'; diff --git a/htdocs/compta/facture/prelevement.php b/htdocs/compta/facture/prelevement.php index e5b93a2f8f455a1ee3bea325019c22a065cbd1e4..0411f05bfa3a03ef9b574bce7e006a5b616c1818 100644 --- a/htdocs/compta/facture/prelevement.php +++ b/htdocs/compta/facture/prelevement.php @@ -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); diff --git a/htdocs/contrat/fiche.php b/htdocs/contrat/fiche.php index 07eaef34c365ddbfec4faa388582c7dc70f06b3c..01f26de6018d9cd27eedeff25fb933d1088cc1b5 100644 --- a/htdocs/contrat/fiche.php +++ b/htdocs/contrat/fiche.php @@ -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>'; } diff --git a/htdocs/expedition/fiche.php b/htdocs/expedition/fiche.php index e83d9281a1f6068f6905745417f937e6f4e25ca5..8f99886fc12416a5587e37ee1d18de4cde5f2303 100644 --- a/htdocs/expedition/fiche.php +++ b/htdocs/expedition/fiche.php @@ -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); diff --git a/htdocs/expedition/shipment.php b/htdocs/expedition/shipment.php index 63b20da6a2d704c233d5e2ab0daae28edc3e8da7..259d3c6aef4edf615ec0ee1eb3bc7d578dc983e0 100644 --- a/htdocs/expedition/shipment.php +++ b/htdocs/expedition/shipment.php @@ -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'); diff --git a/htdocs/fourn/commande/dispatch.php b/htdocs/fourn/commande/dispatch.php index 167c00e8a102b1bf9ff70062ac119b14bca65d7f..67a40dcdf59cb528111c7452132aed36ca842caa 100644 --- a/htdocs/fourn/commande/dispatch.php +++ b/htdocs/fourn/commande/dispatch.php @@ -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); diff --git a/htdocs/fourn/commande/document.php b/htdocs/fourn/commande/document.php index 07040129482a6ea809581df2908cb79b96a72bf7..3b034ab03d6246afe072e025aed8ff1fe47e9a8b 100644 --- a/htdocs/fourn/commande/document.php +++ b/htdocs/fourn/commande/document.php @@ -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); diff --git a/htdocs/fourn/commande/fiche.php b/htdocs/fourn/commande/fiche.php index 28f462cffbf8975d6f1f9e46d0ff1fb8eb52305c..fb7277cac2b4f97d31b99118f5226aaf46237229 100644 --- a/htdocs/fourn/commande/fiche.php +++ b/htdocs/fourn/commande/fiche.php @@ -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 diff --git a/htdocs/fourn/commande/history.php b/htdocs/fourn/commande/history.php index 073d3e5c351015642999a8f799e95b1c9dc4092b..066332e726bcba7aa5c1eb176c610ebe26d4da48 100644 --- a/htdocs/fourn/commande/history.php +++ b/htdocs/fourn/commande/history.php @@ -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"); diff --git a/htdocs/fourn/commande/note.php b/htdocs/fourn/commande/note.php index d071c17a09b3b6498217f345b508be5a71dbc47e..6abcae8d6bc72a6a8d86474f7c2cb8392dee8ecf 100644 --- a/htdocs/fourn/commande/note.php +++ b/htdocs/fourn/commande/note.php @@ -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); diff --git a/htdocs/includes/modules/expedition/pdf/pdf_expedition_merou.modules.php b/htdocs/includes/modules/expedition/pdf/pdf_expedition_merou.modules.php index 9f545f2fed98e38163581f3e4ce8f7ed6075eeba..5aa8fd9fc6fb7e0a4ae5c9287d8ec43e565189ce 100644 --- a/htdocs/includes/modules/expedition/pdf/pdf_expedition_merou.modules.php +++ b/htdocs/includes/modules/expedition/pdf/pdf_expedition_merou.modules.php @@ -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 diff --git a/htdocs/lib/functions2.lib.php b/htdocs/lib/functions2.lib.php index d9f84314f333a1383a65cf6884837d448efe72eb..ac59bd5735ad828a5ee2cec0c46e675a3615b13c 100644 --- a/htdocs/lib/functions2.lib.php +++ b/htdocs/lib/functions2.lib.php @@ -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>'; diff --git a/htdocs/livraison/fiche.php b/htdocs/livraison/fiche.php index 1465a12055ffa7be2bc332b5c1612eac4553cc3c..63bffa7f0acf7531cd33fedd735cfe9776055aeb 100644 --- a/htdocs/livraison/fiche.php +++ b/htdocs/livraison/fiche.php @@ -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) { diff --git a/htdocs/public/paybox/newpayment.php b/htdocs/public/paybox/newpayment.php index 71e6358b69917d1e0964deb94b7e3c13cbca2ab4..3087205c68aa879a8e1e99680ea6749605a0ab7e 100644 --- a/htdocs/public/paybox/newpayment.php +++ b/htdocs/public/paybox/newpayment.php @@ -562,7 +562,6 @@ if ($_REQUEST["amount"] == 'membersubscription') else { $subscription=new Cotisation($db); - //$result=$subscription->fetch(); } $amount=$subscription->total_ttc; diff --git a/htdocs/user/class/user.class.php b/htdocs/user/class/user.class.php index aa2a19d7474707b95360a92ff17583effa779d2c..b9b668f990fc62d9caac0be4f445f619e622aeea 100644 --- a/htdocs/user/class/user.class.php +++ b/htdocs/user/class/user.class.php @@ -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;