commit
2726cb13d3
@ -28,6 +28,7 @@ require_once("../master.inc.php");
|
|||||||
require_once(NUSOAP_PATH.'/nusoap.php'); // Include SOAP
|
require_once(NUSOAP_PATH.'/nusoap.php'); // Include SOAP
|
||||||
require_once(DOL_DOCUMENT_ROOT."/core/lib/ws.lib.php");
|
require_once(DOL_DOCUMENT_ROOT."/core/lib/ws.lib.php");
|
||||||
require_once(DOL_DOCUMENT_ROOT."/contact/class/contact.class.php");
|
require_once(DOL_DOCUMENT_ROOT."/contact/class/contact.class.php");
|
||||||
|
require_once DOL_DOCUMENT_ROOT.'/core/class/extrafields.class.php';
|
||||||
|
|
||||||
|
|
||||||
dol_syslog("Call Contact webservices interfaces");
|
dol_syslog("Call Contact webservices interfaces");
|
||||||
@ -80,14 +81,7 @@ $server->wsdl->addComplexType(
|
|||||||
)
|
)
|
||||||
);
|
);
|
||||||
|
|
||||||
// Define other specific objects
|
$contact_fields = array(
|
||||||
$server->wsdl->addComplexType(
|
|
||||||
'contact',
|
|
||||||
'complexType',
|
|
||||||
'struct',
|
|
||||||
'all',
|
|
||||||
'',
|
|
||||||
array(
|
|
||||||
'id' => array('name'=>'id','type'=>'xsd:string'),
|
'id' => array('name'=>'id','type'=>'xsd:string'),
|
||||||
'lastname' => array('name'=>'lastname','type'=>'xsd:string'),
|
'lastname' => array('name'=>'lastname','type'=>'xsd:string'),
|
||||||
'firstname' => array('name'=>'firstname','type'=>'xsd:string'),
|
'firstname' => array('name'=>'firstname','type'=>'xsd:string'),
|
||||||
@ -102,6 +96,10 @@ $server->wsdl->addComplexType(
|
|||||||
'country' => array('name'=>'country','type'=>'xsd:string'),
|
'country' => array('name'=>'country','type'=>'xsd:string'),
|
||||||
'socid' => array('name'=>'socid','type'=>'xsd:string'),
|
'socid' => array('name'=>'socid','type'=>'xsd:string'),
|
||||||
'status' => array('name'=>'status','type'=>'xsd:string'),
|
'status' => array('name'=>'status','type'=>'xsd:string'),
|
||||||
|
'phone_pro' => array('name'=>'phone_pro','type'=>'xsd:string'),
|
||||||
|
'fax' => array('name'=>'fax','type'=>'xsd:string'),
|
||||||
|
'phone_perso' => array('name'=>'phone_perso','type'=>'xsd:string'),
|
||||||
|
'phone_mobile' => array('name'=>'phone_mobile','type'=>'xsd:string'),
|
||||||
'code' => array('name'=>'code','type'=>'xsd:string'),
|
'code' => array('name'=>'code','type'=>'xsd:string'),
|
||||||
'email' => array('name'=>'email','type'=>'xsd:string'),
|
'email' => array('name'=>'email','type'=>'xsd:string'),
|
||||||
'birthday' => array('name'=>'birthday','type'=>'xsd:string'),
|
'birthday' => array('name'=>'birthday','type'=>'xsd:string'),
|
||||||
@ -116,7 +114,33 @@ $server->wsdl->addComplexType(
|
|||||||
'user_login' => array('name'=>'user_login','type'=>'xsd:string'),
|
'user_login' => array('name'=>'user_login','type'=>'xsd:string'),
|
||||||
'civility_id' => array('name'=>'civility_id','type'=>'xsd:string')
|
'civility_id' => array('name'=>'civility_id','type'=>'xsd:string')
|
||||||
//...
|
//...
|
||||||
)
|
);
|
||||||
|
//Retreive all extrafield for contact
|
||||||
|
// fetch optionals attributes and labels
|
||||||
|
$extrafields=new ExtraFields($db);
|
||||||
|
$extralabels=$extrafields->fetch_name_optionals_label('contact',true);
|
||||||
|
if (count($extrafields)>0) {
|
||||||
|
$extrafield_array = array();
|
||||||
|
}
|
||||||
|
foreach($extrafields->attribute_label as $key=>$label)
|
||||||
|
{
|
||||||
|
$type =$extrafields->attribute_type[$key];
|
||||||
|
if ($type=='date' || $type=='datetime') {$type='xsd:dateTime';}
|
||||||
|
else {$type='xsd:string';}
|
||||||
|
|
||||||
|
$extrafield_array['options_'.$key]=array('name'=>'options_'.$key,'type'=>$type);
|
||||||
|
}
|
||||||
|
|
||||||
|
$contact_fields=array_merge($contact_fields,$extrafield_array);
|
||||||
|
|
||||||
|
// Define other specific objects
|
||||||
|
$server->wsdl->addComplexType(
|
||||||
|
'contact',
|
||||||
|
'complexType',
|
||||||
|
'struct',
|
||||||
|
'all',
|
||||||
|
'',
|
||||||
|
$contact_fields
|
||||||
);
|
);
|
||||||
|
|
||||||
$server->wsdl->addComplexType(
|
$server->wsdl->addComplexType(
|
||||||
@ -223,16 +247,13 @@ function getContact($authentication,$id,$ref='',$ref_ext='')
|
|||||||
{
|
{
|
||||||
$fuser->getrights();
|
$fuser->getrights();
|
||||||
|
|
||||||
if ($fuser->rights->contact->read)
|
if ($fuser->rights->societe->contact->lire )
|
||||||
{
|
{
|
||||||
$contact=new Contact($db);
|
$contact=new Contact($db);
|
||||||
$result=$contact->fetch($id,$ref,$ref_ext);
|
$result=$contact->fetch($id,$ref,$ref_ext);
|
||||||
if ($result > 0)
|
if ($result > 0)
|
||||||
{
|
{
|
||||||
// Create
|
$contact_result_fields =array(
|
||||||
$objectresp = array(
|
|
||||||
'result'=>array('result_code'=>'OK', 'result_label'=>''),
|
|
||||||
'contact'=>array(
|
|
||||||
'id' => $contact->id,
|
'id' => $contact->id,
|
||||||
'lastname' => $contact->lastname,
|
'lastname' => $contact->lastname,
|
||||||
'firstname' => $contact->firstname,
|
'firstname' => $contact->firstname,
|
||||||
@ -247,6 +268,10 @@ function getContact($authentication,$id,$ref='',$ref_ext='')
|
|||||||
'country' => $contact->country,
|
'country' => $contact->country,
|
||||||
'socid' => $contact->socid,
|
'socid' => $contact->socid,
|
||||||
'status' => $contact->status,
|
'status' => $contact->status,
|
||||||
|
'phone_pro' => $contact->phone_pro,
|
||||||
|
'fax' => $contact->fax,
|
||||||
|
'phone_perso' => $contact->phone_perso,
|
||||||
|
'phone_mobile' => $contact->phone_mobile,
|
||||||
'code' => $contact->code,
|
'code' => $contact->code,
|
||||||
'email' => $contact->email,
|
'email' => $contact->email,
|
||||||
'birthday' => $contact->birthday,
|
'birthday' => $contact->birthday,
|
||||||
@ -260,7 +285,25 @@ function getContact($authentication,$id,$ref='',$ref_ext='')
|
|||||||
'user_id' => $contact->user_id,
|
'user_id' => $contact->user_id,
|
||||||
'user_login' => $contact->user_login,
|
'user_login' => $contact->user_login,
|
||||||
'civility_id' => $contact->civility_id
|
'civility_id' => $contact->civility_id
|
||||||
)
|
);
|
||||||
|
|
||||||
|
//Retreive all extrafield for thirdsparty
|
||||||
|
// fetch optionals attributes and labels
|
||||||
|
$extrafields=new ExtraFields($db);
|
||||||
|
$extralabels=$extrafields->fetch_name_optionals_label('contact',true);
|
||||||
|
//Get extrafield values
|
||||||
|
$contact->fetch_optionals($contact->id,$extralabels);
|
||||||
|
|
||||||
|
foreach($extrafields->attribute_label as $key=>$label)
|
||||||
|
{
|
||||||
|
$contact_result_fields=array_merge($contact_result_fields,array('options_'.$key => $contact->array_options['options_'.$key]));
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
// Create
|
||||||
|
$objectresp = array(
|
||||||
|
'result'=>array('result_code'=>'OK', 'result_label'=>''),
|
||||||
|
'contact'=>$contact_result_fields
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
@ -334,6 +377,10 @@ function createContact($authentication,$contact)
|
|||||||
$newobject->country=$contact['country'];
|
$newobject->country=$contact['country'];
|
||||||
$newobject->socid=$contact['socid'];
|
$newobject->socid=$contact['socid'];
|
||||||
$newobject->status=$contact['status'];
|
$newobject->status=$contact['status'];
|
||||||
|
$newobject->phone_pro=$contact['phone_pro'];
|
||||||
|
$newobject->fax=$contact['fax'];
|
||||||
|
$newobject->phone_perso=$contact['phone_perso'];
|
||||||
|
$newobject->phone_mobile=$contact['phone_mobile'];
|
||||||
$newobject->code=$contact['code'];
|
$newobject->code=$contact['code'];
|
||||||
$newobject->email=$contact['email'];
|
$newobject->email=$contact['email'];
|
||||||
$newobject->birthday=$contact['birthday'];
|
$newobject->birthday=$contact['birthday'];
|
||||||
@ -347,6 +394,17 @@ function createContact($authentication,$contact)
|
|||||||
$newobject->user_id=$contact['user_id'];
|
$newobject->user_id=$contact['user_id'];
|
||||||
$newobject->user_login=$contact['user_login'];
|
$newobject->user_login=$contact['user_login'];
|
||||||
|
|
||||||
|
//Retreive all extrafield for thirdsparty
|
||||||
|
// fetch optionals attributes and labels
|
||||||
|
$extrafields=new ExtraFields($db);
|
||||||
|
$extralabels=$extrafields->fetch_name_optionals_label('contact',true);
|
||||||
|
foreach($extrafields->attribute_label as $key=>$label)
|
||||||
|
{
|
||||||
|
$key='options_'.$key;
|
||||||
|
$newobject->array_options[$key]=$contact[$key];
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
//...
|
//...
|
||||||
|
|
||||||
|
|||||||
@ -30,6 +30,7 @@ require_once DOL_DOCUMENT_ROOT.'/core/lib/ws.lib.php';
|
|||||||
require_once DOL_DOCUMENT_ROOT.'/user/class/user.class.php';
|
require_once DOL_DOCUMENT_ROOT.'/user/class/user.class.php';
|
||||||
require_once DOL_DOCUMENT_ROOT.'/contact/class/contact.class.php';
|
require_once DOL_DOCUMENT_ROOT.'/contact/class/contact.class.php';
|
||||||
require_once DOL_DOCUMENT_ROOT.'/core/lib/security2.lib.php';
|
require_once DOL_DOCUMENT_ROOT.'/core/lib/security2.lib.php';
|
||||||
|
require_once DOL_DOCUMENT_ROOT.'/core/class/extrafields.class.php';
|
||||||
|
|
||||||
|
|
||||||
dol_syslog("Call User webservices interfaces");
|
dol_syslog("Call User webservices interfaces");
|
||||||
@ -150,14 +151,7 @@ $server->wsdl->addComplexType(
|
|||||||
),
|
),
|
||||||
'tns:group'
|
'tns:group'
|
||||||
);
|
);
|
||||||
|
$thirdpartywithuser_fields = array(
|
||||||
$server->wsdl->addComplexType(
|
|
||||||
'thirdpartywithuser',
|
|
||||||
'complexType',
|
|
||||||
'struct',
|
|
||||||
'all',
|
|
||||||
'',
|
|
||||||
array(
|
|
||||||
// For thirdparty and contact
|
// For thirdparty and contact
|
||||||
'name' => array('name'=>'name','type'=>'xsd:string'),
|
'name' => array('name'=>'name','type'=>'xsd:string'),
|
||||||
'firstname' => array('name'=>'firstname','type'=>'xsd:string'),
|
'firstname' => array('name'=>'firstname','type'=>'xsd:string'),
|
||||||
@ -171,6 +165,7 @@ $server->wsdl->addComplexType(
|
|||||||
'country_id' => array('name'=>'country_id','type'=>'xsd:string'),
|
'country_id' => array('name'=>'country_id','type'=>'xsd:string'),
|
||||||
'country_code' => array('name'=>'country_code','type'=>'xsd:string'),
|
'country_code' => array('name'=>'country_code','type'=>'xsd:string'),
|
||||||
'phone' => array('name'=>'phone','type'=>'xsd:string'),
|
'phone' => array('name'=>'phone','type'=>'xsd:string'),
|
||||||
|
'phone_mobile' => array('name'=>'phone_mobile','type'=>'xsd:string'),
|
||||||
'fax' => array('name'=>'fax','type'=>'xsd:string'),
|
'fax' => array('name'=>'fax','type'=>'xsd:string'),
|
||||||
'email' => array('name'=>'email','type'=>'xsd:string'),
|
'email' => array('name'=>'email','type'=>'xsd:string'),
|
||||||
'url' => array('name'=>'url','type'=>'xsd:string'),
|
'url' => array('name'=>'url','type'=>'xsd:string'),
|
||||||
@ -186,7 +181,34 @@ $server->wsdl->addComplexType(
|
|||||||
// For user
|
// For user
|
||||||
'login' => array('name'=>'login','type'=>'xsd:string'),
|
'login' => array('name'=>'login','type'=>'xsd:string'),
|
||||||
'password' => array('name'=>'password','type'=>'xsd:string')
|
'password' => array('name'=>'password','type'=>'xsd:string')
|
||||||
)
|
);
|
||||||
|
|
||||||
|
//Retreive all extrafield for contact
|
||||||
|
// fetch optionals attributes and labels
|
||||||
|
$extrafields=new ExtraFields($db);
|
||||||
|
$extralabels=$extrafields->fetch_name_optionals_label('contact',true);
|
||||||
|
if (count($extrafields)>0) {
|
||||||
|
$extrafield_array = array();
|
||||||
|
}
|
||||||
|
foreach($extrafields->attribute_label as $key=>$label)
|
||||||
|
{
|
||||||
|
$type =$extrafields->attribute_type[$key];
|
||||||
|
if ($type=='date' || $type=='datetime') {$type='xsd:dateTime';}
|
||||||
|
else {$type='xsd:string';}
|
||||||
|
|
||||||
|
$extrafield_array['contact_options_'.$key]=array('name'=>'contact_options_'.$key,'type'=>$type);
|
||||||
|
}
|
||||||
|
|
||||||
|
$thirdpartywithuser_fields=array_merge($thirdpartywithuser_fields,$extrafield_array);
|
||||||
|
|
||||||
|
|
||||||
|
$server->wsdl->addComplexType(
|
||||||
|
'thirdpartywithuser',
|
||||||
|
'complexType',
|
||||||
|
'struct',
|
||||||
|
'all',
|
||||||
|
'',
|
||||||
|
$thirdpartywithuser_fields
|
||||||
);
|
);
|
||||||
|
|
||||||
|
|
||||||
@ -521,10 +543,22 @@ function CreateUserFromThirdparty($authentication,$thirdpartywithuser)
|
|||||||
$contact->zip = $thirdparty->zip;
|
$contact->zip = $thirdparty->zip;
|
||||||
$contact->town = $thirdparty->town;
|
$contact->town = $thirdparty->town;
|
||||||
$contact->email = $thirdparty->email;
|
$contact->email = $thirdparty->email;
|
||||||
$contact->phone_pro = $thirdparty->tel;
|
$contact->phone_pro = $thirdparty->phone;
|
||||||
$contact->phone_mobile = $thirdparty->phone_mobile;
|
$contact->phone_mobile = $thirdpartywithuser['phone_mobile'];
|
||||||
$contact->fax = $thirdparty->fax;
|
$contact->fax = $thirdparty->fax;
|
||||||
|
|
||||||
|
//Retreive all extrafield for thirdsparty
|
||||||
|
// fetch optionals attributes and labels
|
||||||
|
$extrafields=new ExtraFields($db);
|
||||||
|
$extralabels=$extrafields->fetch_name_optionals_label('contact',true);
|
||||||
|
foreach($extrafields->attribute_label as $key=>$label)
|
||||||
|
{
|
||||||
|
$key='contact_options_'.$key;
|
||||||
|
$contact->array_options[$key]=$thirdpartywithuser[$key];
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
$contact_id = $contact->create($fuser);
|
$contact_id = $contact->create($fuser);
|
||||||
|
|
||||||
if ($contact_id > 0)
|
if ($contact_id > 0)
|
||||||
|
|||||||
Loading…
Reference in New Issue
Block a user