Reveiw extrafield for womplaiance with wiki

http://wiki.dolibarr.org/index.php/Extrafields
This commit is contained in:
fhenry 2013-04-26 10:29:14 +02:00
parent d0f44bf25f
commit a06581771c
42 changed files with 72 additions and 84 deletions

View File

@ -41,7 +41,7 @@ foreach ($tmptype2label as $key => $val) $type2label[$key]=$langs->trans($val);
$action=GETPOST('action', 'alpha'); $action=GETPOST('action', 'alpha');
$attrname=GETPOST('attrname', 'alpha'); $attrname=GETPOST('attrname', 'alpha');
$elementtype='member'; $elementtype='adherent'; //Must be the $table_element of the class that manage extrafield
if (!$user->admin) accessforbidden(); if (!$user->admin) accessforbidden();

View File

@ -42,7 +42,7 @@ foreach ($tmptype2label as $key => $val) $type2label[$key]=$langs->trans($val);
$action=GETPOST('action', 'alpha'); $action=GETPOST('action', 'alpha');
$attrname=GETPOST('attrname', 'alpha'); $attrname=GETPOST('attrname', 'alpha');
$elementtype='adherent_type'; $elementtype='adherent_type'; //Must be the $table_element of the class that manage extrafield
if (!$user->admin) accessforbidden(); if (!$user->admin) accessforbidden();

View File

