';
@@ -1205,23 +1249,23 @@ if ($rowid && $action != 'edit')
// Ref
print '| '.$langs->trans("Ref").' | ';
print '';
- print $html->showrefnav($adh,'rowid');
+ print $html->showrefnav($object,'rowid');
print ' |
';
$showphoto='';
- $showphoto.=$html->showphoto('memberphoto',$adh);
+ $showphoto.=$html->showphoto('memberphoto',$object);
$showphoto.=' | ';
// 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 '
';
@@ -1229,72 +1273,92 @@ if ($rowid && $action != 'edit')
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->nom.' | ';
+ print '
| '.$langs->trans("Lastname").' | '.$object->nom.' | ';
print '
';
// Firstname
- print '| '.$langs->trans("Firstname").' | '.$adh->prenom.' |
';
+ print '| '.$langs->trans("Firstname").' | '.$object->prenom.' |
';
// Password
if (empty($conf->global->ADHERENT_LOGIN_NOT_REQUIRED))
{
- print '| '.$langs->trans("Password").' | '.preg_replace('/./i','*',$adh->pass).' |
';
+ print '| '.$langs->trans("Password").' | '.preg_replace('/./i','*',$object->pass).' |
';
}
// Address
print '| '.$langs->trans("Address").' | ';
- dol_print_address($adh->address,'gmap','member',$adh->id);
+ dol_print_address($object->address,'gmap','member',$object->id);
print ' |
';
// Zip / Town
- print '| '.$langs->trans("Zip").' / '.$langs->trans("Town").' | '.$adh->zip.(($adh->zip && $adh->town)?' / ':'').$adh->town.' |
';
+ print '| '.$langs->trans("Zip").' / '.$langs->trans("Town").' | '.$object->zip.(($object->zip && $object->town)?' / ':'').$object->town.' |
';
// Country
print '| '.$langs->trans("Country").' | ';
- $img=picto_from_langcode($adh->pays_code);
+ $img=picto_from_langcode($object->pays_code);
if ($img) print $img.' ';
- print getCountry($adh->pays_code);
+ print getCountry($object->pays_code);
print ' |
';
// State
- print '| '.$langs->trans('State').' | '.$adh->departement.' | ';
+ print '
| '.$langs->trans('State').' | '.$object->departement.' | ';
// Tel pro.
- print '
| '.$langs->trans("PhonePro").' | '.dol_print_phone($adh->phone,$adh->pays_code,0,$adh->fk_soc,1).' |
';
+ print '| '.$langs->trans("PhonePro").' | '.dol_print_phone($object->phone,$object->pays_code,0,$object->fk_soc,1).' |
';
// Tel perso
- print '| '.$langs->trans("PhonePerso").' | '.dol_print_phone($adh->phone_perso,$adh->pays_code,0,$adh->fk_soc,1).' |
';
+ print '| '.$langs->trans("PhonePerso").' | '.dol_print_phone($object->phone_perso,$object->pays_code,0,$object->fk_soc,1).' |
';
// Tel mobile
- print '| '.$langs->trans("PhoneMobile").' | '.dol_print_phone($adh->phone_mobile,$adh->pays_code,0,$adh->fk_soc,1).' |
';
+ print '| '.$langs->trans("PhoneMobile").' | '.dol_print_phone($object->phone_mobile,$object->pays_code,0,$object->fk_soc,1).' |
';
// EMail
- print '| '.$langs->trans("EMail").' | '.dol_print_email($adh->email,0,$adh->fk_soc,1).' |
';
+ print '| '.$langs->trans("EMail").' | '.dol_print_email($object->email,0,$object->fk_soc,1).' |
';
// Date naissance
- print '| '.$langs->trans("Birthday").' | '.dol_print_date($adh->naiss,'day').' |
';
+ print '| '.$langs->trans("Birthday").' | '.dol_print_date($object->naiss,'day').' |
';
// Public
- print '| '.$langs->trans("Public").' | '.yn($adh->public).' |
';
+ print '| '.$langs->trans("Public").' | '.yn($object->public).' |
';
// Status
- print '| '.$langs->trans("Status").' | '.$adh->getLibStatut(4).' |
';
+ print '| '.$langs->trans("Status").' | '.$object->getLibStatut(4).' |
';
// Other attributes
+ /*
foreach($extrafields->attribute_label as $key=>$label)
{
- $value=$adh->array_options["options_$key"];
+ $value=$object->array_options["options_$key"];
print "| ".$label." | ";
print $extrafields->showOutputField($key,$value);
print " |
\n";
}
+ */
+
+ // Hook for external modules
+ if (! empty($object->hooks))
+ {
+ foreach($object->hooks as $hook)
+ {
+ if ($hook['type'] == 'member_extrafields' && ! empty($hook['modules']))
+ {
+ foreach($hook['modules'] as $module)
+ {
+ if (method_exists($module,'showOutputFields'))
+ {
+ $module->showOutputFields($object,$rowid);
+ }
+ }
+ }
+ }
+ }
// Third party Dolibarr
if ($conf->societe->enabled)
@@ -1303,29 +1367,29 @@ if ($rowid && $action != 'edit')
print '';
- 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
@@ -1341,23 +1405,23 @@ if ($rowid && $action != 'edit')
print '';
- print ' | ';
+ print ' | ';
if ($_GET['action'] == 'editlogin')
{
/*$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 $html->form_users($_SERVER['PHP_SELF'].'?rowid='.$adh->id,$adh->user_id,'userid','');
+ print $html->form_users($_SERVER['PHP_SELF'].'?rowid='.$object->id,$object->user_id,'userid','');
}
else
{
- if ($adh->user_id)
+ if ($object->user_id)
{
- print $html->form_users($_SERVER['PHP_SELF'].'?rowid='.$adh->id,$adh->user_id,'none');
+ print $html->form_users($_SERVER['PHP_SELF'].'?rowid='.$object->id,$object->user_id,'none');
}
else print $langs->trans("NoDolibarrAccess");
}
@@ -1387,7 +1451,7 @@ if ($rowid && $action != 'edit')
}
// Valider
- if ($adh->statut == -1)
+ if ($object->statut == -1)
{
if ($user->rights->adherent->creer)
{
@@ -1400,7 +1464,7 @@ if ($rowid && $action != 'edit')
}
// Reactiver
- if ($adh->statut == 0)
+ if ($object->statut == 0)
{
if ($user->rights->adherent->creer)
{
@@ -1413,11 +1477,11 @@ if ($rowid && $action != 'edit')
}
// Envoi fiche par mail
- if ($adh->statut >= 1)
+ if ($object->statut >= 1)
{
if ($user->rights->adherent->creer)
{
- if ($adh->email) print "id&action=sendinfo\">".$langs->trans("SendCardByMail")."\n";
+ if ($object->email) print "id&action=sendinfo\">".$langs->trans("SendCardByMail")."\n";
else print "trans("NoEMail"))."\">".$langs->trans("SendCardByMail")."\n";
}
else
@@ -1427,7 +1491,7 @@ if ($rowid && $action != 'edit')
}
// Resilier
- if ($adh->statut >= 1)
+ if ($object->statut >= 1)
{
if ($user->rights->adherent->supprimer)
{
@@ -1440,11 +1504,11 @@ if ($rowid && $action != 'edit')
}
// Create third party
- if ($conf->societe->enabled && ! $adh->fk_soc)
+ if ($conf->societe->enabled && ! $object->fk_soc)
{
if ($user->rights->societe->creer)
{
- if ($adh->statut != -1) print 'id.'&action=create_thirdparty">'.$langs->trans("CreateDolibarrThirdParty").'';
+ if ($object->statut != -1) print 'id.'&action=create_thirdparty">'.$langs->trans("CreateDolibarrThirdParty").'';
else print ''.$langs->trans("CreateDolibarrThirdParty").'';
}
else
@@ -1454,11 +1518,11 @@ if ($rowid && $action != 'edit')
}
// Create user
- if (! $user->societe_id && ! $adh->user_id)
+ if (! $user->societe_id && ! $object->user_id)
{
if ($user->rights->user->user->creer)
{
- if ($adh->statut != -1) print 'id.'&action=create_user">'.$langs->trans("CreateDolibarrLogin").'';
+ if ($object->statut != -1) print 'id.'&action=create_user">'.$langs->trans("CreateDolibarrLogin").'';
else print ''.$langs->trans("CreateDolibarrLogin").'';
}
else
@@ -1470,7 +1534,7 @@ if ($rowid && $action != 'edit')
// Delete
if ($user->rights->adherent->supprimer)
{
- print "id&action=delete\">".$langs->trans("Delete")."\n";
+ print "id&action=delete\">".$langs->trans("Delete")."\n";
}
else
{
@@ -1480,17 +1544,17 @@ if ($rowid && $action != 'edit')
// Action SPIP
if ($conf->global->ADHERENT_USE_SPIP)
{
- $isinspip=$adh->is_in_spip();
+ $isinspip=$object->is_in_spip();
if ($isinspip == 1)
{
- print "id&action=del_spip\">".$langs->trans("DeleteIntoSpip")."\n";
+ print "id&action=del_spip\">".$langs->trans("DeleteIntoSpip")."\n";
}
if ($isinspip == 0)
{
- print "id&action=add_spip\">".$langs->trans("AddIntoSpip")."\n";
+ print "id&action=add_spip\">".$langs->trans("AddIntoSpip")."\n";
}
if ($isinspip == -1) {
- print ' Failed to connect to SPIP: '.$adh->error.'';
+ print ' Failed to connect to SPIP: '.$object->error.'';
}
}
@@ -1504,5 +1568,5 @@ if ($rowid && $action != 'edit')
$db->close();
-llxFooter('$Date: 2011/07/31 22:23:27 $ - $Revision: 1.238 $');
+llxFooter('$Date: 2011/08/09 17:59:52 $ - $Revision: 1.239 $');
?>
diff --git a/htdocs/core/class/commonobject.class.php b/htdocs/core/class/commonobject.class.php
index 53be2fb2579..4eeb7d603b9 100644
--- a/htdocs/core/class/commonobject.class.php
+++ b/htdocs/core/class/commonobject.class.php
@@ -21,7 +21,7 @@
* \file htdocs/core/class/commonobject.class.php
* \ingroup core
* \brief File of parent class of all other business classes (invoices, contracts, proposals, orders, ...)
- * \version $Id: commonobject.class.php,v 1.149 2011/08/09 09:13:09 hregis Exp $
+ * \version $Id: commonobject.class.php,v 1.150 2011/08/09 17:59:45 hregis Exp $
*/
@@ -1456,7 +1456,9 @@ class CommonObject
{
if (in_array($type,$hooks))
{
- $path = '/'.$module.'/class/';
+ $path = $module;
+ if ($module == 'adherent') $path = 'adherents';
+ $path = '/'.$path.'/class/';
$actionfile = 'actions_'.$module.'.class.php';
$daofile = 'dao_'.$module.'.class.php';
$pathroot = '';
@@ -1990,7 +1992,7 @@ class CommonObject
/**
*
*/
- function showInputFields($object,$post='',$socid=0)
+ function showInputFields($object,$post='',$id=0)
{
global $conf;
@@ -1999,19 +2001,19 @@ class CommonObject
$extrafields = new ExtraFields($this->db);
$elementtype = $object->element;
- if ($object->element = 'societe') $elementtype = 'company';
+ if ($object->element == 'societe') $elementtype = 'company';
$extralabels=$extrafields->fetch_name_optionals_label($elementtype);
- if ($socid)
+ if ($id)
{
- $res=$object->fetch_optionals($socid,$extralabels);
+ $res=$object->fetch_optionals($id,$extralabels);
if ($res < 0) { dol_print_error($db); exit; }
}
-
+
foreach($extrafields->attribute_label as $key=>$label)
{
- $value=(isset($post["options_$key"])?$post["options_$key"]:($socid?$object->array_options["options_$key"]:''));
+ $value=(isset($post["options_$key"])?$post["options_$key"]:($id?$object->array_options["options_$key"]:''));
print " | | ".$label.' | ';
print $extrafields->showInputField($key,$value);
print ' |
'."\n";
@@ -2021,7 +2023,7 @@ class CommonObject
/**
*
*/
- function showOutputFields($object,$socid)
+ function showOutputFields($object,$id)
{
global $conf;
@@ -2030,11 +2032,11 @@ class CommonObject
$extrafields = new ExtraFields($this->db);
$elementtype = $object->element;
- if ($object->element = 'societe') $elementtype = 'company';
+ if ($object->element == 'societe') $elementtype = 'company';
$extralabels=$extrafields->fetch_name_optionals_label($elementtype);
- $res=$object->fetch_optionals($socid,$extralabels);
+ $res=$object->fetch_optionals($id,$extralabels);
if ($res < 0) { dol_print_error($db); exit; }
foreach($extrafields->attribute_label as $key=>$label)
@@ -2050,29 +2052,29 @@ class CommonObject
* Add/Update extra fields
* TODO Use also type of field to do manage date fields
*/
- function insertExtraFields()
+ function insertExtraFields($object)
{
- if (sizeof($this->array_options) > 0)
+ if (sizeof($object->array_options) > 0)
{
$this->db->begin();
- $sql_del = "DELETE FROM ".MAIN_DB_PREFIX.$this->table_element."_extrafields WHERE fk_object = ".$this->id;
- dol_syslog(get_class($this)."::insertExtraFields delete sql=".$sql_del);
+ $sql_del = "DELETE FROM ".MAIN_DB_PREFIX.$this->table_element."_extrafields WHERE fk_object = ".$object->id;
+ dol_syslog(get_class($object)."::insertExtraFields delete sql=".$sql_del);
$this->db->query($sql_del);
- $sql = "INSERT INTO ".MAIN_DB_PREFIX.$this->table_element."_extrafields (fk_object";
- foreach($this->array_options as $key => $value)
+ $sql = "INSERT INTO ".MAIN_DB_PREFIX.$object->table_element."_extrafields (fk_object";
+ foreach($object->array_options as $key => $value)
{
// Add field of attribut
$sql.=",".substr($key,8); // Remove 'options_' prefix
}
- $sql .= ") VALUES (".$this->id;
- foreach($this->array_options as $key => $value)
+ $sql .= ") VALUES (".$object->id;
+ foreach($object->array_options as $key => $value)
{
// Add field o fattribut
- if ($this->array_options[$key] != '')
+ if ($object->array_options[$key] != '')
{
- $sql.=",'".$this->array_options[$key]."'";
+ $sql.=",'".$object->array_options[$key]."'";
}
else
{
@@ -2081,12 +2083,12 @@ class CommonObject
}
$sql.=")";
- dol_syslog(get_class($this)."::insertExtraFields insert sql=".$sql);
+ dol_syslog(get_class($object)."::insertExtraFields insert sql=".$sql);
$resql = $this->db->query($sql);
if (! $resql)
{
$this->error=$this->db->lasterror();
- dol_syslog(get_class($this)."::update ".$this->error,LOG_ERR);
+ dol_syslog(get_class($object)."::update ".$this->error,LOG_ERR);
$this->db->rollback();
return -1;
}
diff --git a/htdocs/includes/modules/modAdherent.class.php b/htdocs/includes/modules/modAdherent.class.php
index 1b82f89f67a..df3e5508da3 100644
--- a/htdocs/includes/modules/modAdherent.class.php
+++ b/htdocs/includes/modules/modAdherent.class.php
@@ -28,7 +28,7 @@
* \file htdocs/includes/modules/modAdherent.class.php
* \ingroup member
* \brief File descriptor or module Member
- * \version $Id: modAdherent.class.php,v 1.87 2011/07/31 23:28:11 eldy Exp $
+ * \version $Id: modAdherent.class.php,v 1.88 2011/08/09 17:59:51 hregis Exp $
*/
include_once(DOL_DOCUMENT_ROOT ."/includes/modules/DolibarrModules.class.php");
@@ -74,9 +74,10 @@ class modAdherent extends DolibarrModules
// Constantes
//-----------
$this->const = array();
- $this->const[0] = array("MAIN_SEARCHFORM_ADHERENT","yesno","1","Show form for quick member search");
- $this->const[1] = array("ADHERENT_MAIL_RESIL","texte","Votre adhésion vient d'être résiliée.\r\nNous espérons vous revoir très bientôt","Mail de résiliation");
- $this->const[2] = array("ADHERENT_MAIL_VALID","texte","Votre adhésion vient d'être validée. \r\nVoici le rappel de vos coordonnées (toute information erronée entrainera la non validation de votre inscription) :\r\n\r\n%INFOS%\r\n\r\n","Mail de validation");
+ $this->const[0] = array("MAIN_MODULE_ADHERENT_HOOKS","chaine",'member_extrafields','',0);
+ $this->const[2] = array("MAIN_SEARCHFORM_ADHERENT","yesno","1","Show form for quick member search");
+ $this->const[3] = array("ADHERENT_MAIL_RESIL","texte","Votre adhésion vient d'être résiliée.\r\nNous espérons vous revoir très bientôt","Mail de résiliation");
+ $this->const[4] = array("ADHERENT_MAIL_VALID","texte","Votre adhésion vient d'être validée. \r\nVoici le rappel de vos coordonnées (toute information erronée entrainera la non validation de votre inscription) :\r\n\r\n%INFOS%\r\n\r\n","Mail de validation");
$this->const[5] = array("ADHERENT_MAIL_VALID_SUBJECT","chaine","Votre adhésion a été validée","Sujet du mail de validation");
$this->const[6] = array("ADHERENT_MAIL_RESIL_SUBJECT","chaine","Résiliation de votre adhésion","Sujet du mail de résiliation");
$this->const[10] = array("ADHERENT_MAILMAN_UNSUB_URL","chaine","http://lists.domain.com/cgi-bin/mailman/admin/%LISTE%/members?adminpw=%MAILMAN_ADMINPW%&user=%EMAIL%","Url de désinscription aux listes mailman");
diff --git a/htdocs/includes/modules/modSociete.class.php b/htdocs/includes/modules/modSociete.class.php
index 92ea19960e0..beed750649a 100644
--- a/htdocs/includes/modules/modSociete.class.php
+++ b/htdocs/includes/modules/modSociete.class.php
@@ -22,7 +22,7 @@
/**
* \defgroup societe Module societe
* \brief Module to manage third parties (customers, prospects)
- * \version $Id: modSociete.class.php,v 1.120 2011/08/09 09:13:09 hregis Exp $
+ * \version $Id: modSociete.class.php,v 1.121 2011/08/09 17:59:50 hregis Exp $
*/
/**
@@ -108,7 +108,7 @@ class modSociete extends DolibarrModules
$this->const[$r][0] = "MAIN_MODULE_SOCIETE_HOOKS";
$this->const[$r][1] = "chaine";
- $this->const[$r][2] = "extrafields";
+ $this->const[$r][2] = "thirdparty_extrafields";
$this->const[$r][3] = "";
$this->const[$r][4] = 0;
$this->const[$r][4] = 'current';
diff --git a/htdocs/societe/class/societe.class.php b/htdocs/societe/class/societe.class.php
index fc8450ad55c..6816a0ed23b 100644
--- a/htdocs/societe/class/societe.class.php
+++ b/htdocs/societe/class/societe.class.php
@@ -26,7 +26,7 @@
* \file htdocs/societe/class/societe.class.php
* \ingroup societe
* \brief File for third party class
- * \version $Id: societe.class.php,v 1.92 2011/07/31 23:22:58 eldy Exp $
+ * \version $Id: societe.class.php,v 1.93 2011/08/09 17:59:50 hregis Exp $
*/
require_once(DOL_DOCUMENT_ROOT."/core/class/commonobject.class.php");
@@ -533,11 +533,32 @@ class Societe extends CommonObject
// Si le fournisseur est classe on l'ajoute
$this->AddFournisseurInCategory($this->fournisseur_categorie);
+ /*
$result=$this->insertExtraFields();
if ($result < 0)
{
$error++;
}
+ */
+
+ // Hook for external modules
+ if (! empty($this->hooks))
+ {
+ foreach($this->hooks as $hook)
+ {
+ if ($hook['type'] == 'thirdparty_extrafields' && ! empty($hook['modules']))
+ {
+ foreach($hook['modules'] as $module)
+ {
+ if (method_exists($module,'insertExtraFields'))
+ {
+ $result=$module->insertExtraFields($this);
+ if ($result < 0) $error++;
+ }
+ }
+ }
+ }
+ }
if (! $error && $call_trigger)
{
diff --git a/htdocs/societe/soc.php b/htdocs/societe/soc.php
index 098bb7385bd..f6372674671 100644
--- a/htdocs/societe/soc.php
+++ b/htdocs/societe/soc.php
@@ -25,7 +25,7 @@
* \file htdocs/societe/soc.php
* \ingroup societe
* \brief Third party card page
- * \version $Id: soc.php,v 1.128 2011/08/09 14:27:38 hregis Exp $
+ * \version $Id: soc.php,v 1.129 2011/08/09 17:59:52 hregis Exp $
*/
require("../main.inc.php");
@@ -78,7 +78,7 @@ else
// Instantiate hooks of thirdparty module. Note that conf->hooks_modules contains array array
if (is_array($conf->hooks_modules) && !empty($conf->hooks_modules))
{
- $object->callHooks(array('thirdpartycard','extrafields'));
+ $object->callHooks(array('thirdpartycard','thirdparty_extrafields'));
}
@@ -1040,7 +1040,7 @@ else
{
foreach($object->hooks as $hook)
{
- if ($hook['type'] == 'extrafields' && ! empty($hook['modules']))
+ if ($hook['type'] == 'thirdparty_extrafields' && ! empty($hook['modules']))
{
foreach($hook['modules'] as $module)
{
@@ -1483,7 +1483,7 @@ else
{
foreach($object->hooks as $hook)
{
- if ($hook['type'] == 'extrafields' && ! empty($hook['modules']))
+ if ($hook['type'] == 'thirdparty_extrafields' && ! empty($hook['modules']))
{
foreach($hook['modules'] as $module)
{
@@ -1839,7 +1839,7 @@ else
{
foreach($object->hooks as $hook)
{
- if ($hook['type'] == 'extrafields' && ! empty($hook['modules']))
+ if ($hook['type'] == 'thirdparty_extrafields' && ! empty($hook['modules']))
{
foreach($hook['modules'] as $module)
{
@@ -2029,5 +2029,5 @@ else
$db->close();
-llxFooter('$Date: 2011/08/09 14:27:38 $ - $Revision: 1.128 $');
+llxFooter('$Date: 2011/08/09 17:59:52 $ - $Revision: 1.129 $');
?>
\ No newline at end of file