Merge pull request #885 from FHenry/develop
Review extrafield for compliance with wiki
This commit is contained in:
commit
50dd0ef7ee
@ -41,7 +41,7 @@ foreach ($tmptype2label as $key => $val) $type2label[$key]=$langs->trans($val);
|
||||
|
||||
$action=GETPOST('action', 'alpha');
|
||||
$attrname=GETPOST('attrname', 'alpha');
|
||||
$elementtype='member';
|
||||
$elementtype='adherent'; //Must be the $table_element of the class that manage extrafield
|
||||
|
||||
if (!$user->admin) accessforbidden();
|
||||
|
||||
|
||||
@ -42,7 +42,7 @@ foreach ($tmptype2label as $key => $val) $type2label[$key]=$langs->trans($val);
|
||||
|
||||
$action=GETPOST('action', '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();
|
||||
|
||||
|
||||
@ -479,8 +479,6 @@ if ($rowid)
|
||||
{
|
||||
$res=$object->fetch($rowid);
|
||||
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);
|
||||
|
||||
|
||||
@ -1095,6 +1095,15 @@ class Adherent extends CommonObject
|
||||
$this->user_id = $obj->user_id;
|
||||
$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);
|
||||
}
|
||||
|
||||
// Load other properties
|
||||
$result=$this->fetch_subscriptions();
|
||||
|
||||
|
||||
@ -33,6 +33,7 @@ require_once DOL_DOCUMENT_ROOT.'/core/class/commonobject.class.php';
|
||||
class AdherentType extends CommonObject
|
||||
{
|
||||
public $table_element = 'adherent_type';
|
||||
public $element = 'adherent_type';
|
||||
|
||||
var $id;
|
||||
var $libelle;
|
||||
|
||||
@ -65,7 +65,7 @@ $object = new Adherent($db);
|
||||
$extrafields = new ExtraFields($db);
|
||||
|
||||
// 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)
|
||||
$object->getCanvas($rowid);
|
||||
|
||||
@ -47,7 +47,7 @@ foreach ($tmptype2label as $key => $val) $type2label[$key]=$langs->trans($val);
|
||||
|
||||
$action=GETPOST('action', 'alpha');
|
||||
$attrname=GETPOST('attrname', 'alpha');
|
||||
$elementtype='actioncomm';
|
||||
$elementtype='actioncomm'; //Must be the $table_element of the class that manage extrafield
|
||||
|
||||
if (!$user->admin) accessforbidden();
|
||||
|
||||
|
||||
@ -48,7 +48,7 @@ foreach ($tmptype2label as $key => $val) $type2label[$key]=$langs->trans($val);
|
||||
|
||||
$action=GETPOST('action', 'alpha');
|
||||
$attrname=GETPOST('attrname', 'alpha');
|
||||
$elementtype='commande';
|
||||
$elementtype='commande'; //Must be the $table_element of the class that manage extrafield
|
||||
|
||||
if (!$user->admin) accessforbidden();
|
||||
|
||||
|
||||
@ -51,18 +51,17 @@ if ($action == 'update')
|
||||
{
|
||||
dolibarr_set_const($db, "MAIN_PDF_FORMAT", $_POST["MAIN_PDF_FORMAT"],'chaine',0,'',$conf->entity);
|
||||
|
||||
dolibarr_set_const($db, "MAIN_PROFID1_IN_ADDRESS", $_POST["MAIN_PROFID1_IN_ADDRESS"],'chaine',0,'',$conf->entity);
|
||||
|
||||
dolibarr_set_const($db, "MAIN_PROFID2_IN_ADDRESS", $_POST["MAIN_PROFID2_IN_ADDRESS"],'chaine',0,'',$conf->entity);
|
||||
dolibarr_set_const($db, "MAIN_PROFID3_IN_ADDRESS", $_POST["MAIN_PROFID3_IN_ADDRESS"],'chaine',0,'',$conf->entity);
|
||||
dolibarr_set_const($db, "MAIN_PROFID4_IN_ADDRESS", $_POST["MAIN_PROFID4_IN_ADDRESS"],'chaine',0,'',$conf->entity);
|
||||
dolibarr_set_const($db, "MAIN_PROFID4_IN_ADDRESS", $_POST["MAIN_PROFID4_IN_ADDRESS"],'chaine',0,'',$conf->entity);
|
||||
dolibarr_set_const($db, "MAIN_GENERATE_DOCUMENTS_WITHOUT_VAT", $_POST["MAIN_GENERATE_DOCUMENTS_WITHOUT_VAT"],'chaine',0,'',$conf->entity);
|
||||
|
||||
// if ($conf->global->MAIN_FEATURES_LEVEL > 1)
|
||||
// {
|
||||
dolibarr_set_const($db, "MAIN_GENERATE_DOCUMENTS_HIDE_DETAILS", $_POST["MAIN_GENERATE_DOCUMENTS_HIDE_DETAILS"],'chaine',0,'',$conf->entity);
|
||||
dolibarr_set_const($db, "MAIN_GENERATE_DOCUMENTS_HIDE_DESC", $_POST["MAIN_GENERATE_DOCUMENTS_HIDE_DESC"],'chaine',0,'',$conf->entity);
|
||||
dolibarr_set_const($db, "MAIN_GENERATE_DOCUMENTS_HIDE_REF", $_POST["MAIN_GENERATE_DOCUMENTS_HIDE_REF"],'chaine',0,'',$conf->entity);
|
||||
// }
|
||||
dolibarr_set_const($db, "MAIN_TVAINTRA_NOT_IN_ADDRESS", $_POST["MAIN_TVAINTRA_NOT_IN_ADDRESS"],'chaine',0,'',$conf->entity);
|
||||
dolibarr_set_const($db, "MAIN_GENERATE_DOCUMENTS_HIDE_DETAILS", $_POST["MAIN_GENERATE_DOCUMENTS_HIDE_DETAILS"],'chaine',0,'',$conf->entity);
|
||||
dolibarr_set_const($db, "MAIN_GENERATE_DOCUMENTS_HIDE_DESC", $_POST["MAIN_GENERATE_DOCUMENTS_HIDE_DESC"],'chaine',0,'',$conf->entity);
|
||||
dolibarr_set_const($db, "MAIN_GENERATE_DOCUMENTS_HIDE_REF", $_POST["MAIN_GENERATE_DOCUMENTS_HIDE_REF"],'chaine',0,'',$conf->entity);
|
||||
|
||||
header("Location: ".$_SERVER["PHP_SELF"]."?mainmenu=home&leftmenu=setup");
|
||||
exit;
|
||||
@ -223,27 +222,31 @@ if ($action == 'edit') // Edit
|
||||
print '<tr '.$bc[$var].'><td>'.$langs->trans("HideAnyVATInformationOnPDF").'</td><td>';
|
||||
print $form->selectyesno('MAIN_GENERATE_DOCUMENTS_WITHOUT_VAT',(! empty($conf->global->MAIN_GENERATE_DOCUMENTS_WITHOUT_VAT))?$conf->global->MAIN_GENERATE_DOCUMENTS_WITHOUT_VAT:0,1);
|
||||
print '</td></tr>';
|
||||
|
||||
// Hide Tva Intra on adress
|
||||
$var=!$var;
|
||||
print '<tr '.$bc[$var].'><td>'.$langs->trans("ShowVATIntaInAddress").'</td><td>';
|
||||
print $form->selectyesno('MAIN_TVAINTRA_NOT_IN_ADDRESS',(! empty($conf->global->MAIN_TVAINTRA_NOT_IN_ADDRESS))?$conf->global->MAIN_TVAINTRA_NOT_IN_ADDRESS:0,1);
|
||||
print '</td></tr>';
|
||||
|
||||
// if ($conf->global->MAIN_FEATURES_LEVEL > 1)
|
||||
// {
|
||||
//Desc
|
||||
$var=!$var;
|
||||
print '<tr '.$bc[$var].'><td>'.$langs->trans("HideDescOnPDF").'</td><td>';
|
||||
print $form->selectyesno('MAIN_GENERATE_DOCUMENTS_HIDE_DESC',(! empty($conf->global->MAIN_GENERATE_DOCUMENTS_HIDE_DESC))?$conf->global->MAIN_GENERATE_DOCUMENTS_HIDE_DESC:0,1);
|
||||
print '</td></tr>';
|
||||
//Desc
|
||||
$var=!$var;
|
||||
print '<tr '.$bc[$var].'><td>'.$langs->trans("HideDescOnPDF").'</td><td>';
|
||||
print $form->selectyesno('MAIN_GENERATE_DOCUMENTS_HIDE_DESC',(! empty($conf->global->MAIN_GENERATE_DOCUMENTS_HIDE_DESC))?$conf->global->MAIN_GENERATE_DOCUMENTS_HIDE_DESC:0,1);
|
||||
print '</td></tr>';
|
||||
|
||||
//Ref
|
||||
$var=!$var;
|
||||
print '<tr '.$bc[$var].'><td>'.$langs->trans("HideRefOnPDF").'</td><td>';
|
||||
print $form->selectyesno('MAIN_GENERATE_DOCUMENTS_HIDE_REF',(! empty($conf->global->MAIN_GENERATE_DOCUMENTS_HIDE_REF))?$conf->global->MAIN_GENERATE_DOCUMENTS_HIDE_REF:0,1);
|
||||
print '</td></tr>';
|
||||
//Ref
|
||||
$var=!$var;
|
||||
print '<tr '.$bc[$var].'><td>'.$langs->trans("HideRefOnPDF").'</td><td>';
|
||||
print $form->selectyesno('MAIN_GENERATE_DOCUMENTS_HIDE_REF',(! empty($conf->global->MAIN_GENERATE_DOCUMENTS_HIDE_REF))?$conf->global->MAIN_GENERATE_DOCUMENTS_HIDE_REF:0,1);
|
||||
print '</td></tr>';
|
||||
|
||||
//Details
|
||||
$var=!$var;
|
||||
print '<tr '.$bc[$var].'><td>'.$langs->trans("HideDetailsOnPDF").'</td><td>';
|
||||
print $form->selectyesno('MAIN_GENERATE_DOCUMENTS_HIDE_DETAILS',(! empty($conf->global->MAIN_GENERATE_DOCUMENTS_HIDE_DETAILS))?$conf->global->MAIN_GENERATE_DOCUMENTS_HIDE_DETAILS:0,1);
|
||||
print '</td></tr>';
|
||||
|
||||
//Details
|
||||
$var=!$var;
|
||||
print '<tr '.$bc[$var].'><td>'.$langs->trans("HideDetailsOnPDF").'</td><td>';
|
||||
print $form->selectyesno('MAIN_GENERATE_DOCUMENTS_HIDE_DETAILS',(! empty($conf->global->MAIN_GENERATE_DOCUMENTS_HIDE_DETAILS))?$conf->global->MAIN_GENERATE_DOCUMENTS_HIDE_DETAILS:0,1);
|
||||
print '</td></tr>';
|
||||
// }
|
||||
|
||||
print '</table>';
|
||||
|
||||
@ -418,26 +421,30 @@ else // Show
|
||||
print "</td>";
|
||||
print '</tr>';
|
||||
|
||||
// if ($conf->global->MAIN_FEATURES_LEVEL > 1)
|
||||
// {
|
||||
//Desc
|
||||
$var=!$var;
|
||||
print '<tr '.$bc[$var].'><td>'.$langs->trans("HideDescOnPDF").'</td><td colspan="2">';
|
||||
print yn($conf->global->MAIN_GENERATE_DOCUMENTS_HIDE_DESC,1);
|
||||
print '</td></tr>';
|
||||
// Hide Tva Intra on adress
|
||||
$var=!$var;
|
||||
print '<tr '.$bc[$var].'><td>'.$langs->trans("ShowVATIntaInAddress").'</td><td colspan="2">';
|
||||
print yn($conf->global->MAIN_TVAINTRA_NOT_IN_ADDRESS,1);
|
||||
print '</td></tr>';
|
||||
|
||||
//Desc
|
||||
$var=!$var;
|
||||
print '<tr '.$bc[$var].'><td>'.$langs->trans("HideDescOnPDF").'</td><td colspan="2">';
|
||||
print yn($conf->global->MAIN_GENERATE_DOCUMENTS_HIDE_DESC,1);
|
||||
print '</td></tr>';
|
||||
|
||||
//Ref
|
||||
$var=!$var;
|
||||
print '<tr '.$bc[$var].'><td>'.$langs->trans("HideRefOnPDF").'</td><td colspan="2">';
|
||||
print yn($conf->global->MAIN_GENERATE_DOCUMENTS_HIDE_REF,1);
|
||||
print '</td></tr>';
|
||||
//Ref
|
||||
$var=!$var;
|
||||
print '<tr '.$bc[$var].'><td>'.$langs->trans("HideRefOnPDF").'</td><td colspan="2">';
|
||||
print yn($conf->global->MAIN_GENERATE_DOCUMENTS_HIDE_REF,1);
|
||||
print '</td></tr>';
|
||||
|
||||
//Details
|
||||
$var=!$var;
|
||||
print '<tr '.$bc[$var].'><td>'.$langs->trans("HideDetailsOnPDF").'</td><td colspan="2">';
|
||||
print yn($conf->global->MAIN_GENERATE_DOCUMENTS_HIDE_DETAILS,1);
|
||||
print '</td></tr>';
|
||||
|
||||
//Details
|
||||
$var=!$var;
|
||||
print '<tr '.$bc[$var].'><td>'.$langs->trans("HideDetailsOnPDF").'</td><td colspan="2">';
|
||||
print yn($conf->global->MAIN_GENERATE_DOCUMENTS_HIDE_DETAILS,1);
|
||||
print '</td></tr>';
|
||||
// }
|
||||
|
||||
print '</table>';
|
||||
|
||||
|
||||
@ -49,7 +49,7 @@ foreach ($tmptype2label as $key => $val) $type2label[$key]=$langs->trans($val);
|
||||
|
||||
$action=GETPOST('action', '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();
|
||||
|
||||
|
||||
@ -48,7 +48,7 @@ foreach ($tmptype2label as $key => $val) $type2label[$key]=$langs->trans($val);
|
||||
|
||||
$action=GETPOST('action', '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();
|
||||
|
||||
|
||||
@ -64,7 +64,7 @@ $contact = new Contact($db);
|
||||
$extrafields = new ExtraFields($db);
|
||||
|
||||
// fetch optionals attributes and labels
|
||||
$extralabels=$extrafields->fetch_name_optionals_label('actioncomm');
|
||||
$extralabels=$extrafields->fetch_name_optionals_label($actioncomm->table_element);
|
||||
|
||||
//var_dump($_POST);
|
||||
|
||||
|
||||
@ -42,7 +42,7 @@ foreach ($tmptype2label as $key => $val) $type2label[$key]=$langs->trans($val);
|
||||
|
||||
$action=GETPOST('action', 'alpha');
|
||||
$attrname=GETPOST('attrname', 'alpha');
|
||||
$elementtype='propal';
|
||||
$elementtype='propal'; //Must be the $table_element of the class that manage extrafield
|
||||
|
||||
if (!$user->admin) accessforbidden();
|
||||
|
||||
|
||||
@ -49,7 +49,7 @@ $result=$object->fetch($id);
|
||||
$extrafields = new ExtraFields($db);
|
||||
|
||||
// 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
|
||||
$hookmanager->initHooks(array('mailingcard'));
|
||||
|
||||
@ -83,7 +83,7 @@ $object = new Propal($db);
|
||||
$extrafields = new ExtraFields($db);
|
||||
|
||||
// fetch optionals attributes and labels
|
||||
$extralabels=$extrafields->fetch_name_optionals_label('propal');
|
||||
$extralabels=$extrafields->fetch_name_optionals_label($object->table_element);
|
||||
|
||||
// Load object
|
||||
if ($id > 0 || ! empty($ref))
|
||||
@ -1116,7 +1116,7 @@ else if ($action == 'down' && $user->rights->propal->creer)
|
||||
else if ($action == 'update_extras')
|
||||
{
|
||||
// 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);
|
||||
|
||||
// Actions on extra fields (by external module or standard code)
|
||||
|
||||
@ -1098,6 +1098,16 @@ class Propal extends CommonObject
|
||||
{
|
||||
$this->brouillon = 1;
|
||||
}
|
||||
|
||||
// Retreive all extrafield for invoice
|
||||
// fetch optionals attributes and labels
|
||||
if(!class_exists('Extrafields'))
|
||||
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);
|
||||
}
|
||||
|
||||
$this->db->free($resql);
|
||||
|
||||
@ -1187,15 +1197,10 @@ class Propal extends CommonObject
|
||||
if(!class_exists('Extrafields'))
|
||||
require_once(DOL_DOCUMENT_ROOT.'/core/class/extrafields.class.php');
|
||||
$extrafields=new ExtraFields($this->db);
|
||||
$extralabels=$extrafields->fetch_name_optionals_label('propal',true);
|
||||
//$this->fetch_optionals($this->id,$extralabels);
|
||||
$extralabels=$extrafields->fetch_name_optionals_label($this->table_element,true);
|
||||
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;
|
||||
}
|
||||
|
||||
@ -2000,6 +2005,21 @@ class Propal extends CommonObject
|
||||
}
|
||||
}
|
||||
|
||||
// Removed extrafields
|
||||
if (! $error)
|
||||
{
|
||||
if (empty($conf->global->MAIN_EXTRAFIELDS_DISABLED)) // For avoid conflicts if trigger used
|
||||
{
|
||||
$result=$this->deleteExtraFields();
|
||||
if ($result < 0)
|
||||
{
|
||||
$error++;
|
||||
$errorflag=-4;
|
||||
dol_syslog(get_class($this)."::delete erreur ".$errorflag." ".$this->error, LOG_ERR);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
if (! $error)
|
||||
{
|
||||
dol_syslog(get_class($this)."::delete $this->id by $user->id", LOG_DEBUG);
|
||||
|
||||
@ -1339,6 +1339,16 @@ class Commande extends CommonOrder
|
||||
$this->lines = array();
|
||||
|
||||
if ($this->statut == 0) $this->brouillon = 1;
|
||||
|
||||
// Retreive all extrafield for invoice
|
||||
// fetch optionals attributes and labels
|
||||
if(!class_exists('Extrafields'))
|
||||
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);
|
||||
}
|
||||
|
||||
$this->db->free();
|
||||
|
||||
@ -2382,6 +2392,17 @@ class Commande extends CommonOrder
|
||||
// Delete linked contacts
|
||||
$res = $this->delete_linked_contact();
|
||||
if ($res < 0) $error++;
|
||||
|
||||
// Remove extrafields
|
||||
if ((! $error) && (empty($conf->global->MAIN_EXTRAFIELDS_DISABLED))) // For avoid conflicts if trigger used
|
||||
{
|
||||
$result=$this->deleteExtraFields();
|
||||
if ($result < 0)
|
||||
{
|
||||
$error++;
|
||||
dol_syslog(get_class($this)."::delete error -4 ".$this->error, LOG_ERR);
|
||||
}
|
||||
}
|
||||
|
||||
// On efface le repertoire de pdf provisoire
|
||||
$comref = dol_sanitizeFileName($this->ref);
|
||||
@ -2409,6 +2430,8 @@ class Commande extends CommonOrder
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
|
||||
if (! $error)
|
||||
|
||||
@ -82,7 +82,7 @@ $extrafields = new ExtraFields($db);
|
||||
|
||||
|
||||
// fetch optionals attributes and labels
|
||||
$extralabels=$extrafields->fetch_name_optionals_label('commande');
|
||||
$extralabels=$extrafields->fetch_name_optionals_label($object->table_element);
|
||||
|
||||
// Load object
|
||||
if ($id > 0 || ! empty($ref))
|
||||
@ -1127,7 +1127,7 @@ else if ($action == 'print_file' AND $user->rights->printipp->use)
|
||||
else if ($action == 'update_extras')
|
||||
{
|
||||
// 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);
|
||||
|
||||
// Actions on extra fields (by external module or standard code)
|
||||
|
||||
@ -655,15 +655,11 @@ else if ($action == 'add' && $user->rights->facture->creer)
|
||||
$db->begin();
|
||||
|
||||
$error=0;
|
||||
|
||||
// Get extra fields
|
||||
foreach($_POST as $key => $value)
|
||||
{
|
||||
if (preg_match("/^options_/",$key))
|
||||
{
|
||||
$object->array_options[$key]=GETPOST($key);
|
||||
}
|
||||
}
|
||||
|
||||
// Fill array 'array_options' with data from add form
|
||||
$extralabels=$extrafields->fetch_name_optionals_label($object->table_element);
|
||||
$ret = $extrafields->setOptionalsFromPost($extralabels,$object);
|
||||
|
||||
|
||||
// Replacement invoice
|
||||
if ($_POST['type'] == 1)
|
||||
@ -1860,7 +1856,7 @@ if (! empty($conf->global->MAIN_DISABLE_CONTACTS_TAB) && $user->rights->facture-
|
||||
if ($action == 'update_extras')
|
||||
{
|
||||
// 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);
|
||||
|
||||
// Actions on extra fields (by external module or standard code)
|
||||
@ -1905,7 +1901,7 @@ llxHeader('',$langs->trans('Bill'),'EN:Customers_Invoices|FR:Factures_Clients|ES
|
||||
if ($action == 'create')
|
||||
{
|
||||
$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'));
|
||||
|
||||
@ -2399,7 +2395,7 @@ else if ($id > 0 || ! empty($ref))
|
||||
$result=$object->fetch($id,$ref);
|
||||
|
||||
// fetch optionals attributes and labels
|
||||
$extralabels=$extrafields->fetch_name_optionals_label('facture');
|
||||
$extralabels=$extrafields->fetch_name_optionals_label($object->table_element);
|
||||
|
||||
if ($result > 0)
|
||||
{
|
||||
|
||||
@ -43,7 +43,7 @@ foreach ($tmptype2label as $key => $val) $type2label[$key]=$langs->trans($val);
|
||||
|
||||
$action=GETPOST('action', 'alpha');
|
||||
$attrname=GETPOST('attrname', 'alpha');
|
||||
$elementtype='facture';
|
||||
$elementtype='facture'; //Must be the $table_element of the class that manage extrafield
|
||||
|
||||
if (!$user->admin) accessforbidden();
|
||||
|
||||
|
||||
@ -879,13 +879,9 @@ class Facture extends CommonInvoice
|
||||
if(!class_exists('Extrafields'))
|
||||
require_once(DOL_DOCUMENT_ROOT.'/core/class/extrafields.class.php');
|
||||
$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) {
|
||||
$this->array_options = array();
|
||||
}
|
||||
foreach($extrafields->attribute_label as $key=>$label)
|
||||
{
|
||||
$this->array_options['options_'.$key]=$label;
|
||||
$this->fetch_optionals($this->id,$extralabels);
|
||||
}
|
||||
|
||||
/*
|
||||
|
||||
@ -53,7 +53,7 @@ $object = new Contact($db);
|
||||
$extrafields = new ExtraFields($db);
|
||||
|
||||
// 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)
|
||||
$object->getCanvas($id);
|
||||
|
||||
@ -177,7 +177,7 @@ abstract class CommonDocGenerator
|
||||
if(!class_exists('Extrafields'))
|
||||
require_once DOL_DOCUMENT_ROOT.'/core/class/extrafields.class.php';
|
||||
$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);
|
||||
|
||||
foreach($extrafields->attribute_label as $key=>$label)
|
||||
|
||||
@ -2020,9 +2020,10 @@ abstract class CommonObject
|
||||
// optionsArray not already loaded, so we load it
|
||||
require_once DOL_DOCUMENT_ROOT.'/core/class/extrafields.class.php';
|
||||
$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
|
||||
if (count($optionsArray) > 0)
|
||||
{
|
||||
@ -2044,13 +2045,15 @@ abstract class CommonObject
|
||||
|
||||
foreach ($tab as $key => $value)
|
||||
{
|
||||
if ($key != 'rowid' && $key != 'tms' && $key != 'fk_member')
|
||||
//Test fetch_array ! is_int($key) because fetch_array seult is a mix table with Key as alpha and Key as int (depend db engine)
|
||||
if ($key != 'rowid' && $key != 'tms' && $key != 'fk_member' && ! is_int($key))
|
||||
{
|
||||
// we can add this attribute to adherent object
|
||||
$this->array_options["options_$key"]=$value;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
$this->db->free($resql);
|
||||
}
|
||||
else
|
||||
@ -2108,7 +2111,7 @@ abstract class CommonObject
|
||||
$langs->load('admin');
|
||||
require_once DOL_DOCUMENT_ROOT.'/core/class/extrafields.class.php';
|
||||
$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)
|
||||
{
|
||||
|
||||
@ -152,11 +152,6 @@ class 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 ($type=='boolean') {
|
||||
@ -283,11 +278,6 @@ class 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))
|
||||
{
|
||||
$result=$this->db->DDLDropField(MAIN_DB_PREFIX.$table,$attrname); // This also drop the unique key
|
||||
@ -323,7 +313,7 @@ class ExtraFields
|
||||
{
|
||||
$sql = "DELETE FROM ".MAIN_DB_PREFIX."extrafields";
|
||||
$sql.= " WHERE name = '".$attrname."'";
|
||||
$sql.= " AND entity = ".$conf->entity;
|
||||
$sql.= " AND entity IN (0,".$conf->entity.')';
|
||||
$sql.= " AND elementtype = '".$elementtype."'";
|
||||
|
||||
dol_syslog(get_class($this)."::delete_label sql=".$sql);
|
||||
@ -362,10 +352,6 @@ class ExtraFields
|
||||
function update($attrname,$label,$type,$length,$elementtype,$unique=0,$required=0,$pos=0,$param='')
|
||||
{
|
||||
$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))
|
||||
{
|
||||
@ -533,7 +519,7 @@ class ExtraFields
|
||||
* @param boolean $forceload Force load of extra fields whatever is option MAIN_EXTRAFIELDS_DISABLED
|
||||
* @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;
|
||||
|
||||
@ -557,7 +543,6 @@ class ExtraFields
|
||||
{
|
||||
while ($tab = $this->db->fetch_object($resql))
|
||||
{
|
||||
|
||||
// we can add this attribute to adherent object
|
||||
if ($tab->type != 'separate')
|
||||
{
|
||||
@ -574,6 +559,7 @@ class ExtraFields
|
||||
$this->attribute_pos[$tab->name]=$tab->pos;
|
||||
}
|
||||
}
|
||||
|
||||
return $array_name_label;
|
||||
}
|
||||
else
|
||||
@ -896,7 +882,7 @@ class ExtraFields
|
||||
function setOptionalsFromPost($extralabels,&$object)
|
||||
{
|
||||
global $_POST;
|
||||
|
||||
|
||||
if (is_array($extralabels))
|
||||
{
|
||||
// Get extra fields
|
||||
|
||||
@ -338,7 +338,10 @@ function pdf_build_address($outputlangs,$sourcecompany,$targetcompany='',$target
|
||||
}
|
||||
|
||||
// Intra VAT
|
||||
if ($targetcompany->tva_intra) $stringaddress.="\n".$outputlangs->transnoentities("VATIntraShort").': '.$outputlangs->convToOutputCharset($targetcompany->tva_intra);
|
||||
if (empty($conf->global->MAIN_TVAINTRA_NOT_IN_ADDRESS))
|
||||
{
|
||||
if ($targetcompany->tva_intra) $stringaddress.="\n".$outputlangs->transnoentities("VATIntraShort").': '.$outputlangs->convToOutputCharset($targetcompany->tva_intra);
|
||||
}
|
||||
|
||||
// Professionnal Ids
|
||||
if (! empty($conf->global->MAIN_PROFID1_IN_ADDRESS) && ! empty($targetcompany->idprof1))
|
||||
|
||||
@ -1441,6 +1441,17 @@ class CommandeFournisseur extends CommonOrder
|
||||
{
|
||||
$error++;
|
||||
}
|
||||
|
||||
// Remove extrafields
|
||||
if ((! $error) && (empty($conf->global->MAIN_EXTRAFIELDS_DISABLED))) // For avoid conflicts if trigger used
|
||||
{
|
||||
$result=$this->deleteExtraFields();
|
||||
if ($result < 0)
|
||||
{
|
||||
$error++;
|
||||
dol_syslog(get_class($this)."::delete error -4 ".$this->error, LOG_ERR);
|
||||
}
|
||||
}
|
||||
|
||||
if (! $error)
|
||||
{
|
||||
|
||||
@ -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);
|
||||
|
||||
UPDATE llx_extrafields SET elementtype='socpeople' WHERE elementtype='contact';
|
||||
UPDATE llx_extrafields SET elementtype='actioncomm' WHERE elementtype='action';
|
||||
UPDATE llx_extrafields SET elementtype='adherent' WHERE elementtype='member';
|
||||
UPDATE llx_extrafields SET elementtype='societe' WHERE elementtype='company';
|
||||
|
||||
@ -193,7 +193,10 @@ if ($ok)
|
||||
|
||||
// Search list of fields declared and list of fields created into databases and create fields missing
|
||||
$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)
|
||||
{
|
||||
// Get list of fields
|
||||
|
||||
@ -939,6 +939,7 @@ YourPHPDoesNotHaveSSLSupport=SSL functions not available in your PHP
|
||||
DownloadMoreSkins=More skins to download
|
||||
SimpleNumRefModelDesc=Returns the reference number with format %syymm-nnnn where yy is year, mm is month and nnnn is a sequence without hole and with no reset
|
||||
ShowProfIdInAddress=Show professionnal id with addresses on documents
|
||||
ShowVATIntaInAddress=Hide VAT Intra num with addresses on documents
|
||||
TranslationUncomplete=Partial translation
|
||||
SomeTranslationAreUncomplete=Some languages may be partially translated or may contains errors. If you detect some, you can fix <b>.lang</b> text files into directory <b>htdocs/langs</b> and submit them on the forum at <a href="http://www.dolibarr.org/forum" target="_blank">http://www.dolibarr.org</a>.
|
||||
MenuUseLayout=Make vertical menu hidable (option javascript must not be disabled)
|
||||
|
||||
@ -942,6 +942,7 @@ YourPHPDoesNotHaveSSLSupport=Funciones SSL no disponibles en su PHP
|
||||
DownloadMoreSkins=Más temas para descargar
|
||||
SimpleNumRefModelDesc=Devuelve el número bajo el formato %syymm-nnnn donde yy es el año, mm el mes y nnnn un contador secuencial sin ruptura y sin volver a 0
|
||||
ShowProfIdInAddress=Mostrar el identificador profesional en las direcciones de los documentos
|
||||
ShowVATIntaInAddress=Ocultar el IVA identificador en las direcciones de los documentos
|
||||
TranslationUncomplete=Traducción parcial
|
||||
SomeTranslationAreUncomplete=Algunos idiomas están traducidos en parte o pueden contener errores. Si lo encuentra, puede corregir los archivos de texto <b>.lang</b> del directorio <b>htdocs/langs</b> y enviarlos al foro <a href="http://www.dolibarr.fr/forum" target="_blank">http://www.dolibarr.fr</a>.
|
||||
MenuUseLayout=Hacer el menú izquierdo ocultable (la opción javascript no debería deshabilitarse)
|
||||
|
||||
@ -941,6 +941,7 @@ YourPHPDoesNotHaveSSLSupport=Fonctions SSL non présentes dans votre PHP
|
||||
DownloadMoreSkins=+ de thèmes à télécharger
|
||||
SimpleNumRefModelDesc=Renvoie le numéro sous la forme %syymm-nnnn où yy est l'année, mm le mois et nnnn un compteur séquentiel sans rupture et sans remise à 0.
|
||||
ShowProfIdInAddress=Afficher l'identifiant professionnel dans les adresses sur les documents
|
||||
ShowVATIntaInAddress=Cacher l'identifiant TVA Intra dans les adresses sur les documents
|
||||
TranslationUncomplete=Traduction partielle
|
||||
SomeTranslationAreUncomplete=Certaines langues sont traduites partiellement ou peuvent contenir des erreurs. Si vous en détectez, vous pouvez corriger les fichiers textes <b>.lang</b> du répertoire <b>htdocs/langs</b> et les soumettre sur le forum à <a href="http://www.dolibarr.fr/forum" target="_blank">http://www.dolibarr.fr</a>.
|
||||
MenuUseLayout=Rendre le menu gauche cachable (L'option javascript ne doit pas avoir été désactivée)
|
||||
|
||||
@ -43,7 +43,7 @@ foreach ($tmptype2label as $key => $val) $type2label[$key]=$langs->trans($val);
|
||||
|
||||
$action=GETPOST('action', 'alpha');
|
||||
$attrname=GETPOST('attrname', 'alpha');
|
||||
$elementtype='product';
|
||||
$elementtype='product'; //Must be the $element of the class that manage extrafield
|
||||
|
||||
if (!$user->admin) accessforbidden();
|
||||
|
||||
|
||||
@ -668,6 +668,17 @@ class Product extends CommonObject
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
// Remove extrafields
|
||||
if ((! $error) && (empty($conf->global->MAIN_EXTRAFIELDS_DISABLED))) // For avoid conflicts if trigger used
|
||||
{
|
||||
$result=$this->deleteExtraFields();
|
||||
if ($result < 0)
|
||||
{
|
||||
$error++;
|
||||
dol_syslog(get_class($this)."::delete error -4 ".$this->error, LOG_ERR);
|
||||
}
|
||||
}
|
||||
|
||||
if (! $error)
|
||||
{
|
||||
|
||||
@ -57,7 +57,7 @@ $object = new Product($db);
|
||||
$extrafields = new ExtraFields($db);
|
||||
|
||||
// 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))
|
||||
{
|
||||
|
||||
@ -42,7 +42,7 @@ foreach ($tmptype2label as $key => $val) $type2label[$key]=$langs->trans($val);
|
||||
|
||||
$action=GETPOST('action', 'alpha');
|
||||
$attrname=GETPOST('attrname', 'alpha');
|
||||
$elementtype='projet';
|
||||
$elementtype='projet'; //Must be the $table_element of the class that manage extrafield
|
||||
|
||||
if (!$user->admin) accessforbidden();
|
||||
|
||||
|
||||
@ -474,6 +474,12 @@ class Project extends CommonObject
|
||||
}
|
||||
}
|
||||
|
||||
$sql = "DELETE FROM " . MAIN_DB_PREFIX . "projet_task_extrafields";
|
||||
$sql.= " WHERE fk_object IN (SELECT rowid FROM " . MAIN_DB_PREFIX . "projet_task WHERE fk_projet=" . $this->id . ")";
|
||||
|
||||
dol_syslog(get_class($this) . "::delete sql=" . $sql, LOG_DEBUG);
|
||||
$resql = $this->db->query($sql);
|
||||
|
||||
$sql = "DELETE FROM " . MAIN_DB_PREFIX . "projet_task";
|
||||
$sql.= " WHERE fk_projet=" . $this->id;
|
||||
|
||||
@ -485,6 +491,13 @@ class Project extends CommonObject
|
||||
|
||||
dol_syslog(get_class($this) . "::delete sql=" . $sql, LOG_DEBUG);
|
||||
$resql = $this->db->query($sql);
|
||||
|
||||
$sql = "DELETE FROM " . MAIN_DB_PREFIX . "projet_extrafields";
|
||||
$sql.= " WHERE fk_object=" . $this->id;
|
||||
|
||||
dol_syslog(get_class($this) . "::delete sql=" . $sql, LOG_DEBUG);
|
||||
$resql = $this->db->query($sql);
|
||||
|
||||
if ($resql)
|
||||
{
|
||||
// We remove directory
|
||||
|
||||
@ -62,7 +62,7 @@ if ($object->id > 0)
|
||||
}
|
||||
|
||||
// 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_end=dol_mktime(0,0,0,GETPOST('projectendmonth','int'),GETPOST('projectendday','int'),GETPOST('projectendyear','int'));;
|
||||
|
||||
@ -44,6 +44,7 @@ $mine = ($mode == 'mine' ? 1 : 0);
|
||||
//if (! $user->rights->projet->all->lire) $mine=1; // Special for projects
|
||||
|
||||
$object = new Project($db);
|
||||
$taskstatic = new Task($db);
|
||||
$extrafields_project = new ExtraFields($db);
|
||||
$extrafields_task = new ExtraFields($db);
|
||||
if ($ref)
|
||||
@ -54,8 +55,8 @@ if ($ref)
|
||||
|
||||
// fetch optionals attributes and labels
|
||||
if (!empty($id)) {
|
||||
$extralabels_projet=$extrafields_project->fetch_name_optionals_label('projet');
|
||||
$extralabels_task=$extrafields_task->fetch_name_optionals_label('projet_task');
|
||||
$extralabels_projet=$extrafields_project->fetch_name_optionals_label($object->table_element);
|
||||
$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);
|
||||
$formother=new FormOther($db);
|
||||
$taskstatic = new Task($db);
|
||||
$userstatic=new User($db);
|
||||
|
||||
$help_url="EN:Module_Projects|FR:Module_Projets|ES:Módulo_Proyectos";
|
||||
|
||||
@ -50,7 +50,7 @@ $extrafields = new ExtraFields($db);
|
||||
$projectstatic = new Project($db);
|
||||
|
||||
// fetch optionals attributes and labels
|
||||
$extralabels=$extrafields->fetch_name_optionals_label('projet_task');
|
||||
$extralabels=$extrafields->fetch_name_optionals_label($object->table_element);
|
||||
/*
|
||||
* Actions
|
||||
*/
|
||||
|
||||
@ -75,6 +75,8 @@ if (empty($conf->global->MEMBER_ENABLE_PUBLIC))
|
||||
exit;
|
||||
}
|
||||
|
||||
$extrafields = new ExtraFields($db);
|
||||
|
||||
|
||||
/**
|
||||
* Show header for new member
|
||||
@ -245,11 +247,10 @@ if ($action == 'add')
|
||||
$adh->morphy = $_POST["morphy"];
|
||||
$adh->birth = $birthday;
|
||||
|
||||
foreach($_POST as $key => $value){
|
||||
if (preg_match("/^options_/",$key)){
|
||||
$adh->array_options[$key]=$_POST[$key];
|
||||
}
|
||||
}
|
||||
|
||||
// Fill array 'array_options' with data from add form
|
||||
$extralabels=$extrafields->fetch_name_optionals_label($adh->table_element);
|
||||
$ret = $extrafields->setOptionalsFromPost($extralabels,$adh);
|
||||
|
||||
$result=$adh->create($user->id);
|
||||
if ($result > 0)
|
||||
@ -360,8 +361,7 @@ if ($action == 'added')
|
||||
$form = new Form($db);
|
||||
$formcompany = new FormCompany($db);
|
||||
$adht = new AdherentType($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"));
|
||||
|
||||
@ -69,7 +69,7 @@ $extrafields = new ExtraFields($db);
|
||||
llxHeaderVierge($langs->trans("MemberCard"));
|
||||
|
||||
// fetch optionals attributes and labels
|
||||
$extralabels=$extrafields->fetch_name_optionals_label('member');
|
||||
$extralabels=$extrafields->fetch_name_optionals_label('adherent');
|
||||
if ($id > 0)
|
||||
{
|
||||
$res=$object->fetch($id);
|
||||
|
||||
@ -41,7 +41,7 @@ foreach ($tmptype2label as $key => $val) $type2label[$key]=$langs->trans($val);
|
||||
|
||||
$action=GETPOST('action', 'alpha');
|
||||
$attrname=GETPOST('attrname', 'alpha');
|
||||
$elementtype='contact';
|
||||
$elementtype='socpeople'; //Must be the $element of the class that manage extrafield
|
||||
|
||||
if (!$user->admin) accessforbidden();
|
||||
|
||||
|
||||
@ -42,7 +42,7 @@ foreach ($tmptype2label as $key => $val) $type2label[$key]=$langs->trans($val);
|
||||
|
||||
$action=GETPOST('action', 'alpha');
|
||||
$attrname=GETPOST('attrname', 'alpha');
|
||||
$elementtype='company';
|
||||
$elementtype='societe'; //Must be the $element of the class that manage extrafield
|
||||
|
||||
if (!$user->admin) accessforbidden();
|
||||
|
||||
|
||||
@ -852,13 +852,9 @@ class Societe extends CommonObject
|
||||
// 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('company',true);
|
||||
$extralabels=$extrafields->fetch_name_optionals_label($this->table_element,true);
|
||||
if (count($extralabels)>0) {
|
||||
$this->array_options = array();
|
||||
}
|
||||
foreach($extrafields->attribute_label as $key=>$label)
|
||||
{
|
||||
$this->array_options['options_'.$key]=$label;
|
||||
$this->fetch_optionals($this->id,$extralabels);
|
||||
}
|
||||
}
|
||||
else
|
||||
@ -2791,4 +2787,4 @@ class Societe extends CommonObject
|
||||
|
||||
}
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
@ -56,7 +56,7 @@ $object = new Societe($db);
|
||||
$extrafields = new ExtraFields($db);
|
||||
|
||||
// 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)
|
||||
$object->getCanvas($socid);
|
||||
|
||||
@ -41,7 +41,7 @@ foreach ($tmptype2label as $key => $val) $type2label[$key]=$langs->trans($val);
|
||||
|
||||
$action=GETPOST('action', 'alpha');
|
||||
$attrname=GETPOST('attrname', 'alpha');
|
||||
$elementtype='user';
|
||||
$elementtype='user'; //Must be the $table_element of the class that manage extrafield
|
||||
|
||||
if (!$user->admin) accessforbidden();
|
||||
|
||||
|
||||
@ -561,7 +561,7 @@ if ($action == 'adduserldap')
|
||||
*/
|
||||
|
||||
// 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"));
|
||||
|
||||
|
||||
@ -118,7 +118,7 @@ $contact_fields = array(
|
||||
//Retreive all extrafield for contact
|
||||
// fetch optionals attributes and labels
|
||||
$extrafields=new ExtraFields($db);
|
||||
$extralabels=$extrafields->fetch_name_optionals_label('contact',true);
|
||||
$extralabels=$extrafields->fetch_name_optionals_label('socpeople',true);
|
||||
if (count($extrafields)>0) {
|
||||
$extrafield_array = array();
|
||||
}
|
||||
@ -306,7 +306,7 @@ function getContact($authentication,$id,$ref='',$ref_ext='')
|
||||
//Retreive all extrafield for thirdsparty
|
||||
// fetch optionals attributes and labels
|
||||
$extrafields=new ExtraFields($db);
|
||||
$extralabels=$extrafields->fetch_name_optionals_label('contact',true);
|
||||
$extralabels=$extrafields->fetch_name_optionals_label('socpeople',true);
|
||||
//Get extrafield values
|
||||
$contact->fetch_optionals($contact->id,$extralabels);
|
||||
|
||||
@ -413,7 +413,7 @@ function createContact($authentication,$contact)
|
||||
//Retreive all extrafield for thirdsparty
|
||||
// fetch optionals attributes and labels
|
||||
$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)
|
||||
{
|
||||
$key='options_'.$key;
|
||||
@ -657,7 +657,7 @@ function updateContact($authentication,$contact)
|
||||
//Retreive all extrafield for contact
|
||||
// fetch optionals attributes and labels
|
||||
$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)
|
||||
{
|
||||
$key='options_'.$key;
|
||||
|
||||
@ -124,7 +124,7 @@ $thirdparty_fields= array(
|
||||
//Retreive all extrafield for thirdsparty
|
||||
// fetch optionals attributes and labels
|
||||
$extrafields=new ExtraFields($db);
|
||||
$extralabels=$extrafields->fetch_name_optionals_label('company',true);
|
||||
$extralabels=$extrafields->fetch_name_optionals_label('societe',true);
|
||||
if (count($extrafields)>0) {
|
||||
$extrafield_array = array();
|
||||
}
|
||||
@ -331,7 +331,7 @@ function getThirdParty($authentication,$id='',$ref='',$ref_ext='')
|
||||
//Retreive all extrafield for thirdsparty
|
||||
// fetch optionals attributes and labels
|
||||
$extrafields=new ExtraFields($db);
|
||||
$extralabels=$extrafields->fetch_name_optionals_label('company',true);
|
||||
$extralabels=$extrafields->fetch_name_optionals_label('societe',true);
|
||||
//Get extrafield values
|
||||
$thirdparty->fetch_optionals($thirdparty->id,$extralabels);
|
||||
|
||||
@ -446,7 +446,7 @@ function createThirdParty($authentication,$thirdparty)
|
||||
//Retreive all extrafield for thirdsparty
|
||||
// fetch optionals attributes and labels
|
||||
$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)
|
||||
{
|
||||
$key='options_'.$key;
|
||||
@ -567,7 +567,7 @@ function updateThirdParty($authentication,$thirdparty)
|
||||
//Retreive all extrafield for thirdsparty
|
||||
// fetch optionals attributes and labels
|
||||
$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)
|
||||
{
|
||||
$key='options_'.$key;
|
||||
|
||||
@ -187,7 +187,7 @@ $thirdpartywithuser_fields = array(
|
||||
//Retreive all extrafield for contact
|
||||
// fetch optionals attributes and labels
|
||||
$extrafields=new ExtraFields($db);
|
||||
$extralabels=$extrafields->fetch_name_optionals_label('contact',true);
|
||||
$extralabels=$extrafields->fetch_name_optionals_label('socpeople',true);
|
||||
if (count($extrafields)>0) {
|
||||
$extrafield_array = array();
|
||||
}
|
||||
@ -574,7 +574,7 @@ function createUserFromThirdparty($authentication,$thirdpartywithuser)
|
||||
//Retreive all extrafield for thirdsparty
|
||||
// fetch optionals attributes and labels
|
||||
$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)
|
||||
{
|
||||
$key='contact_options_'.$key;
|
||||
|
||||
Loading…
Reference in New Issue
Block a user