';
// Ref
print ''.$langs->trans("Ref").' ';
print '';
- print $form->showrefnav($adh,'rowid');
+ print $form->showrefnav($object,'rowid');
print ' ';
- $showphoto=''.$form->showphoto('memberphoto',$adh).' ';
+ $showphoto=''.$form->showphoto('memberphoto',$object).' ';
// Login
if (empty($conf->global->ADHERENT_LOGIN_NOT_REQUIRED))
{
- print ''.$langs->trans("Login").' / '.$langs->trans("Id").' '.$adh->login.' ';
+ print ''.$langs->trans("Login").' / '.$langs->trans("Id").' '.$object->login.' ';
print $showphoto; $showphoto='';
print ' ';
}
// Morphy
- print ''.$langs->trans("Nature").' '.$adh->getmorphylib().' ';
+ print ''.$langs->trans("Nature").' '.$object->getmorphylib().' ';
print $showphoto; $showphoto='';
print ' ';
@@ -513,34 +511,34 @@ if ($rowid)
print ''.$langs->trans("Type").' '.$adht->getNomUrl(1)." \n";
// Company
- print ''.$langs->trans("Company").' '.$adh->societe.' ';
+ print ''.$langs->trans("Company").' '.$object->societe.' ';
// Civility
- print ''.$langs->trans("UserTitle").' '.$adh->getCivilityLabel().' ';
+ print ''.$langs->trans("UserTitle").' '.$object->getCivilityLabel().' ';
print ' ';
// Name
- print ''.$langs->trans("Lastname").' '.$adh->lastname.' ';
+ print ''.$langs->trans("Lastname").' '.$object->lastname.' ';
print ' ';
// Firstname
- print ''.$langs->trans("Firstname").' '.$adh->firstname.' ';
+ print ''.$langs->trans("Firstname").' '.$object->firstname.' ';
print ' ';
// Status
- print ''.$langs->trans("Status").' '.$adh->getLibStatut(4).' ';
+ print ''.$langs->trans("Status").' '.$object->getLibStatut(4).' ';
// Date end subscription
print ''.$langs->trans("SubscriptionEndDate").' ';
- if ($adh->datefin)
+ if ($object->datefin)
{
- print dol_print_date($adh->datefin,'day');
- if ($adh->datefin < ($now - $conf->adherent->cotisation->warning_delay) && $adh->statut > 0) print " ".img_warning($langs->trans("Late")); // Affiche picto retard uniquement si non brouillon et non resilie
+ print dol_print_date($object->datefin,'day');
+ if ($object->datefin < ($now - $conf->adherent->cotisation->warning_delay) && $object->statut > 0) print " ".img_warning($langs->trans("Late")); // Affiche picto retard uniquement si non brouillon et non resilie
}
else
{
print $langs->trans("SubscriptionNotReceived");
- if ($adh->statut > 0) print " ".img_warning($langs->trans("Late")); // Affiche picto retard uniquement si non brouillon et non resilie
+ if ($object->statut > 0) print " ".img_warning($langs->trans("Late")); // Affiche picto retard uniquement si non brouillon et non resilie
}
print ' ';
@@ -551,29 +549,29 @@ if ($rowid)
print '';
print '';
if ($_GET['action'] == 'editthirdparty')
{
$htmlname='socid';
print '';
}
else
{
- if ($adh->fk_soc)
+ if ($object->fk_soc)
{
$company=new Societe($db);
- $result=$company->fetch($adh->fk_soc);
+ $result=$company->fetch($object->fk_soc);
print $company->getNomUrl(1);
}
else
@@ -589,7 +587,7 @@ if ($rowid)
print '';
print ' ';
if ($_GET['action'] == 'editlogin')
@@ -597,15 +595,15 @@ if ($rowid)
/*$include=array();
if (empty($user->rights->user->user->creer)) // If can edit only itself user, we can link to itself only
{
- $include=array($adh->user_id,$user->id);
+ $include=array($object->user_id,$user->id);
}*/
- print $form->form_users($_SERVER['PHP_SELF'].'?rowid='.$adh->id,$adh->user_id,'userid','');
+ print $form->form_users($_SERVER['PHP_SELF'].'?rowid='.$object->id,$object->user_id,'userid','');
}
else
{
- if ($adh->user_id)
+ if ($object->user_id)
{
- print $form->form_users($_SERVER['PHP_SELF'].'?rowid='.$adh->id,$adh->user_id,'none');
+ print $form->form_users($_SERVER['PHP_SELF'].'?rowid='.$object->id,$object->user_id,'none');
}
else print $langs->trans("NoDolibarrAccess");
}
@@ -631,7 +629,7 @@ if ($rowid)
{
print '';
- if ($adh->statut > 0) print '
'.$langs->trans("AddSubscription")." ";
+ if ($object->statut > 0) print '
'.$langs->trans("AddSubscription")." ";
else print '
'.$langs->trans("AddSubscription").' ';
print "
\n";
@@ -723,7 +721,7 @@ if ($rowid)
if ($conf->paypal->enabled)
{
include_once(DOL_DOCUMENT_ROOT.'/paypal/lib/paypal.lib.php');
- print showPaypalPaymentUrl('membersubscription',$adh->ref);
+ print showPaypalPaymentUrl('membersubscription',$object->ref);
}
}
@@ -741,7 +739,7 @@ if ($rowid)
$bankviainvoice=0; // Option to write via invoice is on by default
$invoiceonly=0;
if ($conf->banque->enabled && $conf->global->ADHERENT_BANK_USE && (empty($_POST['paymentsave']) || $_POST["paymentsave"] == 'bankdirect')) $bankdirect=1;
- if ($conf->banque->enabled && $conf->societe->enabled && $conf->facture->enabled && $adh->fk_soc) $bankviainvoice=1;
+ if ($conf->banque->enabled && $conf->societe->enabled && $conf->facture->enabled && $object->fk_soc) $bankviainvoice=1;
print "\n\n\n";
@@ -792,20 +790,20 @@ if ($rowid)
// Confirm create third party
if ($_GET["action"] == 'create_thirdparty')
{
- $name = $adh->getFullName($langs);
+ $name = $object->getFullName($langs);
if (! empty($name))
{
- if ($adh->societe) $name.=' ('.$adh->societe.')';
+ if ($object->societe) $name.=' ('.$object->societe.')';
}
else
{
- $name=$adh->societe;
+ $name=$object->societe;
}
// Create a form array
$formquestion=array( array('label' => $langs->trans("NameToCreate"), 'type' => 'text', 'name' => 'companyname', 'value' => $name));
- $ret=$form->form_confirm($_SERVER["PHP_SELF"]."?rowid=".$adh->id,$langs->trans("CreateDolibarrThirdParty"),$langs->trans("ConfirmCreateThirdParty"),"confirm_create_thirdparty",$formquestion,1);
+ $ret=$form->form_confirm($_SERVER["PHP_SELF"]."?rowid=".$object->id,$langs->trans("CreateDolibarrThirdParty"),$langs->trans("ConfirmCreateThirdParty"),"confirm_create_thirdparty",$formquestion,1);
if ($ret == 'html') print '
';
}
@@ -814,7 +812,7 @@ if ($rowid)
print '
';
print '
';
print '
';
- print '
';
+ print '
';
print '
';
print "
\n";
@@ -837,9 +835,9 @@ if ($rowid)
}
if (! $datefrom)
{
- if ($adh->datefin > 0)
+ if ($object->datefin > 0)
{
- $datefrom=dol_time_plus_duree($adh->datefin,1,'d');
+ $datefrom=dol_time_plus_duree($object->datefin,1,'d');
}
else
{
@@ -876,9 +874,9 @@ if ($rowid)
if ($conf->banque->enabled || $conf->facture->enabled)
{
$company=new Societe($db);
- if ($adh->fk_soc)
+ if ($object->fk_soc)
{
- $result=$company->fetch($adh->fk_soc);
+ $result=$company->fetch($object->fk_soc);
}
// Title payments
@@ -897,13 +895,13 @@ if ($rowid)
if ($conf->societe->enabled && $conf->facture->enabled)
{
print ' fk_soc) || empty($bankviainvoice)) print ' disabled="disabled"';
+ if (empty($object->fk_soc) || empty($bankviainvoice)) print ' disabled="disabled"';
print '> '.$langs->trans("MoreActionInvoiceOnly");
- if ($adh->fk_soc) print ' ('.$langs->trans("ThirdParty").': '.$company->getNomUrl(1).')';
+ if ($object->fk_soc) print ' ('.$langs->trans("ThirdParty").': '.$company->getNomUrl(1).')';
else
{
print ' ('.$langs->trans("NoThirdPartyAssociatedToMember");
- print ' - id.'&action=create_thirdparty">';
+ print ' - id.'&action=create_thirdparty">';
print $langs->trans("CreateDolibarrThirdParty");
print ' )';
}
@@ -912,13 +910,13 @@ if ($rowid)
if ($conf->banque->enabled && $conf->societe->enabled && $conf->facture->enabled)
{
print ' fk_soc) || empty($bankviainvoice)) print ' disabled="disabled"';
+ if (empty($object->fk_soc) || empty($bankviainvoice)) print ' disabled="disabled"';
print '> '.$langs->trans("MoreActionBankViaInvoice");
- if ($adh->fk_soc) print ' ('.$langs->trans("ThirdParty").': '.$company->getNomUrl(1).')';
+ if ($object->fk_soc) print ' ('.$langs->trans("ThirdParty").': '.$company->getNomUrl(1).')';
else
{
print ' ('.$langs->trans("NoThirdPartyAssociatedToMember");
- print ' - id.'&action=create_thirdparty">';
+ print ' - id.'&action=create_thirdparty">';
print $langs->trans("CreateDolibarrThirdParty");
print ' )';
}
@@ -962,22 +960,22 @@ if ($rowid)
print ''.$langs->trans("SendAcknowledgementByMail").' ';
print '';
- if (! $adh->email)
+ if (! $object->email)
{
print $langs->trans("NoEMail");
}
else
{
$adht = new AdherentType($db);
- $adht->fetch($adh->typeid);
+ $adht->fetch($object->typeid);
- $subjecttosend=$adh->makeSubstitution($conf->global->ADHERENT_MAIL_COTIS_SUBJECT);
- $texttosend=$adh->makeSubstitution($adht->getMailOnSubscription());
+ $subjecttosend=$object->makeSubstitution($conf->global->ADHERENT_MAIL_COTIS_SUBJECT);
+ $texttosend=$object->makeSubstitution($adht->getMailOnSubscription());
$tmp=' global->ADHERENT_DEFAULT_SENDINFOBYMAIL?' checked="checked"':'').'>';
$helpcontent='';
$helpcontent.=''.$langs->trans("MailFrom").' : '.$conf->global->ADHERENT_MAIL_FROM.' '."\n";
- $helpcontent.=''.$langs->trans("MailRecipient").' : '.$adh->email.' '."\n";
+ $helpcontent.=''.$langs->trans("MailRecipient").' : '.$object->email.' '."\n";
$helpcontent.=''.$langs->trans("Subject").' : '."\n";
$helpcontent.=$subjecttosend."\n";
$helpcontent.=" ";
@@ -1010,7 +1008,8 @@ else
print $langs->trans("ErrorRecordNotFound");
}
-$db->close();
llxFooter();
+
+$db->close();
?>
diff --git a/htdocs/adherents/class/adherent.class.php b/htdocs/adherents/class/adherent.class.php
index 176a8b3efb3..105c4c2485e 100644
--- a/htdocs/adherents/class/adherent.class.php
+++ b/htdocs/adherents/class/adherent.class.php
@@ -1435,6 +1435,12 @@ class Adherent extends CommonObject
$mydb=getDoliDBInstance('mysql',ADHERENT_SPIP_SERVEUR,ADHERENT_SPIP_USER,ADHERENT_SPIP_PASS,ADHERENT_SPIP_DB,ADHERENT_SPIP_PORT);
+ if (! $mydb->ok)
+ {
+ $this->error=$mydb->lasterror();
+ return 0;
+ }
+
$result = $mydb->query($query);
if ($result)
{
@@ -1443,7 +1449,7 @@ class Adherent extends CommonObject
}
else
{
- $this->error=$mydb->error();
+ $this->error=$mydb->lasterror();
return 0;
}
}
diff --git a/htdocs/adherents/fiche.php b/htdocs/adherents/fiche.php
index 56e51914e7d..0f756e5eaf2 100644
--- a/htdocs/adherents/fiche.php
+++ b/htdocs/adherents/fiche.php
@@ -99,7 +99,6 @@ $hookmanager->initHooks(array('membercard'));
$parameters=array('socid'=>$socid);
$reshook=$hookmanager->executeHooks('doActions',$parameters,$object,$action); // Note that $action and $object may have been modified by some hooks
-
if ($action == 'setuserid' && ($user->rights->user->self->creer || $user->rights->user->user->creer))
{
$error=0;
@@ -613,15 +612,15 @@ if ($user->rights->adherent->creer && $action == 'confirm_add_spip' && $confirm
* View
*/
+$form = new Form($db);
+$formcompany = new FormCompany($db);
+
// fetch optionals attributes and labels
$extralabels=$extrafields->fetch_name_optionals_label('member');
$help_url='EN:Module_Foundations|FR:Module_Adhérents|ES:Módulo_Miembros';
llxHeader('',$langs->trans("Member"),$help_url);
-$form = new Form($db);
-$formcompany = new FormCompany($db);
-
$countrynotdefined=$langs->trans("ErrorSetACountryFirst").' ('.$langs->trans("SeeAbove").')';
if ($action == 'create')
@@ -821,10 +820,9 @@ if ($action == 'edit')
*
********************************************/
- //$object = new Adherent($db);
$res=$object->fetch($rowid);
if ($res < 0) { dol_print_error($db,$object->error); exit; }
- //$res=$object->fetch_optionals($rowid,$extralabels);
+ //$res=$object->fetch_optionals($object->id,$extralabels);
//if ($res < 0) { dol_print_error($db); exit; }
$adht = new AdherentType($db);
@@ -1060,8 +1058,8 @@ if ($rowid && $action != 'edit')
//$object = new Adherent($db);
$res=$object->fetch($rowid);
if ($res < 0) { dol_print_error($db,$object->error); exit; }
- //$res=$object->fetch_optionals($rowid,$extralabels);
- //if ($res < 0) { dol_print_error($db); exit; }
+ $res=$object->fetch_optionals($object->id,$extralabels);
+ if ($res < 0) { dol_print_error($db); exit; }
$adht = new AdherentType($db);
$res=$adht->fetch($object->typeid);
diff --git a/htdocs/product/fiche.php b/htdocs/product/fiche.php
index b24bce1e703..d310325d019 100644
--- a/htdocs/product/fiche.php
+++ b/htdocs/product/fiche.php
@@ -664,6 +664,7 @@ llxHeader('',$langs->trans("CardProduct".$_GET["type"]),$helpurl);
$form = new Form($db);
$formproduct = new FormProduct($db);
+$object=new Product($db);
if (is_object($objcanvas) && $objcanvas->displayCanvasExists($action))
@@ -862,14 +863,11 @@ else
else if ($id || $ref)
{
- $object=new Product($db);
$res=$object->fetch($id,$ref);
if ($res < 0) { dol_print_error($db,$object->error); exit; }
- $res=$object->fetch_optionals($id,$extralabels);
+ $res=$object->fetch_optionals($object->id,$extralabels);
- /*
- * Fiche en mode edition
- */
+ // Fiche en mode edition
if ($action == 'edit' && ($user->rights->produit->creer || $user->rights->service->creer))
{
$type = $langs->trans('Product');
@@ -1031,9 +1029,7 @@ else
print '';
}
- /*
- * Fiche en mode visu
- */
+ // Fiche en mode visu
else
{
$head=product_prepare_head($object, $user);
diff --git a/htdocs/public/members/public_card.php b/htdocs/public/members/public_card.php
index b0ae5a8832b..7835d1e3055 100644
--- a/htdocs/public/members/public_card.php
+++ b/htdocs/public/members/public_card.php
@@ -1,7 +1,7 @@
* Copyright (C) 2002-2003 Jean-Louis Bergamo
- * Copyright (C) 2007-2011 Laurent Destailleur
+ * Copyright (C) 2007-2012 Laurent Destailleur
*
* 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
@@ -41,7 +41,9 @@ $langs->load("companies");
$langs->load("other");
$rowid=$_GET["id"];
-$adho = new ExtraFields($db);
+$object = new Adherent($db);
+$extrafields = new ExtraFields($db);
+
/*
@@ -51,6 +53,7 @@ $adho = new ExtraFields($db);
// None
+
/*
* View
*/
@@ -58,17 +61,16 @@ $adho = new ExtraFields($db);
llxHeaderVierge($langs->trans("MemberCard"));
// fetch optionals attributes and labels
-$adho->fetch_name_optionals_label();
+$extralabels=$extrafields->fetch_name_optionals_label('member');
if ($rowid > 0)
{
- $adh = new Adherent($db);
- $adh->id = $rowid;
- $adh->fetch($rowid);
- $adh->fetch_optionals($rowid);
+ $res=$object->fetch($id,$ref);
+ if ($res < 0) { dol_print_error($db,$object->error); exit; }
+ $res=$object->fetch_optionals($object->id,$extralabels);
print_titre($langs->trans("MemberCard"));
- if (empty($adh->public))
+ if (empty($object->public))
{
print $langs->trans("ErrorThisMemberIsNotPublic");
}
@@ -76,44 +78,45 @@ if ($rowid > 0)
{
print '';
- print ''.$langs->trans("Type").' '.$adh->type." \n";
+ print ''.$langs->trans("Type").' '.$object->type." \n";
- print ''.$langs->trans("Person").' '.$adh->morphy.' ';
+ print ''.$langs->trans("Person").' '.$object->morphy.' ';
- print ''.$langs->trans("Firstname").' '.$adh->prenom.' ';
+ print ''.$langs->trans("Firstname").' '.$object->firstname.' ';
- print ''.$langs->trans("Lastname").' '.$adh->nom.' ';
+ print ''.$langs->trans("Lastname").' '.$object->lastname.' ';
- print ''.$langs->trans("Company").' '.$adh->societe.' ';
+ print ''.$langs->trans("Company").' '.$object->societe.' ';
- print ''.$langs->trans("Address").' '.nl2br($adh->adresse).' ';
+ print ''.$langs->trans("Address").' '.nl2br($object->address).' ';
- print ''.$langs->trans("Zip").' '.$langs->trans("Town").' '.$adh->cp.' '.$adh->ville.' ';
+ print ''.$langs->trans("Zip").' '.$langs->trans("Town").' '.$object->zip.' '.$object->town.' ';
- print ''.$langs->trans("Country").' '.$adh->pays.' ';
+ print ''.$langs->trans("Country").' '.$object->pays.' ';
- print ''.$langs->trans("EMail").' '.$adh->email.' ';
+ print ''.$langs->trans("EMail").' '.$object->email.' ';
- print ''.$langs->trans("Birthday").' '.$adh->naiss.' ';
+ print ''.$langs->trans("Birthday").' '.$object->naiss.' ';
- if (isset($adh->photo) && $adh->photo !=''){
- print 'URL Photo '."photo\"> photo\"> ".' ';
+ if (isset($object->photo) && $object->photo !=''){
+ print 'URL Photo '."photo\"> photo\"> ".' ';
}
- // foreach($adho->attribute_label as $key=>$value){
- // print "$value ".$adh->array_options["options_$key"]." \n";
+ // foreach($objecto->attribute_label as $key=>$value){
+ // print "$value ".$object->array_options["options_$key"]." \n";
// }
- print ''.$langs->trans("Comments").' '.nl2br($adh->note).' ';
+ print ''.$langs->trans("Comments").' '.nl2br($object->note).' ';
print '
';
}
}
-$db->close();
llxFooterVierge();
+$db->close();
+
/**
diff --git a/htdocs/societe/soc.php b/htdocs/societe/soc.php
index 44879bbb723..ec22772fab2 100644
--- a/htdocs/societe/soc.php
+++ b/htdocs/societe/soc.php
@@ -992,7 +992,7 @@ else
$object = new Societe($db);
$res=$object->fetch($socid);
if ($res < 0) { dol_print_error($db,$object->error); exit; }
- $res=$object->fetch_optionals($socid,$extralabels);
+ $res=$object->fetch_optionals($object->id,$extralabels);
//if ($res < 0) { dol_print_error($db); exit; }
// Load object modCodeTiers
@@ -1440,7 +1440,7 @@ else
$object = new Societe($db);
$res=$object->fetch($socid);
if ($res < 0) { dol_print_error($db,$object->error); exit; }
- $res=$object->fetch_optionals($socid,$extralabels);
+ $res=$object->fetch_optionals($object->id,$extralabels);
//if ($res < 0) { dol_print_error($db); exit; }