@ -479,8 +479,6 @@ if ($rowid)
{ {
$res=$object->fetch($rowid); $res=$object->fetch($rowid);
if ($res < 0) { dol_print_error($db,$object->error); exit; } if ($res < 0) { dol_print_error($db,$object->error); exit; }
//$res=$object->fetch_optionals($object->id,$extralabels);
//if ($res < 0) { dol_print_error($db); exit; }
$adht->fetch($object->typeid); $adht->fetch($object->typeid);

View File

@ -1095,6 +1095,15 @@ class Adherent extends CommonObject
$this->user_id = $obj->user_id; $this->user_id = $obj->user_id;
$this->user_login = $obj->user_login; $this->user_login = $obj->user_login;
// Retreive all extrafield for thirdparty
// fetch optionals attributes and labels
require_once(DOL_DOCUMENT_ROOT.'/core/class/extrafields.class.php');
$extrafields=new ExtraFields($this->db);
$extralabels=$extrafields->fetch_name_optionals_label($this->table_element,true);
if (count($extralabels)>0) {
$this->fetch_optionals($this->id,$extralabels);
}
$result=$this->fetch_optionals($this->id);
// Load other properties // Load other properties
$result=$this->fetch_subscriptions(); $result=$this->fetch_subscriptions();

View File

@ -33,6 +33,7 @@ require_once DOL_DOCUMENT_ROOT.'/core/class/commonobject.class.php';
class AdherentType extends CommonObject class AdherentType extends CommonObject
{ {
public $table_element = 'adherent_type'; public $table_element = 'adherent_type';
public $element = 'adherent_type';
var $id; var $id;
var $libelle; var $libelle;

View File

@ -65,7 +65,7 @@ $object = new Adherent($db);
$extrafields = new ExtraFields($db); $extrafields = new ExtraFields($db);
// fetch optionals attributes and labels // fetch optionals attributes and labels
$extralabels=$extrafields->fetch_name_optionals_label('member'); $extralabels=$extrafields->fetch_name_optionals_label($object->table_element);
// Get object canvas (By default, this is not defined, so standard usage of dolibarr) // Get object canvas (By default, this is not defined, so standard usage of dolibarr)
$object->getCanvas($rowid); $object->getCanvas($rowid);

View File

@ -47,7 +47,7 @@ foreach ($tmptype2label as $key => $val) $type2label[$key]=$langs->trans($val);
$action=GETPOST('action', 'alpha'); $action=GETPOST('action', 'alpha');
$attrname=GETPOST('attrname', 'alpha'); $attrname=GETPOST('attrname', 'alpha');
$elementtype='actioncomm'; $elementtype='actioncomm'; //Must be the $table_element of the class that manage extrafield
if (!$user->admin) accessforbidden(); if (!$user->admin) accessforbidden();

View File

@ -48,7 +48,7 @@ foreach ($tmptype2label as $key => $val) $type2label[$key]=$langs->trans($val);
$action=GETPOST('action', 'alpha'); $action=GETPOST('action', 'alpha');
$attrname=GETPOST('attrname', 'alpha'); $attrname=GETPOST('attrname', 'alpha');
$elementtype='commande'; $elementtype='commande'; //Must be the $table_element of the class that manage extrafield
if (!$user->admin) accessforbidden(); if (!$user->admin) accessforbidden();

View File

@ -49,7 +49,7 @@ foreach ($tmptype2label as $key => $val) $type2label[$key]=$langs->trans($val);
$action=GETPOST('action', 'alpha'); $action=GETPOST('action', 'alpha');
$attrname=GETPOST('attrname', 'alpha'); $attrname=GETPOST('attrname', 'alpha');
$elementtype='commande_fournisseur'; $elementtype='commande_fournisseur'; //Must be the $table_element of the class that manage extrafield
if (!$user->admin) accessforbidden(); if (!$user->admin) accessforbidden();

View File

@ -48,7 +48,7 @@ foreach ($tmptype2label as $key => $val) $type2label[$key]=$langs->trans($val);
$action=GETPOST('action', 'alpha'); $action=GETPOST('action', 'alpha');
$attrname=GETPOST('attrname', 'alpha'); $attrname=GETPOST('attrname', 'alpha');
$elementtype='commande_fournisseur'; $elementtype='commande_fournisseur'; //Must be the $table_element of the class that manage extrafield
if (!$user->admin) accessforbidden(); if (!$user->admin) accessforbidden();

View File

@ -64,7 +64,7 @@ $contact = new Contact($db);
$extrafields = new ExtraFields($db); $extrafields = new ExtraFields($db);
// fetch optionals attributes and labels // fetch optionals attributes and labels
$extralabels=$extrafields->fetch_name_optionals_label('actioncomm'); $extralabels=$extrafields->fetch_name_optionals_label($actioncomm->table_element);
//var_dump($_POST); //var_dump($_POST);

View File

@ -42,7 +42,7 @@ foreach ($tmptype2label as $key => $val) $type2label[$key]=$langs->trans($val);
$action=GETPOST('action', 'alpha'); $action=GETPOST('action', 'alpha');
$attrname=GETPOST('attrname', 'alpha'); $attrname=GETPOST('attrname', 'alpha');
$elementtype='propal'; $elementtype='propal'; //Must be the $table_element of the class that manage extrafield
if (!$user->admin) accessforbidden(); if (!$user->admin) accessforbidden();

View File

@ -49,7 +49,7 @@ $result=$object->fetch($id);
$extrafields = new ExtraFields($db); $extrafields = new ExtraFields($db);
// fetch optionals attributes and labels // fetch optionals attributes and labels
$extralabels=$extrafields->fetch_name_optionals_label('mailing'); $extralabels=$extrafields->fetch_name_optionals_label($object->table_element);
// Initialize technical object to manage hooks of thirdparties. Note that conf->hooks_modules contains array array // Initialize technical object to manage hooks of thirdparties. Note that conf->hooks_modules contains array array
$hookmanager->initHooks(array('mailingcard')); $hookmanager->initHooks(array('mailingcard'));

View File

@ -83,7 +83,7 @@ $object = new Propal($db);
$extrafields = new ExtraFields($db); $extrafields = new ExtraFields($db);
// fetch optionals attributes and labels // fetch optionals attributes and labels
$extralabels=$extrafields->fetch_name_optionals_label('propal'); $extralabels=$extrafields->fetch_name_optionals_label($object->table_element);
// Load object // Load object
if ($id > 0 || ! empty($ref)) if ($id > 0 || ! empty($ref))
@ -1116,7 +1116,7 @@ else if ($action == 'down' && $user->rights->propal->creer)
else if ($action == 'update_extras') else if ($action == 'update_extras')
{ {
// Fill array 'array_options' with data from update form // Fill array 'array_options' with data from update form
$extralabels=$extrafields->fetch_name_optionals_label('propal'); $extralabels=$extrafields->fetch_name_optionals_label($object->table_element);
$ret = $extrafields->setOptionalsFromPost($extralabels,$object); $ret = $extrafields->setOptionalsFromPost($extralabels,$object);
// Actions on extra fields (by external module or standard code) // Actions on extra fields (by external module or standard code)

View File

@ -1187,14 +1187,9 @@ class Propal extends CommonObject
if(!class_exists('Extrafields')) if(!class_exists('Extrafields'))
require_once(DOL_DOCUMENT_ROOT.'/core/class/extrafields.class.php'); require_once(DOL_DOCUMENT_ROOT.'/core/class/extrafields.class.php');
$extrafields=new ExtraFields($this->db); $extrafields=new ExtraFields($this->db);
$extralabels=$extrafields->fetch_name_optionals_label('propal',true); $extralabels=$extrafields->fetch_name_optionals_label($this->table_element,true);
//$this->fetch_optionals($this->id,$extralabels);
if (count($extralabels)>0) { if (count($extralabels)>0) {
$this->array_options = array(); $this->fetch_optionals($this->id,$extralabels);
}
foreach($extrafields->attribute_label as $key=>$label)
{
$this->array_options['options_'.$key]=$label;
} }
return 1; return 1;
} }

View File

@ -82,7 +82,7 @@ $extrafields = new ExtraFields($db);
// fetch optionals attributes and labels // fetch optionals attributes and labels
$extralabels=$extrafields->fetch_name_optionals_label('commande'); $extralabels=$extrafields->fetch_name_optionals_label($object->table_element);
// Load object // Load object
if ($id > 0 || ! empty($ref)) if ($id > 0 || ! empty($ref))
@ -1127,7 +1127,7 @@ else if ($action == 'print_file' AND $user->rights->printipp->use)
else if ($action == 'update_extras') else if ($action == 'update_extras')
{ {
// Fill array 'array_options' with data from update form // Fill array 'array_options' with data from update form
$extralabels=$extrafields->fetch_name_optionals_label('commande'); $extralabels=$extrafields->fetch_name_optionals_label($object->table_element);
$ret = $extrafields->setOptionalsFromPost($extralabels,$object); $ret = $extrafields->setOptionalsFromPost($extralabels,$object);
// Actions on extra fields (by external module or standard code) // Actions on extra fields (by external module or standard code)

View File

@ -1860,7 +1860,7 @@ if (! empty($conf->global->MAIN_DISABLE_CONTACTS_TAB) && $user->rights->facture-
if ($action == 'update_extras') if ($action == 'update_extras')
{ {
// Fill array 'array_options' with data from add form // Fill array 'array_options' with data from add form
$extralabels=$extrafields->fetch_name_optionals_label('facture'); $extralabels=$extrafields->fetch_name_optionals_label($object->table_element);
$ret = $extrafields->setOptionalsFromPost($extralabels,$object); $ret = $extrafields->setOptionalsFromPost($extralabels,$object);
// Actions on extra fields (by external module or standard code) // Actions on extra fields (by external module or standard code)
@ -1905,7 +1905,7 @@ llxHeader('',$langs->trans('Bill'),'EN:Customers_Invoices|FR:Factures_Clients|ES
if ($action == 'create') if ($action == 'create')
{ {
$facturestatic=new Facture($db); $facturestatic=new Facture($db);
$extralabels=$extrafields->fetch_name_optionals_label('facture'); $extralabels=$extrafields->fetch_name_optionals_label($facturestatic->table_element);
print_fiche_titre($langs->trans('NewBill')); print_fiche_titre($langs->trans('NewBill'));
@ -2399,7 +2399,7 @@ else if ($id > 0 || ! empty($ref))
$result=$object->fetch($id,$ref); $result=$object->fetch($id,$ref);
// fetch optionals attributes and labels // fetch optionals attributes and labels
$extralabels=$extrafields->fetch_name_optionals_label('facture'); $extralabels=$extrafields->fetch_name_optionals_label($object->table_element);
if ($result > 0) if ($result > 0)
{ {

View File

@ -43,7 +43,7 @@ foreach ($tmptype2label as $key => $val) $type2label[$key]=$langs->trans($val);
$action=GETPOST('action', 'alpha'); $action=GETPOST('action', 'alpha');
$attrname=GETPOST('attrname', 'alpha'); $attrname=GETPOST('attrname', 'alpha');
$elementtype='facture'; $elementtype='facture'; //Must be the $table_element of the class that manage extrafield
if (!$user->admin) accessforbidden(); if (!$user->admin) accessforbidden();

View File

@ -879,13 +879,9 @@ class Facture extends CommonInvoice
if(!class_exists('Extrafields')) if(!class_exists('Extrafields'))
require_once(DOL_DOCUMENT_ROOT.'/core/class/extrafields.class.php'); require_once(DOL_DOCUMENT_ROOT.'/core/class/extrafields.class.php');
$extrafields=new ExtraFields($this->db); $extrafields=new ExtraFields($this->db);
$extralabels=$extrafields->fetch_name_optionals_label('facture',true); $extralabels=$extrafields->fetch_name_optionals_label($this->table_element,true);
if (count($extralabels)>0) { if (count($extralabels)>0) {
$this->array_options = array(); $this->fetch_optionals($this->id,$extralabels);
}
foreach($extrafields->attribute_label as $key=>$label)
{
$this->array_options['options_'.$key]=$label;
} }
/* /*

View File

@ -53,7 +53,7 @@ $object = new Contact($db);
$extrafields = new ExtraFields($db); $extrafields = new ExtraFields($db);
// fetch optionals attributes and labels // fetch optionals attributes and labels
$extralabels=$extrafields->fetch_name_optionals_label('contact'); $extralabels=$extrafields->fetch_name_optionals_label($object->table_element);
// Get object canvas (By default, this is not defined, so standard usage of dolibarr) // Get object canvas (By default, this is not defined, so standard usage of dolibarr)
$object->getCanvas($id); $object->getCanvas($id);

View File

@ -177,7 +177,7 @@ abstract class CommonDocGenerator
if(!class_exists('Extrafields')) if(!class_exists('Extrafields'))
require_once DOL_DOCUMENT_ROOT.'/core/class/extrafields.class.php'; require_once DOL_DOCUMENT_ROOT.'/core/class/extrafields.class.php';
$extrafields = new ExtraFields($this->db); $extrafields = new ExtraFields($this->db);
$extralabels = $extrafields->fetch_name_optionals_label('company',true); $extralabels = $extrafields->fetch_name_optionals_label('societe',true);
$object->fetch_optionals($object->id,$extralabels); $object->fetch_optionals($object->id,$extralabels);
foreach($extrafields->attribute_label as $key=>$label) foreach($extrafields->attribute_label as $key=>$label)

View File

@ -2020,7 +2020,7 @@ abstract class CommonObject
// optionsArray not already loaded, so we load it // optionsArray not already loaded, so we load it
require_once DOL_DOCUMENT_ROOT.'/core/class/extrafields.class.php'; require_once DOL_DOCUMENT_ROOT.'/core/class/extrafields.class.php';
$extrafields = new ExtraFields($this->db); $extrafields = new ExtraFields($this->db);
$optionsArray = $extrafields->fetch_name_optionals_label(); $optionsArray = $extrafields->fetch_name_optionals_label($this->table_element);
} }
// Request to get complementary values // Request to get complementary values
@ -2108,7 +2108,7 @@ abstract class CommonObject
$langs->load('admin'); $langs->load('admin');
require_once DOL_DOCUMENT_ROOT.'/core/class/extrafields.class.php'; require_once DOL_DOCUMENT_ROOT.'/core/class/extrafields.class.php';
$extrafields = new ExtraFields($this->db); $extrafields = new ExtraFields($this->db);
$optionsArray = $extrafields->fetch_name_optionals_label($this->elementType); $optionsArray = $extrafields->fetch_name_optionals_label($this->table_element);
foreach($this->array_options as $key => $value) foreach($this->array_options as $key => $value)
{ {

View File

@ -152,11 +152,6 @@ class ExtraFields
{ {
$table=$elementtype.'_extrafields'; $table=$elementtype.'_extrafields';
// Special case for not normalized table names
if ($elementtype == 'member') $table='adherent_extrafields';
elseif ($elementtype == 'company') $table='societe_extrafields';
elseif ($elementtype == 'contact') $table='socpeople_extrafields';
if (isset($attrname) && $attrname != '' && preg_match("/^\w[a-zA-Z0-9-_]*$/",$attrname)) if (isset($attrname) && $attrname != '' && preg_match("/^\w[a-zA-Z0-9-_]*$/",$attrname))
{ {
if ($type=='boolean') { if ($type=='boolean') {
@ -283,11 +278,6 @@ class ExtraFields
{ {
$table=$elementtype.'_extrafields'; $table=$elementtype.'_extrafields';
// Special case for not normalized table names
if ($elementtype == 'member') $table='adherent_extrafields';
elseif ($elementtype == 'company') $table='societe_extrafields';
elseif ($elementtype == 'contact') $table='socpeople_extrafields';
if (! empty($attrname) && preg_match("/^\w[a-zA-Z0-9-_]*$/",$attrname)) if (! empty($attrname) && preg_match("/^\w[a-zA-Z0-9-_]*$/",$attrname))
{ {
$result=$this->db->DDLDropField(MAIN_DB_PREFIX.$table,$attrname); // This also drop the unique key $result=$this->db->DDLDropField(MAIN_DB_PREFIX.$table,$attrname); // This also drop the unique key
@ -362,10 +352,6 @@ class ExtraFields
function update($attrname,$label,$type,$length,$elementtype,$unique=0,$required=0,$pos=0,$param='') function update($attrname,$label,$type,$length,$elementtype,$unique=0,$required=0,$pos=0,$param='')
{ {
$table=$elementtype.'_extrafields'; $table=$elementtype.'_extrafields';
// Special case for not normalized table names
if ($elementtype == 'member') $table='adherent_extrafields';
elseif ($elementtype == 'company') $table='societe_extrafields';
elseif ($elementtype == 'contact') $table='socpeople_extrafields';
if (isset($attrname) && $attrname != '' && preg_match("/^\w[a-zA-Z0-9-_]*$/",$attrname)) if (isset($attrname) && $attrname != '' && preg_match("/^\w[a-zA-Z0-9-_]*$/",$attrname))
{ {
@ -533,7 +519,7 @@ class ExtraFields
* @param boolean $forceload Force load of extra fields whatever is option MAIN_EXTRAFIELDS_DISABLED * @param boolean $forceload Force load of extra fields whatever is option MAIN_EXTRAFIELDS_DISABLED
* @return array Array of attributes for all extra fields * @return array Array of attributes for all extra fields
*/ */
function fetch_name_optionals_label($elementtype='member',$forceload=false) function fetch_name_optionals_label($elementtype='adherent',$forceload=false)
{ {
global $conf; global $conf;

View File

@ -350,3 +350,7 @@ ALTER TABLE llx_opensurvey_user_studs ADD INDEX idx_id_sondage (id_sondage);
ALTER TABLE llx_boxes ADD COLUMN params varchar(255); ALTER TABLE llx_boxes ADD COLUMN params varchar(255);
UPDATE llx_extrafield SET elementtype='socpeople' WHERE elementtype='contact';
UPDATE llx_extrafield SET elementtype='actioncomm' WHERE elementtype='action';
UPDATE llx_extrafield SET elementtype='adherent' WHERE elementtype='member';
UPDATE llx_extrafield SET elementtype='societe' WHERE elementtype='company';

View File

@ -193,7 +193,10 @@ if ($ok)
// Search list of fields declared and list of fields created into databases and create fields missing // Search list of fields declared and list of fields created into databases and create fields missing
$extrafields=new ExtraFields($db); $extrafields=new ExtraFields($db);
$listofmodulesextra=array('societe'=>'company','adherent'=>'member','product'=>'product'); $listofmodulesextra=array('societe'=>'societe','adherent'=>'adherent','product'=>'product',
'socpeople'=>'socpeople', 'commande'=>'commande', 'facture'=>'facture',
'commande_fournisseur'=>'commande_fournisseur', 'actioncomm'=>'actioncomm',
'adherent_type'=>'adherent_type','user'=>'user','projet'=>'projet', 'projet_task'=>'projet_task');
foreach($listofmodulesextra as $tablename => $elementtype) foreach($listofmodulesextra as $tablename => $elementtype)
{ {
// Get list of fields // Get list of fields

View File

@ -43,7 +43,7 @@ foreach ($tmptype2label as $key => $val) $type2label[$key]=$langs->trans($val);
$action=GETPOST('action', 'alpha'); $action=GETPOST('action', 'alpha');
$attrname=GETPOST('attrname', 'alpha'); $attrname=GETPOST('attrname', 'alpha');
$elementtype='product'; $elementtype='product'; //Must be the $element of the class that manage extrafield
if (!$user->admin) accessforbidden(); if (!$user->admin) accessforbidden();

View File

@ -57,7 +57,7 @@ $object = new Product($db);
$extrafields = new ExtraFields($db); $extrafields = new ExtraFields($db);
// fetch optionals attributes and labels // fetch optionals attributes and labels
$extralabels=$extrafields->fetch_name_optionals_label('product'); $extralabels=$extrafields->fetch_name_optionals_label($object->table_element);
if ($id > 0 || ! empty($ref)) if ($id > 0 || ! empty($ref))
{ {

View File

@ -42,7 +42,7 @@ foreach ($tmptype2label as $key => $val) $type2label[$key]=$langs->trans($val);
$action=GETPOST('action', 'alpha'); $action=GETPOST('action', 'alpha');
$attrname=GETPOST('attrname', 'alpha'); $attrname=GETPOST('attrname', 'alpha');
$elementtype='projet'; $elementtype='projet'; //Must be the $table_element of the class that manage extrafield
if (!$user->admin) accessforbidden(); if (!$user->admin) accessforbidden();

View File

@ -62,7 +62,7 @@ if ($object->id > 0)
} }
// fetch optionals attributes and labels // fetch optionals attributes and labels
$extralabels=$extrafields->fetch_name_optionals_label('projet'); $extralabels=$extrafields->fetch_name_optionals_label($object->table_element);
$date_start=dol_mktime(0,0,0,GETPOST('projectmonth','int'),GETPOST('projectday','int'),GETPOST('projectyear','int')); $date_start=dol_mktime(0,0,0,GETPOST('projectmonth','int'),GETPOST('projectday','int'),GETPOST('projectyear','int'));
$date_end=dol_mktime(0,0,0,GETPOST('projectendmonth','int'),GETPOST('projectendday','int'),GETPOST('projectendyear','int'));; $date_end=dol_mktime(0,0,0,GETPOST('projectendmonth','int'),GETPOST('projectendday','int'),GETPOST('projectendyear','int'));;

View File

@ -44,6 +44,7 @@ $mine = ($mode == 'mine' ? 1 : 0);
//if (! $user->rights->projet->all->lire) $mine=1; // Special for projects //if (! $user->rights->projet->all->lire) $mine=1; // Special for projects
$object = new Project($db); $object = new Project($db);
$taskstatic = new Task($db);
$extrafields_project = new ExtraFields($db); $extrafields_project = new ExtraFields($db);
$extrafields_task = new ExtraFields($db); $extrafields_task = new ExtraFields($db);
if ($ref) if ($ref)
@ -54,8 +55,8 @@ if ($ref)
// fetch optionals attributes and labels // fetch optionals attributes and labels
if (!empty($id)) { if (!empty($id)) {
$extralabels_projet=$extrafields_project->fetch_name_optionals_label('projet'); $extralabels_projet=$extrafields_project->fetch_name_optionals_label($object->table_element);
$extralabels_task=$extrafields_task->fetch_name_optionals_label('projet_task'); $extralabels_task=$extrafields_task->fetch_name_optionals_label($taskstatic->table_element);
} }
@ -167,7 +168,6 @@ if ($action == 'createtask' && $user->rights->projet->creer)
$form=new Form($db); $form=new Form($db);
$formother=new FormOther($db); $formother=new FormOther($db);
$taskstatic = new Task($db);
$userstatic=new User($db); $userstatic=new User($db);
$help_url="EN:Module_Projects|FR:Module_Projets|ES:M&oacute;dulo_Proyectos"; $help_url="EN:Module_Projects|FR:Module_Projets|ES:M&oacute;dulo_Proyectos";

View File

@ -50,7 +50,7 @@ $extrafields = new ExtraFields($db);
$projectstatic = new Project($db); $projectstatic = new Project($db);
// fetch optionals attributes and labels // fetch optionals attributes and labels
$extralabels=$extrafields->fetch_name_optionals_label('projet_task'); $extralabels=$extrafields->fetch_name_optionals_label($object->table_element);
/* /*
* Actions * Actions
*/ */

View File

@ -361,7 +361,7 @@ $form = new Form($db);
$formcompany = new FormCompany($db); $formcompany = new FormCompany($db);
$adht = new AdherentType($db); $adht = new AdherentType($db);
$extrafields = new ExtraFields($db); $extrafields = new ExtraFields($db);
$extrafields->fetch_name_optionals_label('member'); // fetch optionals attributes and labels $extrafields->fetch_name_optionals_label('adherent'); // fetch optionals attributes and labels
llxHeaderVierge($langs->trans("NewSubscription")); llxHeaderVierge($langs->trans("NewSubscription"));

View File

@ -69,7 +69,7 @@ $extrafields = new ExtraFields($db);
llxHeaderVierge($langs->trans("MemberCard")); llxHeaderVierge($langs->trans("MemberCard"));
// fetch optionals attributes and labels // fetch optionals attributes and labels
$extralabels=$extrafields->fetch_name_optionals_label('member'); $extralabels=$extrafields->fetch_name_optionals_label('adherent');
if ($id > 0) if ($id > 0)
{ {
$res=$object->fetch($id); $res=$object->fetch($id);

View File

@ -41,7 +41,7 @@ foreach ($tmptype2label as $key => $val) $type2label[$key]=$langs->trans($val);
$action=GETPOST('action', 'alpha'); $action=GETPOST('action', 'alpha');
$attrname=GETPOST('attrname', 'alpha'); $attrname=GETPOST('attrname', 'alpha');
$elementtype='contact'; $elementtype='socpeople'; //Must be the $element of the class that manage extrafield
if (!$user->admin) accessforbidden(); if (!$user->admin) accessforbidden();

View File

@ -42,7 +42,7 @@ foreach ($tmptype2label as $key => $val) $type2label[$key]=$langs->trans($val);
$action=GETPOST('action', 'alpha'); $action=GETPOST('action', 'alpha');
$attrname=GETPOST('attrname', 'alpha'); $attrname=GETPOST('attrname', 'alpha');
$elementtype='company'; $elementtype='societe'; //Must be the $element of the class that manage extrafield
if (!$user->admin) accessforbidden(); if (!$user->admin) accessforbidden();

View File

@ -852,13 +852,9 @@ class Societe extends CommonObject
// fetch optionals attributes and labels // fetch optionals attributes and labels
require_once(DOL_DOCUMENT_ROOT.'/core/class/extrafields.class.php'); require_once(DOL_DOCUMENT_ROOT.'/core/class/extrafields.class.php');
$extrafields=new ExtraFields($this->db); $extrafields=new ExtraFields($this->db);
$extralabels=$extrafields->fetch_name_optionals_label('company',true); $extralabels=$extrafields->fetch_name_optionals_label($this->table_element,true);
if (count($extralabels)>0) { if (count($extralabels)>0) {
$this->array_options = array(); $this->fetch_optionals($this->id,$extralabels);
}
foreach($extrafields->attribute_label as $key=>$label)
{
$this->array_options['options_'.$key]=$label;
} }
} }
else else

View File

@ -56,7 +56,7 @@ $object = new Societe($db);
$extrafields = new ExtraFields($db); $extrafields = new ExtraFields($db);
// fetch optionals attributes and labels // fetch optionals attributes and labels
$extralabels=$extrafields->fetch_name_optionals_label('company'); $extralabels=$extrafields->fetch_name_optionals_label($object->table_element);
// Get object canvas (By default, this is not defined, so standard usage of dolibarr) // Get object canvas (By default, this is not defined, so standard usage of dolibarr)
$object->getCanvas($socid); $object->getCanvas($socid);

View File

@ -41,7 +41,7 @@ foreach ($tmptype2label as $key => $val) $type2label[$key]=$langs->trans($val);
$action=GETPOST('action', 'alpha'); $action=GETPOST('action', 'alpha');
$attrname=GETPOST('attrname', 'alpha'); $attrname=GETPOST('attrname', 'alpha');
$elementtype='user'; $elementtype='user'; //Must be the $table_element of the class that manage extrafield
if (!$user->admin) accessforbidden(); if (!$user->admin) accessforbidden();

View File

@ -561,7 +561,7 @@ if ($action == 'adduserldap')
*/ */
// fetch optionals attributes and labels // fetch optionals attributes and labels
$extralabels=$extrafields->fetch_name_optionals_label('user'); $extralabels=$extrafields->fetch_name_optionals_label($object->table_element);
llxHeader('',$langs->trans("UserCard")); llxHeader('',$langs->trans("UserCard"));

View File

@ -118,7 +118,7 @@ $contact_fields = array(
//Retreive all extrafield for contact //Retreive all extrafield for contact
// fetch optionals attributes and labels // fetch optionals attributes and labels
$extrafields=new ExtraFields($db); $extrafields=new ExtraFields($db);
$extralabels=$extrafields->fetch_name_optionals_label('contact',true); $extralabels=$extrafields->fetch_name_optionals_label('socpeople',true);
if (count($extrafields)>0) { if (count($extrafields)>0) {
$extrafield_array = array(); $extrafield_array = array();
} }
@ -306,7 +306,7 @@ function getContact($authentication,$id,$ref='',$ref_ext='')
//Retreive all extrafield for thirdsparty //Retreive all extrafield for thirdsparty
// fetch optionals attributes and labels // fetch optionals attributes and labels
$extrafields=new ExtraFields($db); $extrafields=new ExtraFields($db);
$extralabels=$extrafields->fetch_name_optionals_label('contact',true); $extralabels=$extrafields->fetch_name_optionals_label('socpeople',true);
//Get extrafield values //Get extrafield values
$contact->fetch_optionals($contact->id,$extralabels); $contact->fetch_optionals($contact->id,$extralabels);
@ -413,7 +413,7 @@ function createContact($authentication,$contact)
//Retreive all extrafield for thirdsparty //Retreive all extrafield for thirdsparty
// fetch optionals attributes and labels // fetch optionals attributes and labels
$extrafields=new ExtraFields($db); $extrafields=new ExtraFields($db);
$extralabels=$extrafields->fetch_name_optionals_label('contact',true); $extralabels=$extrafields->fetch_name_optionals_label('socpeople',true);
foreach($extrafields->attribute_label as $key=>$label) foreach($extrafields->attribute_label as $key=>$label)
{ {
$key='options_'.$key; $key='options_'.$key;
@ -657,7 +657,7 @@ function updateContact($authentication,$contact)
//Retreive all extrafield for contact //Retreive all extrafield for contact
// fetch optionals attributes and labels // fetch optionals attributes and labels
$extrafields=new ExtraFields($db); $extrafields=new ExtraFields($db);
$extralabels=$extrafields->fetch_name_optionals_label('contact',true); $extralabels=$extrafields->fetch_name_optionals_label('socpeople',true);
foreach($extrafields->attribute_label as $key=>$label) foreach($extrafields->attribute_label as $key=>$label)
{ {
$key='options_'.$key; $key='options_'.$key;

View File

@ -124,7 +124,7 @@ $thirdparty_fields= array(
//Retreive all extrafield for thirdsparty //Retreive all extrafield for thirdsparty
// fetch optionals attributes and labels // fetch optionals attributes and labels
$extrafields=new ExtraFields($db); $extrafields=new ExtraFields($db);
$extralabels=$extrafields->fetch_name_optionals_label('company',true); $extralabels=$extrafields->fetch_name_optionals_label('societe',true);
if (count($extrafields)>0) { if (count($extrafields)>0) {
$extrafield_array = array(); $extrafield_array = array();
} }
@ -331,7 +331,7 @@ function getThirdParty($authentication,$id='',$ref='',$ref_ext='')
//Retreive all extrafield for thirdsparty //Retreive all extrafield for thirdsparty
// fetch optionals attributes and labels // fetch optionals attributes and labels
$extrafields=new ExtraFields($db); $extrafields=new ExtraFields($db);
$extralabels=$extrafields->fetch_name_optionals_label('company',true); $extralabels=$extrafields->fetch_name_optionals_label('societe',true);
//Get extrafield values //Get extrafield values
$thirdparty->fetch_optionals($thirdparty->id,$extralabels); $thirdparty->fetch_optionals($thirdparty->id,$extralabels);
@ -446,7 +446,7 @@ function createThirdParty($authentication,$thirdparty)
//Retreive all extrafield for thirdsparty //Retreive all extrafield for thirdsparty
// fetch optionals attributes and labels // fetch optionals attributes and labels
$extrafields=new ExtraFields($db); $extrafields=new ExtraFields($db);
$extralabels=$extrafields->fetch_name_optionals_label('company',true); $extralabels=$extrafields->fetch_name_optionals_label('societe',true);
foreach($extrafields->attribute_label as $key=>$label) foreach($extrafields->attribute_label as $key=>$label)
{ {
$key='options_'.$key; $key='options_'.$key;
@ -567,7 +567,7 @@ function updateThirdParty($authentication,$thirdparty)
//Retreive all extrafield for thirdsparty //Retreive all extrafield for thirdsparty
// fetch optionals attributes and labels // fetch optionals attributes and labels
$extrafields=new ExtraFields($db); $extrafields=new ExtraFields($db);
$extralabels=$extrafields->fetch_name_optionals_label('company',true); $extralabels=$extrafields->fetch_name_optionals_label('societe',true);
foreach($extrafields->attribute_label as $key=>$label) foreach($extrafields->attribute_label as $key=>$label)
{ {
$key='options_'.$key; $key='options_'.$key;

View File

@ -187,7 +187,7 @@ $thirdpartywithuser_fields = array(
//Retreive all extrafield for contact //Retreive all extrafield for contact
// fetch optionals attributes and labels // fetch optionals attributes and labels
$extrafields=new ExtraFields($db); $extrafields=new ExtraFields($db);
$extralabels=$extrafields->fetch_name_optionals_label('contact',true); $extralabels=$extrafields->fetch_name_optionals_label('socpeople',true);
if (count($extrafields)>0) { if (count($extrafields)>0) {
$extrafield_array = array(); $extrafield_array = array();
} }
@ -574,7 +574,7 @@ function createUserFromThirdparty($authentication,$thirdpartywithuser)
//Retreive all extrafield for thirdsparty //Retreive all extrafield for thirdsparty
// fetch optionals attributes and labels // fetch optionals attributes and labels
$extrafields=new ExtraFields($db); $extrafields=new ExtraFields($db);
$extralabels=$extrafields->fetch_name_optionals_label('contact',true); $extralabels=$extrafields->fetch_name_optionals_label('socpeople',true);
foreach($extrafields->attribute_label as $key=>$label) foreach($extrafields->attribute_label as $key=>$label)
{ {
$key='contact_options_'.$key; $key='contact_options_'.$key;