diff --git a/htdocs/adherents/admin/adherent_extrafields.php b/htdocs/adherents/admin/adherent_extrafields.php
index ef986dacbbb..34420ee0121 100755
--- a/htdocs/adherents/admin/adherent_extrafields.php
+++ b/htdocs/adherents/admin/adherent_extrafields.php
@@ -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();
diff --git a/htdocs/adherents/admin/adherent_type_extrafields.php b/htdocs/adherents/admin/adherent_type_extrafields.php
index 7873573ff34..ce2787752a7 100644
--- a/htdocs/adherents/admin/adherent_type_extrafields.php
+++ b/htdocs/adherents/admin/adherent_type_extrafields.php
@@ -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();
diff --git a/htdocs/adherents/card_subscriptions.php b/htdocs/adherents/card_subscriptions.php
index 17a39148eba..cf5ed660a32 100644
--- a/htdocs/adherents/card_subscriptions.php
+++ b/htdocs/adherents/card_subscriptions.php
@@ -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);
diff --git a/htdocs/adherents/class/adherent.class.php b/htdocs/adherents/class/adherent.class.php
index 325b5cf6426..b98b34ded05 100644
--- a/htdocs/adherents/class/adherent.class.php
+++ b/htdocs/adherents/class/adherent.class.php
@@ -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();
diff --git a/htdocs/adherents/class/adherent_type.class.php b/htdocs/adherents/class/adherent_type.class.php
index d829c5a84f9..69515671080 100644
--- a/htdocs/adherents/class/adherent_type.class.php
+++ b/htdocs/adherents/class/adherent_type.class.php
@@ -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;
diff --git a/htdocs/adherents/fiche.php b/htdocs/adherents/fiche.php
index 0453633afc4..52f2c3fb13e 100644
--- a/htdocs/adherents/fiche.php
+++ b/htdocs/adherents/fiche.php
@@ -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);
diff --git a/htdocs/admin/agenda_extrafields.php b/htdocs/admin/agenda_extrafields.php
index ac66f3cb44f..a7763893bb5 100644
--- a/htdocs/admin/agenda_extrafields.php
+++ b/htdocs/admin/agenda_extrafields.php
@@ -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();
diff --git a/htdocs/admin/order_extrafields.php b/htdocs/admin/order_extrafields.php
index cb57c0d2e45..7e748cdbc4a 100644
--- a/htdocs/admin/order_extrafields.php
+++ b/htdocs/admin/order_extrafields.php
@@ -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();
diff --git a/htdocs/admin/pdf.php b/htdocs/admin/pdf.php
index afa67c434e8..085d33f3df0 100755
--- a/htdocs/admin/pdf.php
+++ b/htdocs/admin/pdf.php
@@ -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 '
| '.$langs->trans("HideAnyVATInformationOnPDF").' | ';
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 ' |
';
+
+ // Hide Tva Intra on adress
+ $var=!$var;
+ print '| '.$langs->trans("ShowVATIntaInAddress").' | ';
+ 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 ' |
';
-// if ($conf->global->MAIN_FEATURES_LEVEL > 1)
-// {
- //Desc
- $var=!$var;
- print '| '.$langs->trans("HideDescOnPDF").' | ';
- 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 ' |
';
+ //Desc
+ $var=!$var;
+ print '| '.$langs->trans("HideDescOnPDF").' | ';
+ 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 ' |
';
- //Ref
- $var=!$var;
- print '| '.$langs->trans("HideRefOnPDF").' | ';
- 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 ' |
';
+ //Ref
+ $var=!$var;
+ print '| '.$langs->trans("HideRefOnPDF").' | ';
+ 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 ' |
';
+
+ //Details
+ $var=!$var;
+ print '| '.$langs->trans("HideDetailsOnPDF").' | ';
+ 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 ' |
';
- //Details
- $var=!$var;
- print '| '.$langs->trans("HideDetailsOnPDF").' | ';
- 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 ' |
';
-// }
print '';
@@ -418,26 +421,30 @@ else // Show
print "";
print '';
-// if ($conf->global->MAIN_FEATURES_LEVEL > 1)
-// {
- //Desc
- $var=!$var;
- print '| '.$langs->trans("HideDescOnPDF").' | ';
- print yn($conf->global->MAIN_GENERATE_DOCUMENTS_HIDE_DESC,1);
- print ' |
';
+ // Hide Tva Intra on adress
+ $var=!$var;
+ print '| '.$langs->trans("ShowVATIntaInAddress").' | ';
+ print yn($conf->global->MAIN_TVAINTRA_NOT_IN_ADDRESS,1);
+ print ' |
';
+
+ //Desc
+ $var=!$var;
+ print '| '.$langs->trans("HideDescOnPDF").' | ';
+ print yn($conf->global->MAIN_GENERATE_DOCUMENTS_HIDE_DESC,1);
+ print ' |
';
- //Ref
- $var=!$var;
- print '| '.$langs->trans("HideRefOnPDF").' | ';
- print yn($conf->global->MAIN_GENERATE_DOCUMENTS_HIDE_REF,1);
- print ' |
';
+ //Ref
+ $var=!$var;
+ print '| '.$langs->trans("HideRefOnPDF").' | ';
+ print yn($conf->global->MAIN_GENERATE_DOCUMENTS_HIDE_REF,1);
+ print ' |
';
+
+ //Details
+ $var=!$var;
+ print '| '.$langs->trans("HideDetailsOnPDF").' | ';
+ print yn($conf->global->MAIN_GENERATE_DOCUMENTS_HIDE_DETAILS,1);
+ print ' |
';
- //Details
- $var=!$var;
- print '| '.$langs->trans("HideDetailsOnPDF").' | ';
- print yn($conf->global->MAIN_GENERATE_DOCUMENTS_HIDE_DETAILS,1);
- print ' |
';
-// }
print '';
diff --git a/htdocs/admin/supplierinvoice_extrafields.php b/htdocs/admin/supplierinvoice_extrafields.php
index a95a61c98cf..8f9865981f5 100644
--- a/htdocs/admin/supplierinvoice_extrafields.php
+++ b/htdocs/admin/supplierinvoice_extrafields.php
@@ -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();
diff --git a/htdocs/admin/supplierorder_extrafields.php b/htdocs/admin/supplierorder_extrafields.php
index 68747cf417c..9aa7770f820 100644
--- a/htdocs/admin/supplierorder_extrafields.php
+++ b/htdocs/admin/supplierorder_extrafields.php
@@ -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();
diff --git a/htdocs/comm/action/class/actioncomm.class.php b/htdocs/comm/action/class/actioncomm.class.php
index 52620f4445b..9b15634945e 100644
--- a/htdocs/comm/action/class/actioncomm.class.php
+++ b/htdocs/comm/action/class/actioncomm.class.php
@@ -35,7 +35,7 @@ class ActionComm extends CommonObject
public $element='action';
public $table_element = 'actioncomm';
public $table_rowid = 'id';
- protected $ismultientitymanaged = 2; // 0=No test on entity, 1=Test with field entity, 2=Test with link by societe
+ protected $ismultientitymanaged = 1; // 0=No test on entity, 1=Test with field entity, 2=Test with link by societe
var $id;
diff --git a/htdocs/comm/action/document.php b/htdocs/comm/action/document.php
index 6a576c580ca..7ad74302655 100755
--- a/htdocs/comm/action/document.php
+++ b/htdocs/comm/action/document.php
@@ -51,6 +51,8 @@ if ($user->societe_id > 0)
$socid = $user->societe_id;
}
+$result = restrictedArea($user, 'agenda', $objectid, 'actioncomm&societe', 'myactions&allactions', '', 'id');
+
$act = new ActionComm($db);
if ($objectid > 0)
diff --git a/htdocs/comm/action/fiche.php b/htdocs/comm/action/fiche.php
index 618a6e4fa3e..f230ba1a95b 100644
--- a/htdocs/comm/action/fiche.php
+++ b/htdocs/comm/action/fiche.php
@@ -53,7 +53,7 @@ $contactid=GETPOST('contactid','int');
$socid = GETPOST('socid','int');
$id = GETPOST('id','int');
if ($user->societe_id) $socid=$user->societe_id;
-//$result = restrictedArea($user, 'agenda', $id, 'actioncomm', 'actions', '', 'id');
+$result = restrictedArea($user, 'agenda', $id, 'actioncomm&societe', 'myactions&allactions', '', 'id');
$error=GETPOST("error");
$mesg='';
@@ -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);
diff --git a/htdocs/comm/action/info.php b/htdocs/comm/action/info.php
index 7c775bf78ac..66dc178d4b8 100644
--- a/htdocs/comm/action/info.php
+++ b/htdocs/comm/action/info.php
@@ -31,6 +31,8 @@ require_once DOL_DOCUMENT_ROOT.'/comm/action/class/actioncomm.class.php';
$langs->load("commercial");
+$id = GETPOST('id','int');
+
// Security check
if ($user->societe_id > 0)
{
@@ -38,6 +40,7 @@ if ($user->societe_id > 0)
$socid = $user->societe_id;
}
+$result = restrictedArea($user, 'agenda', $id, 'actioncomm&societe', 'myactions&allactions', '', 'id');
/*
@@ -48,8 +51,8 @@ $help_url='EN:Module_Agenda_En|FR:Module_Agenda|ES:M&omodulodulo_Agenda';
llxHeader('',$langs->trans("Agenda"),$help_url);
$act = new ActionComm($db);
-$act->fetch($_GET["id"]);
-$act->info($_GET["id"]);
+$act->fetch($id);
+$act->info($act->id);
$head=actions_prepare_head($act);
dol_fiche_head($head, 'info', $langs->trans("Action"),0,'action');
diff --git a/htdocs/comm/admin/propal_extrafields.php b/htdocs/comm/admin/propal_extrafields.php
index 350583a5427..28534e08140 100755
--- a/htdocs/comm/admin/propal_extrafields.php
+++ b/htdocs/comm/admin/propal_extrafields.php
@@ -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();
diff --git a/htdocs/comm/mailing/fiche.php b/htdocs/comm/mailing/fiche.php
index 2616850748e..a58e7d6ad4f 100644
--- a/htdocs/comm/mailing/fiche.php
+++ b/htdocs/comm/mailing/fiche.php
@@ -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'));
diff --git a/htdocs/comm/propal.php b/htdocs/comm/propal.php
index ab536ddee63..abf54329c6a 100644
--- a/htdocs/comm/propal.php
+++ b/htdocs/comm/propal.php
@@ -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)
diff --git a/htdocs/comm/propal/class/propal.class.php b/htdocs/comm/propal/class/propal.class.php
index 92c1e6127ed..7bd18f3a3d8 100644
--- a/htdocs/comm/propal/class/propal.class.php
+++ b/htdocs/comm/propal/class/propal.class.php
@@ -1099,6 +1099,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);
$this->lines = array();
@@ -1187,14 +1197,9 @@ 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();
- }
- foreach($extrafields->attribute_label as $key=>$label)
- {
- $this->array_options['options_'.$key]=$label;
+ $this->fetch_optionals($this->id,$extralabels);
}
return 1;
}
@@ -2012,6 +2017,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);
diff --git a/htdocs/commande/class/commande.class.php b/htdocs/commande/class/commande.class.php
index e186c7753a7..60522561346 100644
--- a/htdocs/commande/class/commande.class.php
+++ b/htdocs/commande/class/commande.class.php
@@ -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();
@@ -2410,6 +2420,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);
@@ -2437,6 +2458,8 @@ class Commande extends CommonOrder
}
}
}
+
+
}
if (! $error)
diff --git a/htdocs/commande/fiche.php b/htdocs/commande/fiche.php
index ea2cd608452..99168cdc6a0 100644
--- a/htdocs/commande/fiche.php
+++ b/htdocs/commande/fiche.php
@@ -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)
diff --git a/htdocs/compta/facture.php b/htdocs/compta/facture.php
index 55276b8c7a3..1786cf8dadb 100644
--- a/htdocs/compta/facture.php
+++ b/htdocs/compta/facture.php
@@ -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)
{
diff --git a/htdocs/compta/facture/admin/facture_cust_extrafields.php b/htdocs/compta/facture/admin/facture_cust_extrafields.php
index 57f4be119e6..8d6fb63cf80 100644
--- a/htdocs/compta/facture/admin/facture_cust_extrafields.php
+++ b/htdocs/compta/facture/admin/facture_cust_extrafields.php
@@ -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();
diff --git a/htdocs/compta/facture/class/facture.class.php b/htdocs/compta/facture/class/facture.class.php
index a538694bac9..bd1c6d29d28 100644
--- a/htdocs/compta/facture/class/facture.class.php
+++ b/htdocs/compta/facture/class/facture.class.php
@@ -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);
}
/*
diff --git a/htdocs/contact/class/contact.class.php b/htdocs/contact/class/contact.class.php
index 4cbc1d7fbcd..db8b408e6ed 100644
--- a/htdocs/contact/class/contact.class.php
+++ b/htdocs/contact/class/contact.class.php
@@ -36,6 +36,7 @@ class Contact extends CommonObject
{
public $element='contact';
public $table_element='socpeople';
+ protected $ismultientitymanaged = 1; // 0=No test on entity, 1=Test with field entity, 2=Test with link by societe
var $id;
var $civilite_id; // In fact we store civility_code
diff --git a/htdocs/contact/exportimport.php b/htdocs/contact/exportimport.php
index c3f9f2605ee..5149eed9efb 100644
--- a/htdocs/contact/exportimport.php
+++ b/htdocs/contact/exportimport.php
@@ -29,26 +29,28 @@ require_once DOL_DOCUMENT_ROOT.'/core/lib/contact.lib.php';
$langs->load("companies");
// Security check
-$contactid = isset($_GET["id"])?$_GET["id"]:'';
+$id = GETPOST('id', 'int');
if ($user->societe_id) $socid=$user->societe_id;
-$result = restrictedArea($user, 'contact', $contactid, 'socpeople&societe');
+$result = restrictedArea($user, 'contact', $id, 'socpeople&societe');
/*
* View
*/
-llxHeader('',$langs->trans("ContactsAddresses"),'EN:Module_Third_Parties|FR:Module_Tiers|ES:Módulo_Empresas');
+$title = (! empty($conf->global->SOCIETE_ADDRESSES_MANAGEMENT) ? $langs->trans("Contacts") : $langs->trans("ContactsAddresses"));
+
+llxHeader('',$title,'EN:Module_Third_Parties|FR:Module_Tiers|ES:Módulo_Empresas');
$form = new Form($db);
$contact = new Contact($db);
-$contact->fetch($_GET["id"], $user);
+$contact->fetch($id, $user);
$head = contact_prepare_head($contact);
-dol_fiche_head($head, 'exportimport', $langs->trans("ContactsAddresses"), 0, 'contact');
+dol_fiche_head($head, 'exportimport', $title, 0, 'contact');
/*
@@ -97,7 +99,7 @@ print '';
print '
';
print $langs->trans("ExportCardToFormat").': ';
-print '';
+print '';
print img_picto($langs->trans("VCard"),'vcard.png').' ';
print $langs->trans("VCard");
print '';
diff --git a/htdocs/contact/fiche.php b/htdocs/contact/fiche.php
index 9711654fa03..abb19b2cc91 100644
--- a/htdocs/contact/fiche.php
+++ b/htdocs/contact/fiche.php
@@ -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);
@@ -67,7 +67,7 @@ if (! empty($canvas))
}
// Security check
-$result = restrictedArea($user, 'contact', $id, 'socpeople&societe', '', '', '', $objcanvas); // If we create a contact with no company (shared contacts), no check on write permission
+$result = restrictedArea($user, 'contact', $id, 'socpeople&societe', '', '', 'rowid', $objcanvas); // If we create a contact with no company (shared contacts), no check on write permission
// Initialize technical object to manage hooks of thirdparties. Note that conf->hooks_modules contains array array
$hookmanager->initHooks(array('contactcard'));
diff --git a/htdocs/contact/ldap.php b/htdocs/contact/ldap.php
index bb1114c18da..f284ee1834d 100644
--- a/htdocs/contact/ldap.php
+++ b/htdocs/contact/ldap.php
@@ -35,12 +35,12 @@ $langs->load("admin");
$action=GETPOST('action');
// Security check
-$contactid = isset($_GET["id"])?$_GET["id"]:'';
+$id = GETPOST('id', 'int');
if ($user->societe_id) $socid=$user->societe_id;
-$result = restrictedArea($user, 'contact', $contactid, 'socpeople&societe');
+$result = restrictedArea($user, 'contact', $id, 'socpeople&societe');
$contact = new Contact($db);
-$contact->fetch($_GET["id"], $user);
+$contact->fetch($id, $user);
/*
@@ -79,13 +79,15 @@ if ($action == 'dolibarr2ldap')
* View
*/
-llxHeader('',$langs->trans("ContactsAddresses"),'EN:Module_Third_Parties|FR:Module_Tiers|ES:Módulo_Empresas');
+$title = (! empty($conf->global->SOCIETE_ADDRESSES_MANAGEMENT) ? $langs->trans("Contacts") : $langs->trans("ContactsAddresses"));
+
+llxHeader('',$title,'EN:Module_Third_Parties|FR:Module_Tiers|ES:Módulo_Empresas');
$form = new Form($db);
$head = contact_prepare_head($contact);
-dol_fiche_head($head, 'ldap', $langs->trans("ContactsAddresses"), 0, 'contact');
+dol_fiche_head($head, 'ldap', $title, 0, 'contact');
print '';
diff --git a/htdocs/contact/perso.php b/htdocs/contact/perso.php
index d321e07a258..86462d05fae 100644
--- a/htdocs/contact/perso.php
+++ b/htdocs/contact/perso.php
@@ -69,7 +69,9 @@ if ($action == 'update' && ! $_POST["cancel"] && $user->rights->societe->contact
$now=dol_now();
-llxHeader('',$langs->trans("ContactsAddresses"),'EN:Module_Third_Parties|FR:Module_Tiers|ES:Módulo_Empresas');
+$title = (! empty($conf->global->SOCIETE_ADDRESSES_MANAGEMENT) ? $langs->trans("Contacts") : $langs->trans("ContactsAddresses"));
+
+llxHeader('',$title,'EN:Module_Third_Parties|FR:Module_Tiers|ES:Módulo_Empresas');
$form = new Form($db);
@@ -77,7 +79,7 @@ $object->fetch($id, $user);
$head = contact_prepare_head($object);
-dol_fiche_head($head, 'perso', $langs->trans("ContactsAddresses"), 0, 'contact');
+dol_fiche_head($head, 'perso', $title, 0, 'contact');
if ($action == 'edit')
{
diff --git a/htdocs/contact/vcard.php b/htdocs/contact/vcard.php
index f9f4c80fad1..48189eb60f6 100644
--- a/htdocs/contact/vcard.php
+++ b/htdocs/contact/vcard.php
@@ -29,8 +29,13 @@ require_once DOL_DOCUMENT_ROOT.'/societe/class/societe.class.php';
require_once DOL_DOCUMENT_ROOT.'/core/class/vcard.class.php';
+$id = GETPOST('id', 'int');
+
+// Security check
+$result = restrictedArea($user, 'contact', $id, 'socpeople&societe');
+
$contact = new Contact($db);
-$result=$contact->fetch($_GET["id"]);
+$result=$contact->fetch($id);
$physicalperson=1;
diff --git a/htdocs/core/class/commondocgenerator.class.php b/htdocs/core/class/commondocgenerator.class.php
index c56516257f7..a7e92bc463c 100755
--- a/htdocs/core/class/commondocgenerator.class.php
+++ b/htdocs/core/class/commondocgenerator.class.php
@@ -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)
diff --git a/htdocs/core/class/commonobject.class.php b/htdocs/core/class/commonobject.class.php
index 5b47b3811fb..7aac8234b5f 100644
--- a/htdocs/core/class/commonobject.class.php
+++ b/htdocs/core/class/commonobject.class.php
@@ -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)
{
diff --git a/htdocs/core/class/extrafields.class.php b/htdocs/core/class/extrafields.class.php
index 6117b41d2eb..17226e7d461 100755
--- a/htdocs/core/class/extrafields.class.php
+++ b/htdocs/core/class/extrafields.class.php
@@ -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
diff --git a/htdocs/core/lib/functions.lib.php b/htdocs/core/lib/functions.lib.php
index 54aa10e23b4..5e288acaabc 100644
--- a/htdocs/core/lib/functions.lib.php
+++ b/htdocs/core/lib/functions.lib.php
@@ -4134,7 +4134,7 @@ function verifCond($strRights)
* This function is called by verifCond() or trans() and transnoentitiesnoconv().
*
* @param string $s String to evaluate
- * @param int $returnvalue 0=No return (used to execute $a=something). 1=Value of eval is returned (used to eval $something).
+ * @param int $returnvalue 0=No return (used to execute eval($a=something)). 1=Value of eval is returned (used to eval($something)).
* @return mixed Nothing or return of eval
*/
function dol_eval($s,$returnvalue=0)
@@ -4145,16 +4145,16 @@ function dol_eval($s,$returnvalue=0)
global $rights;
//print $s."
\n";
- if ($returnvalue) return eval('return '.$s.';');
- else eval($s);
+ if ($returnvalue) return @eval('return '.$s.';');
+ else @eval($s);
}
/**
-* Return if var element is ok
-*
-* @param string $element Variable to check
-* @return boolean Return true of variable is not empty
-*/
+ * Return if var element is ok
+ *
+ * @param string $element Variable to check
+ * @return boolean Return true of variable is not empty
+ */
function dol_validElement($element)
{
return (trim($element) != '');
diff --git a/htdocs/core/lib/pdf.lib.php b/htdocs/core/lib/pdf.lib.php
index 34f1bd5878f..4fc377f896c 100644
--- a/htdocs/core/lib/pdf.lib.php
+++ b/htdocs/core/lib/pdf.lib.php
@@ -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))
diff --git a/htdocs/core/lib/security.lib.php b/htdocs/core/lib/security.lib.php
index ea2f58299ef..4acfd4912c6 100644
--- a/htdocs/core/lib/security.lib.php
+++ b/htdocs/core/lib/security.lib.php
@@ -112,11 +112,15 @@ function restrictedArea($user, $features, $objectid=0, $dbtablename='', $feature
if (method_exists($objcanvas->control,'restrictedArea')) return $objcanvas->control->restrictedArea($user,$features,$objectid,$dbtablename,$feature2,$dbt_keyfield,$dbt_select);
}
- if ($dbt_select != 'rowid') $objectid = "'".$objectid."'";
+ if ($dbt_select != 'rowid' && $dbt_select != 'id') $objectid = "'".$objectid."'";
// More features to check
$features = explode("&", $features);
+ // More subfeatures to check
+ if (!empty($feature2))
+ $feature2 = explode("&", $feature2);
+
// More parameters
$params = explode('&', $dbtablename);
$dbtablename=(! empty($params[0]) ? $params[0] : '');
@@ -160,8 +164,11 @@ function restrictedArea($user, $features, $objectid=0, $dbtablename='', $feature
}
else if (! empty($feature2)) // This should be used for future changes
{
- if (empty($user->rights->$feature->$feature2->lire)
- && empty($user->rights->$feature->$feature2->read)) $readok=0;
+ foreach($feature2 as $subfeature)
+ {
+ if (empty($user->rights->$feature->$subfeature->lire) && empty($user->rights->$feature->$subfeature->read)) $readok=0;
+ else { $readok=1; break; } // For bypass the second test if the first is ok
+ }
}
else if (! empty($feature) && ($feature!='user' && $feature!='usergroup')) // This is for old permissions
{
@@ -206,8 +213,11 @@ function restrictedArea($user, $features, $objectid=0, $dbtablename='', $feature
}
else if (! empty($feature2)) // This should be used for future changes
{
- if (empty($user->rights->$feature->$feature2->creer)
- && empty($user->rights->$feature->$feature2->write)) $createok=0;
+ foreach($feature2 as $subfeature)
+ {
+ if (empty($user->rights->$feature->$subfeature->creer) && empty($user->rights->$feature->$subfeature->write)) $createok=0;
+ else { $createok=1; break; } // For bypass the second test if the first is ok
+ }
}
else if (! empty($feature)) // This is for old permissions
{
@@ -267,8 +277,11 @@ function restrictedArea($user, $features, $objectid=0, $dbtablename='', $feature
}
else if (! empty($feature2)) // This should be used for future changes
{
- if (empty($user->rights->$feature->$feature2->supprimer)
- && empty($user->rights->$feature->$feature2->delete)) $deleteok=0;
+ foreach($feature2 as $subfeature)
+ {
+ if (empty($user->rights->$feature->$subfeature->supprimer) && empty($user->rights->$feature->$subfeature->delete)) $deleteok=0;
+ else { $deleteok=1; break; } // For bypass the second test if the first is ok
+ }
}
else if (! empty($feature)) // This is for old permissions
{
diff --git a/htdocs/core/menus/standard/eldy.lib.php b/htdocs/core/menus/standard/eldy.lib.php
index ed73b895280..5c72ae6f1d7 100644
--- a/htdocs/core/menus/standard/eldy.lib.php
+++ b/htdocs/core/menus/standard/eldy.lib.php
@@ -40,8 +40,8 @@ function print_eldy_menu($db,$atarget,$type_user,&$tabMenu,&$menu,$noout=0)
{
global $user,$conf,$langs,$dolibarr_main_db_name;
- $mainmenu=$_SESSION["mainmenu"];
- $leftmenu=$_SESSION["leftmenu"];
+ $mainmenu=(empty($_SESSION["mainmenu"])?'':$_SESSION["mainmenu"]);
+ $leftmenu=(empty($_SESSION["leftmenu"])?'':$_SESSION["leftmenu"]);
$id='mainmenu';
$listofmodulesforexternal=explode(',',$conf->global->MAIN_MODULES_FOR_EXTERNAL);
diff --git a/htdocs/core/modules/commande/doc/doc_generic_order_odt.modules.php b/htdocs/core/modules/commande/doc/doc_generic_order_odt.modules.php
index 623a6b9c8c6..e39a44abb07 100644
--- a/htdocs/core/modules/commande/doc/doc_generic_order_odt.modules.php
+++ b/htdocs/core/modules/commande/doc/doc_generic_order_odt.modules.php
@@ -313,12 +313,22 @@ class doc_generic_order_odt extends ModelePDFCommandes
{
//print "srctemplatepath=".$srctemplatepath; // Src filename
$newfile=basename($srctemplatepath);
- $newfiletmp=preg_replace('/\.odt/i','',$newfile);
+ $newfiletmp=preg_replace('/\.od(t|s)/i','',$newfile);
$newfiletmp=preg_replace('/template_/i','',$newfiletmp);
$newfiletmp=preg_replace('/modele_/i','',$newfiletmp);
$newfiletmp=$objectref.'_'.$newfiletmp;
//$file=$dir.'/'.$newfiletmp.'.'.dol_print_date(dol_now(),'%Y%m%d%H%M%S').'.odt';
- $file=$dir.'/'.$newfiletmp.'.odt';
+ // Get extension (ods or odt)
+ $newfileformat=substr($newfile, strrpos($newfile, '.')+1);
+ if ( ! empty($conf->global->MAIN_DOC_USE_TIMING))
+ {
+ $filename=$newfiletmp.'.'.dol_print_date(dol_now(),'%Y%m%d%H%M%S').'.'.$newfileformat;
+ }
+ else
+ {
+ $filename=$newfiletmp.'.'.$newfileformat;
+ }
+ $file=$dir.'/'.$filename;
//print "newdir=".$dir;
//print "newfile=".$newfile;
//print "file=".$file;
diff --git a/htdocs/core/modules/facture/doc/doc_generic_invoice_odt.modules.php b/htdocs/core/modules/facture/doc/doc_generic_invoice_odt.modules.php
index b65c6171430..a6b263fd717 100644
--- a/htdocs/core/modules/facture/doc/doc_generic_invoice_odt.modules.php
+++ b/htdocs/core/modules/facture/doc/doc_generic_invoice_odt.modules.php
@@ -336,12 +336,24 @@ class doc_generic_invoice_odt extends ModelePDFFactures
{
//print "srctemplatepath=".$srctemplatepath; // Src filename
$newfile=basename($srctemplatepath);
- $newfiletmp=preg_replace('/\.odt/i','',$newfile);
+ $newfiletmp=preg_replace('/\.od(t|s)/i','',$newfile);
$newfiletmp=preg_replace('/template_/i','',$newfiletmp);
$newfiletmp=preg_replace('/modele_/i','',$newfiletmp);
+
$newfiletmp=$objectref.'_'.$newfiletmp;
+
+ // Get extension (ods or odt)
+ $newfileformat=substr($newfile, strrpos($newfile, '.')+1);
+ if ( ! empty($conf->global->MAIN_DOC_USE_TIMING))
+ {
+ $filename=$newfiletmp.'.'.dol_print_date(dol_now(),'%Y%m%d%H%M%S').'.'.$newfileformat;
+ }
+ else
+ {
+ $filename=$newfiletmp.'.'.$newfileformat;
+ }
+ $file=$dir.'/'.$filename;
//$file=$dir.'/'.$newfiletmp.'.'.dol_print_date(dol_now(),'%Y%m%d%H%M%S').'.odt';
- $file=$dir.'/'.$newfiletmp.'.odt';
//print "newdir=".$dir;
//print "newfile=".$newfile;
//print "file=".$file;
diff --git a/htdocs/core/modules/modAgenda.class.php b/htdocs/core/modules/modAgenda.class.php
index 89c92a14c69..902320a2733 100644
--- a/htdocs/core/modules/modAgenda.class.php
+++ b/htdocs/core/modules/modAgenda.class.php
@@ -43,6 +43,8 @@ class modAgenda extends DolibarrModules
*/
function __construct($db)
{
+ global $conf;
+
$this->db = $db;
$this->numero = 2400;
diff --git a/htdocs/core/modules/project/pdf/doc_generic_project_odt.modules.php b/htdocs/core/modules/project/pdf/doc_generic_project_odt.modules.php
index a2f8c5fd07a..bb81a07272a 100644
--- a/htdocs/core/modules/project/pdf/doc_generic_project_odt.modules.php
+++ b/htdocs/core/modules/project/pdf/doc_generic_project_odt.modules.php
@@ -435,12 +435,22 @@ class doc_generic_project_odt extends ModelePDFProjects
{
//print "srctemplatepath=".$srctemplatepath; // Src filename
$newfile=basename($srctemplatepath);
- $newfiletmp=preg_replace('/\.odt/i','',$newfile);
+ $newfiletmp=preg_replace('/\.od(t|s)/i','',$newfile);
$newfiletmp=preg_replace('/template_/i','',$newfiletmp);
$newfiletmp=preg_replace('/modele_/i','',$newfiletmp);
$newfiletmp=$objectref.'_'.$newfiletmp;
//$file=$dir.'/'.$newfiletmp.'.'.dol_print_date(dol_now(),'%Y%m%d%H%M%S').'.odt';
- $file=$dir.'/'.$newfiletmp.'.odt';
+ // Get extension (ods or odt)
+ $newfileformat=substr($newfile, strrpos($newfile, '.')+1);
+ if ( ! empty($conf->global->MAIN_DOC_USE_TIMING))
+ {
+ $filename=$newfiletmp.'.'.dol_print_date(dol_now(),'%Y%m%d%H%M%S').'.'.$newfileformat;
+ }
+ else
+ {
+ $filename=$newfiletmp.'.'.$newfileformat;
+ }
+ $file=$dir.'/'.$filename;
//print "newdir=".$dir;
//print "newfile=".$newfile;
//print "file=".$file;
diff --git a/htdocs/core/modules/propale/doc/doc_generic_proposal_odt.modules.php b/htdocs/core/modules/propale/doc/doc_generic_proposal_odt.modules.php
index 6a7384ba4d9..45c4d6e9755 100644
--- a/htdocs/core/modules/propale/doc/doc_generic_proposal_odt.modules.php
+++ b/htdocs/core/modules/propale/doc/doc_generic_proposal_odt.modules.php
@@ -275,16 +275,27 @@ class doc_generic_proposal_odt extends ModelePDFPropales
{
//print "srctemplatepath=".$srctemplatepath; // Src filename
$newfile=basename($srctemplatepath);
- $newfiletmp=preg_replace('/\.odt/i','',$newfile);
+ $newfiletmp=preg_replace('/\.od(t|s)/i','',$newfile);
$newfiletmp=preg_replace('/template_/i','',$newfiletmp);
$newfiletmp=preg_replace('/modele_/i','',$newfiletmp);
+
$newfiletmp=$objectref.'_'.$newfiletmp;
- //$file=$dir.'/'.$newfiletmp.'.'.dol_print_date(dol_now(),'%Y%m%d%H%M%S').'.odt';
- $file=$dir.'/'.$newfiletmp.'.odt';
+
+ // Get extension (ods or odt)
+ $newfileformat=substr($newfile, strrpos($newfile, '.')+1);
+ if ( ! empty($conf->global->MAIN_DOC_USE_TIMING))
+ {
+ $filename=$newfiletmp.'.'.dol_print_date(dol_now(),'%Y%m%d%H%M%S').'.'.$newfileformat;
+ }
+ else
+ {
+ $filename=$newfiletmp.'.'.$newfileformat;
+ }
+ $file=$dir.'/'.$filename;
//print "newdir=".$dir;
//print "newfile=".$newfile;
//print "file=".$file;
- //print "conf->societe->dir_temp=".$conf->societe->dir_temp;
+ //print "conf->propal->dir_temp=".$conf->propal->dir_temp;
dol_mkdir($conf->propal->dir_temp);
diff --git a/htdocs/core/modules/societe/doc/doc_generic_odt.modules.php b/htdocs/core/modules/societe/doc/doc_generic_odt.modules.php
index 6ab06aef2e9..d1f06c6f9ec 100644
--- a/htdocs/core/modules/societe/doc/doc_generic_odt.modules.php
+++ b/htdocs/core/modules/societe/doc/doc_generic_odt.modules.php
@@ -215,7 +215,7 @@ class doc_generic_odt extends ModeleThirdPartyDoc
$newfiletmp=preg_replace('/modele_/i','',$newfiletmp);
// Get extension (ods or odt)
$newfileformat=substr($newfile, strrpos($newfile, '.')+1);
- if ( ! empty($conf->global->MAIN_ODT_USE_TIMING))
+ if ( ! empty($conf->global->MAIN_DOC_USE_TIMING))
{
$filename=$newfiletmp.'.'.dol_print_date(dol_now(),'%Y%m%d%H%M%S').'.'.$newfileformat;
}
diff --git a/htdocs/fourn/class/fournisseur.commande.class.php b/htdocs/fourn/class/fournisseur.commande.class.php
index 39c729f91e4..5b3c9d6c8d3 100644
--- a/htdocs/fourn/class/fournisseur.commande.class.php
+++ b/htdocs/fourn/class/fournisseur.commande.class.php
@@ -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)
{
diff --git a/htdocs/fourn/class/fournisseur.facture.class.php b/htdocs/fourn/class/fournisseur.facture.class.php
index ac138636b08..06d5a64a8c8 100644
--- a/htdocs/fourn/class/fournisseur.facture.class.php
+++ b/htdocs/fourn/class/fournisseur.facture.class.php
@@ -155,7 +155,7 @@ class FactureFournisseur extends CommonInvoice
$sql.= ", ".$this->socid;
$sql.= ", '".$this->db->idate($now)."'";
$sql.= ", '".$this->db->idate($this->date)."'";
- $sql.= ", ".$this->fk_project;
+ $sql.= ", ".(isset($this->fk_project)?$this->fk_project:"null");
$sql.= ", '".$this->db->escape($this->note_private)."'";
$sql.= ", '".$this->db->escape($this->note_public)."'";
$sql.= ", ".$user->id.",";
@@ -167,14 +167,14 @@ class FactureFournisseur extends CommonInvoice
if ($resql)
{
$this->id = $this->db->last_insert_id(MAIN_DB_PREFIX.'facture_fourn');
-
- // Update ref with new one
- $this->ref='(PROV'.$this->id.')';
- $sql = 'UPDATE '.MAIN_DB_PREFIX."facture_fourn SET ref='".$this->ref."' WHERE rowid=".$this->id;
-
- dol_syslog(get_class($this)."::create sql=".$sql);
- $resql=$this->db->query($sql);
- if (! $resql) $error++;
+
+ // Update ref with new one
+ $this->ref='(PROV'.$this->id.')';
+ $sql = 'UPDATE '.MAIN_DB_PREFIX."facture_fourn SET ref='".$this->ref."' WHERE rowid=".$this->id;
+
+ dol_syslog(get_class($this)."::create sql=".$sql);
+ $resql=$this->db->query($sql);
+ if (! $resql) $error++;
// Add object linked
if (! $error && $this->id && ! empty($this->origin) && ! empty($this->origin_id))
@@ -1350,8 +1350,8 @@ class FactureFournisseur extends CommonInvoice
global $db, $langs, $conf;
$langs->load("orders");
- // Clean parameters (if not defined or using deprecated value)
- if (empty($conf->global->INVOICE_SUPPLIER_ADDON_NUMBER)) $conf->global->INVOICE_SUPPLIER_ADDON_NUMBER='mod_facture_fournisseur_cactus';
+ // Clean parameters (if not defined or using deprecated value)
+ if (empty($conf->global->INVOICE_SUPPLIER_ADDON_NUMBER)) $conf->global->INVOICE_SUPPLIER_ADDON_NUMBER='mod_facture_fournisseur_cactus';
$mybool=false;
@@ -1365,25 +1365,25 @@ class FactureFournisseur extends CommonInvoice
$mybool|=@include_once $dir.$file;
}
- if (! $mybool)
- {
- dol_print_error('',"Failed to include file ".$file);
- return '';
+ if (! $mybool)
+ {
+ dol_print_error('',"Failed to include file ".$file);
+ return '';
}
- $obj = new $classname();
-
- $numref = "";
- $numref = $obj->getNumRef($soc,$this,$mode);
-
- if ( $numref != "")
- {
- return $numref;
- }
- else
- {
- //dol_print_error($db,get_class($this)."::getNextNumRef ".$obj->error);
- return false;
+ $obj = new $classname();
+
+ $numref = "";
+ $numref = $obj->getNumRef($soc,$this,$mode);
+
+ if ( $numref != "")
+ {
+ return $numref;
+ }
+ else
+ {
+ //dol_print_error($db,get_class($this)."::getNextNumRef ".$obj->error);
+ return false;
}
}
diff --git a/htdocs/fourn/facture/fiche.php b/htdocs/fourn/facture/fiche.php
index f7ade7b3d62..d4010f6c495 100644
--- a/htdocs/fourn/facture/fiche.php
+++ b/htdocs/fourn/facture/fiche.php
@@ -270,16 +270,18 @@ elseif ($action == 'add' && $user->rights->fournisseur->facture->creer)
{
$db->begin();
+ $tmpproject = GETPOST('projectid', 'int');
+
// Creation facture
$object->ref = $_POST['ref'];
$object->ref_supplier = $_POST['ref_supplier'];
- $object->fk_project = GETPOST('projectid');
$object->socid = $_POST['socid'];
$object->libelle = $_POST['libelle'];
$object->date = $datefacture;
$object->date_echeance = $datedue;
$object->note_public = GETPOST('note_public');
$object->note_private = GETPOST('note_private');
+ $object->fk_project = ($tmpproject > 0) ? $tmpproject : null;
// If creation from another object of another module
if ($_POST['origin'] && $_POST['originid'])
diff --git a/htdocs/install/mysql/migration/3.3.0-3.4.0.sql b/htdocs/install/mysql/migration/3.3.0-3.4.0.sql
index acebc660662..8dbbad43832 100755
--- a/htdocs/install/mysql/migration/3.3.0-3.4.0.sql
+++ b/htdocs/install/mysql/migration/3.3.0-3.4.0.sql
@@ -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';
diff --git a/htdocs/install/repair.php b/htdocs/install/repair.php
index 24fb61dee4a..2751c963158 100644
--- a/htdocs/install/repair.php
+++ b/htdocs/install/repair.php
@@ -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
diff --git a/htdocs/langs/en_US/admin.lang b/htdocs/langs/en_US/admin.lang
index d569e0a261d..86bebcf2246 100644
--- a/htdocs/langs/en_US/admin.lang
+++ b/htdocs/langs/en_US/admin.lang
@@ -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 .lang text files into directory htdocs/langs and submit them on the forum at http://www.dolibarr.org.
MenuUseLayout=Make vertical menu hidable (option javascript must not be disabled)
diff --git a/htdocs/langs/es_ES/admin.lang b/htdocs/langs/es_ES/admin.lang
index fe4aeba479c..fc03d90c35a 100644
--- a/htdocs/langs/es_ES/admin.lang
+++ b/htdocs/langs/es_ES/admin.lang
@@ -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 .lang del directorio htdocs/langs y enviarlos al foro http://www.dolibarr.fr.
MenuUseLayout=Hacer el menú izquierdo ocultable (la opción javascript no debería deshabilitarse)
diff --git a/htdocs/langs/fr_FR/admin.lang b/htdocs/langs/fr_FR/admin.lang
index 1dbd9f6df48..f95367d66ac 100644
--- a/htdocs/langs/fr_FR/admin.lang
+++ b/htdocs/langs/fr_FR/admin.lang
@@ -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 .lang du répertoire htdocs/langs et les soumettre sur le forum à http://www.dolibarr.fr.
MenuUseLayout=Rendre le menu gauche cachable (L'option javascript ne doit pas avoir été désactivée)
diff --git a/htdocs/main.inc.php b/htdocs/main.inc.php
index bf09cdf80c2..965b6c747b2 100644
--- a/htdocs/main.inc.php
+++ b/htdocs/main.inc.php
@@ -297,7 +297,11 @@ if (! empty($_SESSION["disablemodules"]))
$disabled_modules=explode(',',$_SESSION["disablemodules"]);
foreach($disabled_modules as $module)
{
- if ($module) $conf->$module->enabled=false;
+ if ($module)
+ {
+ if (empty($conf->$module)) $conf->$module=new stdClass();
+ $conf->$module->enabled=false;
+ }
}
}
diff --git a/htdocs/product/admin/product_extrafields.php b/htdocs/product/admin/product_extrafields.php
index 69bc6f481b2..98b85746051 100755
--- a/htdocs/product/admin/product_extrafields.php
+++ b/htdocs/product/admin/product_extrafields.php
@@ -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();
diff --git a/htdocs/product/class/product.class.php b/htdocs/product/class/product.class.php
index 8cac5ebe573..88360e6ec1d 100644
--- a/htdocs/product/class/product.class.php
+++ b/htdocs/product/class/product.class.php
@@ -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)
{
diff --git a/htdocs/product/fiche.php b/htdocs/product/fiche.php
index df83afc6b7e..632540df203 100644
--- a/htdocs/product/fiche.php
+++ b/htdocs/product/fiche.php
@@ -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))
{
diff --git a/htdocs/projet/admin/project_extrafields.php b/htdocs/projet/admin/project_extrafields.php
index e397b7c7c1a..a23da939757 100755
--- a/htdocs/projet/admin/project_extrafields.php
+++ b/htdocs/projet/admin/project_extrafields.php
@@ -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();
diff --git a/htdocs/projet/class/project.class.php b/htdocs/projet/class/project.class.php
index 321936ad6a9..3dd0910f7f0 100644
--- a/htdocs/projet/class/project.class.php
+++ b/htdocs/projet/class/project.class.php
@@ -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
@@ -820,11 +833,11 @@ class Project extends CommonObject
{
// To verify role of users
$userAccess = 0;
- if (($mode == 'read' && $user->rights->projet->all->lire) || ($mode == 'write' && $user->rights->projet->all->creer) || ($mode == 'delete' && $user->rights->projet->all->supprimer))
+ if (($mode == 'read' && ! empty($user->rights->projet->all->lire)) || ($mode == 'write' && ! empty($user->rights->projet->all->creer)) || ($mode == 'delete' && ! empty($user->rights->projet->all->supprimer)))
{
$userAccess = 1;
}
- else if ($this->public && (($mode == 'read' && $user->rights->projet->lire) || ($mode == 'write' && $user->rights->projet->creer) || ($mode == 'delete' && $user->rights->projet->supprimer)))
+ else if ($this->public && (($mode == 'read' && ! empty($user->rights->projet->lire)) || ($mode == 'write' && ! empty($user->rights->projet->creer)) || ($mode == 'delete' && ! empty($user->rights->projet->supprimer))))
{
$userAccess = 1;
}
diff --git a/htdocs/projet/fiche.php b/htdocs/projet/fiche.php
index 7df49a38bd0..a9d3895879d 100644
--- a/htdocs/projet/fiche.php
+++ b/htdocs/projet/fiche.php
@@ -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'));;
diff --git a/htdocs/projet/index.php b/htdocs/projet/index.php
index 89aed92b99d..0cd8fd9ca64 100644
--- a/htdocs/projet/index.php
+++ b/htdocs/projet/index.php
@@ -31,7 +31,7 @@ require_once DOL_DOCUMENT_ROOT.'/core/lib/project.lib.php';
$langs->load("projects");
$langs->load("companies");
-$mine = $_REQUEST['mode']=='mine' ? 1 : 0;
+$mine = GETPOST('mode')=='mine' ? 1 : 0;
// Security check
$socid=0;
@@ -49,7 +49,7 @@ $sortorder = GETPOST("sortorder",'alpha');
$socstatic=new Societe($db);
$projectstatic=new Project($db);
-$projectsListId = $projectstatic->getProjectsAuthorizedForUser($user,($mine?$mine:($user->rights->projet->all->lire?2:0)),1);
+$projectsListId = $projectstatic->getProjectsAuthorizedForUser($user,($mine?$mine:(empty($user->rights->projet->all->lire)?0:2)),1);
//var_dump($projectsListId);
@@ -64,7 +64,7 @@ print_fiche_titre($text);
if ($mine) print $langs->trans("MyProjectsDesc").'
';
else
{
- if ($user->rights->projet->all->lire && ! $socid) print $langs->trans("ProjectsDesc").'
';
+ if (! empty($user->rights->projet->all->lire) && ! $socid) print $langs->trans("ProjectsDesc").'
';
else print $langs->trans("ProjectsPublicDesc").'
';
}
@@ -90,7 +90,7 @@ $sql.= ", s.nom, s.rowid as socid";
$sql.= " FROM ".MAIN_DB_PREFIX."projet as p";
$sql.= " LEFT JOIN ".MAIN_DB_PREFIX."societe as s on p.fk_soc = s.rowid";
$sql.= " WHERE p.entity = ".$conf->entity;
-if ($mine || ! $user->rights->projet->all->lire) $sql.= " AND p.rowid IN (".$projectsListId.")";
+if ($mine || empty($user->rights->projet->all->lire)) $sql.= " AND p.rowid IN (".$projectsListId.")";
if ($socid) $sql.= " AND (p.fk_soc IS NULL OR p.fk_soc = 0 OR p.fk_soc = ".$socid.")";
$sql.= " GROUP BY s.nom, s.rowid";
diff --git a/htdocs/projet/tasks.php b/htdocs/projet/tasks.php
index d9530f2d232..b79bb65ed74 100644
--- a/htdocs/projet/tasks.php
+++ b/htdocs/projet/tasks.php
@@ -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";
diff --git a/htdocs/projet/tasks/task.php b/htdocs/projet/tasks/task.php
index 977858cf35b..275f54c5c44 100644
--- a/htdocs/projet/tasks/task.php
+++ b/htdocs/projet/tasks/task.php
@@ -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
*/
diff --git a/htdocs/public/demo/index.php b/htdocs/public/demo/index.php
index 1c03c17c5b5..f4acea385ea 100644
--- a/htdocs/public/demo/index.php
+++ b/htdocs/public/demo/index.php
@@ -38,48 +38,55 @@ global $dolibarr_main_demo;
if (empty($dolibarr_main_demo)) accessforbidden('Parameter dolibarr_main_demo must be defined in conf file with value "default login,default pass" to enable the demo entry page',1,1,1);
// Initialize technical object to manage hooks of thirdparties. Note that conf->hooks_modules contains array array
-$hookmanager->initHooks(array('demo'));
-
-$demoprofiles=array(
- array('default'=>'1', 'key'=>'profdemoservonly','label'=>'DemoCompanyServiceOnly',
- 'disablemodules'=>'adherent,barcode,boutique,cashdesk,categorie,don,expedition,externalsite,mailmanspip,margin,prelevement,product,stock',
- 'icon'=>DOL_URL_ROOT.'/public/demo/dolibarr_screenshot8.png'),
- array('default'=>'-1','key'=>'profdemoshopwithdesk','label'=>'DemoCompanyShopWithCashDesk',
- 'disablemodules'=>'adherent,boutique,categorie,don,externalsite,ficheinter,mailmanspip,prelevement,product,stock',
- 'icon'=>DOL_URL_ROOT.'/public/demo/dolibarr_screenshot2.png'),
- array('default'=>'0', 'key'=>'profdemoprodstock','label'=>'DemoCompanyProductAndStocks',
- 'disablemodules'=>'adherent,boutique,contrat,categorie,don,externalsite,ficheinter,mailmanspip,prelevement,service',
- 'icon'=>DOL_URL_ROOT.'/public/demo/dolibarr_screenshot2.png'),
- array('default'=>'0', 'key'=>'profdemoall','label'=>'DemoCompanyAll',
- 'disablemodules'=>'adherent,boutique,don,externalsite,mailmanspip',
- 'icon'=>DOL_URL_ROOT.'/public/demo/dolibarr_screenshot9.png'),
- array('default'=>'-1', 'key'=>'profdemofun','label'=>'DemoFundation',
- 'disablemodules'=>'banque,barcode,boutique,cashdesk,commande,commercial,compta,comptabilite,contrat,expedition,externalsite,facture,ficheinter,fournisseur,mailmanspip,margin,prelevement,product,projet,propal,propale,service,societe,stock,tax',
- 'icon'=>DOL_URL_ROOT.'/public/demo/dolibarr_screenshot6.png'),
- array('default'=>'0', 'key'=>'profdemofun2','label'=>'DemoFundation2',
- 'disablemodules'=>'barcode,boutique,cashdesk,commande,commercial,compta,comptabilite,contrat,expedition,externalsite,facture,ficheinter,fournisseur,mailmanspip,margin,prelevement,product,projet,propal,propale,service,societe,stock,tax',
- 'icon'=>DOL_URL_ROOT.'/public/demo/dolibarr_screenshot6.png')
-);
+$res=$hookmanager->initHooks(array('demo'));
+$demoprofiles=array();
+$alwayscheckedmodules=array();
+$alwaysuncheckedmodules=array();
+$alwayshiddencheckedmodules=array();
+$alwayshiddenuncheckedmodules=array();
$tmpaction = 'view';
$parameters=array();
$object=new stdClass();
$reshook=$hookmanager->executeHooks('addDemoProfile', $parameters, $object, $tmpaction); // Note that $action and $object may have been modified by some hooks
$error=$hookmanager->error; $errors=$hookmanager->errors;
-
-// Visible
-$alwayscheckedmodules=array('barcode','bookmark','externalrss','fckeditor','geoipmaxmind','gravatar','memcached','syslog','user','webservices'); // Technical module we always want
-$alwaysuncheckedmodules=array('paybox','paypal','google','scanner','workflow'); // Module we never want
-// Not visible
-$alwayshiddencheckedmodules=array('accounting','barcode','bookmark','clicktodial','comptabilite','document','domain','externalrss','externalsite','fckeditor','geoipmaxmind','gravatar','label','ldap',
- 'mailmanspip','notification','syslog','user','webservices',
- // Extended modules
- 'memcached','numberwords','zipautofillfr');
-$alwayshiddenuncheckedmodules=array('boutique','ftp',
- // Extended modules
- 'awstats','bittorrent','bootstrap','cabinetmed','cmcic','concatpdf','customfield','dolicloud','filemanager','lightbox','mantis','monitoring','moretemplates','multicompany','nltechno','numberingpack','openstreetmap',
- 'ovh','phenix','phpsysinfo','pibarcode','postnuke','selectbank','skincoloreditor','submiteverywhere','survey','thomsonphonebook','topten','tvacerfa','voyage','webcalendar','webmail');
+if (empty($reshook))
+{
+ $demoprofiles=array(
+ array('default'=>'1', 'key'=>'profdemoservonly','label'=>'DemoCompanyServiceOnly',
+ 'disablemodules'=>'adherent,barcode,boutique,cashdesk,categorie,don,expedition,externalsite,mailmanspip,margin,prelevement,product,stock',
+ 'icon'=>DOL_URL_ROOT.'/public/demo/dolibarr_screenshot8.png'),
+ array('default'=>'-1','key'=>'profdemoshopwithdesk','label'=>'DemoCompanyShopWithCashDesk',
+ 'disablemodules'=>'adherent,boutique,categorie,don,externalsite,ficheinter,mailmanspip,prelevement,product,stock',
+ 'icon'=>DOL_URL_ROOT.'/public/demo/dolibarr_screenshot2.png'),
+ array('default'=>'0', 'key'=>'profdemoprodstock','label'=>'DemoCompanyProductAndStocks',
+ 'disablemodules'=>'adherent,boutique,contrat,categorie,don,externalsite,ficheinter,mailmanspip,prelevement,service',
+ 'icon'=>DOL_URL_ROOT.'/public/demo/dolibarr_screenshot2.png'),
+ array('default'=>'0', 'key'=>'profdemoall','label'=>'DemoCompanyAll',
+ 'disablemodules'=>'adherent,boutique,don,externalsite,mailmanspip',
+ 'icon'=>DOL_URL_ROOT.'/public/demo/dolibarr_screenshot9.png'),
+ array('default'=>'-1', 'key'=>'profdemofun','label'=>'DemoFundation',
+ 'disablemodules'=>'banque,barcode,boutique,cashdesk,commande,commercial,compta,comptabilite,contrat,expedition,externalsite,facture,ficheinter,fournisseur,mailmanspip,margin,prelevement,product,projet,propal,propale,service,societe,stock,tax',
+ 'icon'=>DOL_URL_ROOT.'/public/demo/dolibarr_screenshot6.png'),
+ array('default'=>'0', 'key'=>'profdemofun2','label'=>'DemoFundation2',
+ 'disablemodules'=>'barcode,boutique,cashdesk,commande,commercial,compta,comptabilite,contrat,expedition,externalsite,facture,ficheinter,fournisseur,mailmanspip,margin,prelevement,product,projet,propal,propale,service,societe,stock,tax',
+ 'icon'=>DOL_URL_ROOT.'/public/demo/dolibarr_screenshot6.png')
+ );
+
+ // Visible
+ $alwayscheckedmodules=array('barcode','bookmark','externalrss','fckeditor','geoipmaxmind','gravatar','memcached','syslog','user','webservices'); // Technical module we always want
+ $alwaysuncheckedmodules=array('paybox','paypal','google','scanner','workflow'); // Module we never want
+ // Not visible
+ $alwayshiddencheckedmodules=array('accounting','barcode','bookmark','clicktodial','comptabilite','document','domain','externalrss','externalsite','fckeditor','geoipmaxmind','gravatar','label','ldap',
+ 'mailmanspip','notification','syslog','user','webservices',
+ // Extended modules
+ 'memcached','numberwords','zipautofillfr');
+ $alwayshiddenuncheckedmodules=array('boutique','ftp',
+ // Extended modules
+ 'awstats','bittorrent','bootstrap','cabinetmed','cmcic','concatpdf','customfield','dolicloud','filemanager','lightbox','mantis','monitoring','moretemplates','multicompany','nltechno','numberingpack','openstreetmap',
+ 'ovh','phenix','phpsysinfo','pibarcode','postnuke','selectbank','skincoloreditor','submiteverywhere','survey','thomsonphonebook','topten','tvacerfa','voyage','webcalendar','webmail');
+}
// Search modules
$dirlist=$conf->file->dol_document_root;
@@ -151,8 +158,8 @@ foreach ($modulesdir as $dir)
// We discard modules according to features level (PS: if module is activated we always show it)
$const_name = 'MAIN_MODULE_'.strtoupper(preg_replace('/^mod/i','',get_class($objMod)));
- if ($objMod->version == 'development' && $conf->global->MAIN_FEATURES_LEVEL < 2 && ! $conf->global->$const_name) $modulequalified=0;
- if ($objMod->version == 'experimental' && $conf->global->MAIN_FEATURES_LEVEL < 1 && ! $conf->global->$const_name) $modulequalified=0;
+ if ($objMod->version == 'development' && $conf->global->MAIN_FEATURES_LEVEL < 2 && empty($conf->global->$const_name)) $modulequalified=0;
+ if ($objMod->version == 'experimental' && $conf->global->MAIN_FEATURES_LEVEL < 1 && empty($conf->global->$const_name)) $modulequalified=0;
if ($modulequalified)
{
diff --git a/htdocs/public/members/new.php b/htdocs/public/members/new.php
index b8d763748f2..358201aa4a7 100644
--- a/htdocs/public/members/new.php
+++ b/htdocs/public/members/new.php
@@ -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"));
diff --git a/htdocs/public/members/public_card.php b/htdocs/public/members/public_card.php
index d250b838386..0fc725c8ed4 100644
--- a/htdocs/public/members/public_card.php
+++ b/htdocs/public/members/public_card.php
@@ -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);
diff --git a/htdocs/societe/admin/contact_extrafields.php b/htdocs/societe/admin/contact_extrafields.php
index a2460c6cda4..36adc4f38b2 100755
--- a/htdocs/societe/admin/contact_extrafields.php
+++ b/htdocs/societe/admin/contact_extrafields.php
@@ -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();
diff --git a/htdocs/societe/admin/societe_extrafields.php b/htdocs/societe/admin/societe_extrafields.php
index 11cb02e80ae..15ccdac8ef7 100755
--- a/htdocs/societe/admin/societe_extrafields.php
+++ b/htdocs/societe/admin/societe_extrafields.php
@@ -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();
diff --git a/htdocs/societe/class/societe.class.php b/htdocs/societe/class/societe.class.php
index e630dbf899d..0ea3253bdd1 100644
--- a/htdocs/societe/class/societe.class.php
+++ b/htdocs/societe/class/societe.class.php
@@ -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
@@ -2770,7 +2766,7 @@ class Societe extends CommonObject
*/
function getLibCustProspStatut()
{
- return $this->LibCustProspStatut($this->client,$mode);
+ return $this->LibCustProspStatut($this->client);
}
/**
@@ -2791,4 +2787,4 @@ class Societe extends CommonObject
}
-}
\ No newline at end of file
+}
diff --git a/htdocs/societe/soc.php b/htdocs/societe/soc.php
index 24db1206917..518a511b183 100644
--- a/htdocs/societe/soc.php
+++ b/htdocs/societe/soc.php
@@ -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);
diff --git a/htdocs/user/admin/user_extrafields.php b/htdocs/user/admin/user_extrafields.php
index 8b4bc780cbf..83878126858 100644
--- a/htdocs/user/admin/user_extrafields.php
+++ b/htdocs/user/admin/user_extrafields.php
@@ -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();
diff --git a/htdocs/user/class/usergroup.class.php b/htdocs/user/class/usergroup.class.php
index 69d7855b8d3..8da493de97e 100644
--- a/htdocs/user/class/usergroup.class.php
+++ b/htdocs/user/class/usergroup.class.php
@@ -174,7 +174,7 @@ class UserGroup extends CommonObject
}
/**
- * Return array of users id for group
+ * Return array of users id for group this->id (or all if this->id not defined)
*
* @param string $excludefilter Filter to exclude
* @return array Array of users
@@ -214,8 +214,10 @@ class UserGroup extends CommonObject
$newuser->fetch($obj->rowid);
$ret[$obj->rowid]=$newuser;
}
-
- $ret[$obj->rowid]->usergroup_entity[]=$obj->usergroup_entity;
+ if (! empty($obj->usergroup_entity))
+ {
+ $ret[$obj->rowid]->usergroup_entity[]=$obj->usergroup_entity;
+ }
}
$this->db->free($resql);
diff --git a/htdocs/user/fiche.php b/htdocs/user/fiche.php
index db957d219e6..7769a9da06c 100644
--- a/htdocs/user/fiche.php
+++ b/htdocs/user/fiche.php
@@ -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"));
diff --git a/htdocs/webservices/server_contact.php b/htdocs/webservices/server_contact.php
index c10c4183468..08d21d5cba2 100644
--- a/htdocs/webservices/server_contact.php
+++ b/htdocs/webservices/server_contact.php
@@ -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;
diff --git a/htdocs/webservices/server_thirdparty.php b/htdocs/webservices/server_thirdparty.php
index 448da44ece2..a8ef028a9c8 100755
--- a/htdocs/webservices/server_thirdparty.php
+++ b/htdocs/webservices/server_thirdparty.php
@@ -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;
diff --git a/htdocs/webservices/server_user.php b/htdocs/webservices/server_user.php
index 5b644b150bf..3a7d0a89283 100644
--- a/htdocs/webservices/server_user.php
+++ b/htdocs/webservices/server_user.php
@@ -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;