23if (!defined(
'NOCSRFCHECK')) {
24 define(
'NOCSRFCHECK',
'1');
26if (!defined(
'NOTOKENRENEWAL')) {
27 define(
'NOTOKENRENEWAL',
'1');
29if (!defined(
'NOREQUIREMENU')) {
30 define(
'NOREQUIREMENU',
'1');
32if (!defined(
'NOREQUIREHTML')) {
33 define(
'NOREQUIREHTML',
'1');
35if (!defined(
'NOREQUIREAJAX')) {
36 define(
'NOREQUIREAJAX',
'1');
38if (!defined(
"NOLOGIN")) {
39 define(
"NOLOGIN",
'1');
41if (!defined(
"NOSESSION")) {
42 define(
"NOSESSION",
'1');
45require
'../main.inc.php';
46require_once NUSOAP_PATH.
'/nusoap.php';
47require_once DOL_DOCUMENT_ROOT.
'/core/lib/ws.lib.php';
48require_once DOL_DOCUMENT_ROOT.
'/user/class/user.class.php';
50require_once DOL_DOCUMENT_ROOT.
'/societe/class/societe.class.php';
51require_once DOL_DOCUMENT_ROOT.
'/core/class/extrafields.class.php';
54dol_syslog(
"Call Dolibarr webservices interfaces");
59if (empty($conf->global->MAIN_MODULE_WEBSERVICES)) {
60 $langs->load(
"admin");
61 dol_syslog(
"Call Dolibarr webservices interfaces with module webservices disabled");
62 print $langs->trans(
"WarningModuleNotActive",
'WebServices').
'.<br><br>';
63 print $langs->trans(
"ToActivateModule");
68$server =
new nusoap_server();
69$server->soap_defencoding =
'UTF-8';
70$server->decode_utf8 =
false;
71$ns =
'http://www.dolibarr.org/ns/';
72$server->configureWSDL(
'WebServicesDolibarrThirdParty', $ns);
73$server->wsdl->schemaTargetNamespace = $ns;
77$server->wsdl->addComplexType(
84 'dolibarrkey' => array(
'name'=>
'dolibarrkey',
'type'=>
'xsd:string'),
85 'sourceapplication' => array(
'name'=>
'sourceapplication',
'type'=>
'xsd:string'),
86 'login' => array(
'name'=>
'login',
'type'=>
'xsd:string'),
87 'password' => array(
'name'=>
'password',
'type'=>
'xsd:string'),
88 'entity' => array(
'name'=>
'entity',
'type'=>
'xsd:string'),
92$server->wsdl->addComplexType(
99 'result_code' => array(
'name'=>
'result_code',
'type'=>
'xsd:string'),
100 'result_label' => array(
'name'=>
'result_label',
'type'=>
'xsd:string'),
105$thirdparty_fields = array(
106 'id' => array(
'name'=>
'id',
'type'=>
'xsd:string'),
107 'ref' => array(
'name'=>
'name',
'type'=>
'xsd:string'),
108 'ref_ext' => array(
'name'=>
'ref_ext',
'type'=>
'xsd:string'),
109 'fk_user_author' => array(
'name'=>
'fk_user_author',
'type'=>
'xsd:string'),
110 'status' => array(
'name'=>
'status',
'type'=>
'xsd:string'),
111 'client' => array(
'name'=>
'client',
'type'=>
'xsd:string'),
112 'supplier' => array(
'name'=>
'supplier',
'type'=>
'xsd:string'),
113 'customer_code' => array(
'name'=>
'customer_code',
'type'=>
'xsd:string'),
114 'supplier_code' => array(
'name'=>
'supplier_code',
'type'=>
'xsd:string'),
115 'customer_code_accountancy' => array(
'name'=>
'customer_code_accountancy',
'type'=>
'xsd:string'),
116 'supplier_code_accountancy' => array(
'name'=>
'supplier_code_accountancy',
'type'=>
'xsd:string'),
117 'date_creation' => array(
'name'=>
'date_creation',
'type'=>
'xsd:dateTime'),
118 'date_modification' => array(
'name'=>
'date_modification',
'type'=>
'xsd:dateTime'),
119 'note_private' => array(
'name'=>
'note_private',
'type'=>
'xsd:string'),
120 'note_public' => array(
'name'=>
'note_public',
'type'=>
'xsd:string'),
121 'address' => array(
'name'=>
'address',
'type'=>
'xsd:string'),
122 'zip' => array(
'name'=>
'zip',
'type'=>
'xsd:string'),
123 'town' => array(
'name'=>
'town',
'type'=>
'xsd:string'),
124 'region_code' => array(
'name'=>
'region_code',
'type'=>
'xsd:string'),
125 'country_id' => array(
'name'=>
'country_id',
'type'=>
'xsd:string'),
126 'country_code' => array(
'name'=>
'country_code',
'type'=>
'xsd:string'),
127 'country' => array(
'name'=>
'country',
'type'=>
'xsd:string'),
128 'phone' => array(
'name'=>
'phone',
'type'=>
'xsd:string'),
129 'fax' => array(
'name'=>
'fax',
'type'=>
'xsd:string'),
130 'email' => array(
'name'=>
'email',
'type'=>
'xsd:string'),
131 'url' => array(
'name'=>
'url',
'type'=>
'xsd:string'),
132 'profid1' => array(
'name'=>
'profid1',
'type'=>
'xsd:string'),
133 'profid2' => array(
'name'=>
'profid2',
'type'=>
'xsd:string'),
134 'profid3' => array(
'name'=>
'profid3',
'type'=>
'xsd:string'),
135 'profid4' => array(
'name'=>
'profid4',
'type'=>
'xsd:string'),
136 'profid5' => array(
'name'=>
'profid5',
'type'=>
'xsd:string'),
137 'profid6' => array(
'name'=>
'profid6',
'type'=>
'xsd:string'),
138 'capital' => array(
'name'=>
'capital',
'type'=>
'xsd:string'),
139 'vat_used' => array(
'name'=>
'vat_used',
'type'=>
'xsd:string'),
140 'vat_number' => array(
'name'=>
'vat_number',
'type'=>
'xsd:string'));
142$elementtype =
'societe';
147$extrafields->fetch_name_optionals_label($elementtype,
true);
148$extrafield_array =
null;
149if (is_array($extrafields) && count($extrafields) > 0) {
150 $extrafield_array = array();
152if (isset($extrafields->attributes[$elementtype][
'label']) && is_array($extrafields->attributes[$elementtype][
'label']) && count($extrafields->attributes[$elementtype][
'label'])) {
153 foreach ($extrafields->attributes[$elementtype][
'label'] as $key => $label) {
155 $type = $extrafields->attributes[$elementtype][
'type'][$key];
156 if ($type ==
'date' || $type ==
'datetime') {
157 $type =
'xsd:dateTime';
159 $type =
'xsd:string';
162 $extrafield_array[
'options_'.$key] = array(
'name'=>
'options_'.$key,
'type'=>$type);
166if (is_array($extrafield_array)) {
167 $thirdparty_fields = array_merge($thirdparty_fields, $extrafield_array);
171$server->wsdl->addComplexType(
181$server->wsdl->addComplexType(
189 'client' => array(
'name'=>
'client',
'type'=>
'xsd:string'),
190 'supplier' => array(
'name'=>
'supplier',
'type'=>
'xsd:string'),
191 'category' => array(
'name'=>
'category',
'type'=>
'xsd:string')
195$server->wsdl->addComplexType(
203 array(
'ref'=>
'SOAP-ENC:arrayType',
'wsdl:arrayType'=>
'tns:thirdparty[]')
207$server->wsdl->addComplexType(
208 'ThirdPartiesArray2',
214 'thirdparty' => array(
215 'name' =>
'thirdparty',
216 'type' =>
'tns:thirdparty',
218 'maxOccurs' =>
'unbounded'
228$styleuse =
'encoded';
235 array(
'authentication'=>
'tns:authentication',
'id'=>
'xsd:string',
'ref'=>
'xsd:string',
'ref_ext'=>
'xsd:string',
'barcode'=>
'xsd:string',
'profid1'=>
'xsd:string',
'profid2'=>
'xsd:string'),
237 array(
'result'=>
'tns:result',
'thirdparty'=>
'tns:thirdparty'),
239 $ns.
'#getThirdParty',
242 'WS to get a thirdparty from its id, ref or ref_ext'
249 array(
'authentication'=>
'tns:authentication',
'thirdparty'=>
'tns:thirdparty'),
251 array(
'result'=>
'tns:result',
'id'=>
'xsd:string',
'ref'=>
'xsd:string'),
253 $ns.
'#createThirdParty',
256 'WS to create a thirdparty'
263 array(
'authentication'=>
'tns:authentication',
'thirdparty'=>
'tns:thirdparty'),
265 array(
'result'=>
'tns:result',
'id'=>
'xsd:string'),
267 $ns.
'#updateThirdParty',
270 'WS to update a thirdparty'
276 'getListOfThirdParties',
278 array(
'authentication'=>
'tns:authentication',
'filterthirdparty'=>
'tns:filterthirdparty'),
280 array(
'result'=>
'tns:result',
'thirdparties'=>
'tns:ThirdPartiesArray2'),
282 $ns.
'#getListOfThirdParties',
285 'WS to get list of thirdparties id and ref'
292 array(
'authentication'=>
'tns:authentication',
'id'=>
'xsd:string',
'ref'=>
'xsd:string',
'ref_ext'=>
'xsd:string'),
294 array(
'result'=>
'tns:result',
'id'=>
'xsd:string'),
296 $ns.
'#deleteThirdParty',
299 'WS to delete a thirdparty from its id, ref or ref_ext'
316function getThirdParty($authentication, $id =
'', $ref =
'', $ref_ext =
'', $barcode =
'', $profid1 =
'', $profid2 =
'')
320 dol_syslog(
"Function: getThirdParty login=".$authentication[
'login'].
" id=".$id.
" ref=".$ref.
" ref_ext=".$ref_ext.
" barcode=".$barcode.
" profid1=".$profid1.
" profid2=".$profid2);
322 if ($authentication[
'entity']) {
323 $conf->entity = $authentication[
'entity'];
327 $objectresp = array();
333 if (!$error && (($id && $ref) || ($id && $ref_ext) || ($ref && $ref_ext))) {
335 $errorcode =
'BAD_PARAMETERS';
336 $errorlabel =
"Parameter id, ref and ref_ext can't be both provided. You must choose one or other but not both.";
342 if ($fuser->rights->societe->lire) {
343 $thirdparty =
new Societe($db);
344 $result = $thirdparty->fetch($id, $ref, $ref_ext, $barcode, $profid1, $profid2);
346 $thirdparty_result_fields = array(
347 'id' => $thirdparty->id,
348 'ref' => $thirdparty->name,
349 'ref_ext' => $thirdparty->ref_ext,
350 'status' => $thirdparty->status,
351 'client' => $thirdparty->client,
352 'supplier' => $thirdparty->fournisseur,
353 'customer_code' => $thirdparty->code_client,
354 'supplier_code' => $thirdparty->code_fournisseur,
355 'customer_code_accountancy' => $thirdparty->code_compta,
356 'supplier_code_accountancy' => $thirdparty->code_compta_fournisseur,
357 'user_creation' => $thirdparty->user_creation,
358 'date_creation' =>
dol_print_date($thirdparty->date_creation,
'dayhourrfc'),
359 'user_modification' => $thirdparty->user_modification,
360 'date_modification' =>
dol_print_date($thirdparty->date_modification,
'dayhourrfc'),
361 'address' => $thirdparty->address,
362 'zip' => $thirdparty->zip,
363 'town' => $thirdparty->town,
364 'region_code' => $thirdparty->region_code,
365 'country_id' => $thirdparty->country_id,
366 'country_code' => $thirdparty->country_code,
367 'country' => $thirdparty->country,
368 'phone' => $thirdparty->phone,
369 'fax' => $thirdparty->fax,
370 'email' => $thirdparty->email,
371 'url' => $thirdparty->url,
372 'profid1' => $thirdparty->idprof1,
373 'profid2' => $thirdparty->idprof2,
374 'profid3' => $thirdparty->idprof3,
375 'profid4' => $thirdparty->idprof4,
376 'profid5' => $thirdparty->idprof5,
377 'profid6' => $thirdparty->idprof6,
378 'capital' => $thirdparty->capital,
379 'barcode' => $thirdparty->barcode,
380 'vat_used' => $thirdparty->tva_assuj,
381 'vat_number' => $thirdparty->tva_intra,
382 'note_private' => $thirdparty->note_private,
383 'note_public' => $thirdparty->note_public);
385 $elementtype =
'societe';
390 $extrafields->fetch_name_optionals_label($elementtype,
true);
392 $thirdparty->fetch_optionals();
394 if (isset($extrafields->attributes[$elementtype][
'label']) && is_array($extrafields->attributes[$elementtype][
'label']) && count($extrafields->attributes[$elementtype][
'label'])) {
395 foreach ($extrafields->attributes[$elementtype][
'label'] as $key => $label) {
396 if (isset($thirdparty->array_options[
'options_'.$key])) {
397 $thirdparty_result_fields = array_merge($thirdparty_result_fields, array(
'options_'.$key => $thirdparty->array_options[
'options_'.$key]));
404 'result'=>array(
'result_code'=>
'OK',
'result_label'=>
''),
405 'thirdparty'=>$thirdparty_result_fields);
406 } elseif ($result == -2) {
408 $errorcode =
'DUPLICATE_FOUND'; $errorlabel =
'Object found several times for id='.$id.
' or ref='.$ref.
' or ref_ext='.$ref_ext;
411 $errorcode =
'NOT_FOUND'; $errorlabel =
'Object not found for id='.$id.
' nor ref='.$ref.
' nor ref_ext='.$ref_ext;
415 $errorcode =
'PERMISSION_DENIED'; $errorlabel =
'User does not have permission for this request';
420 $objectresp = array(
'result'=>array(
'result_code' => $errorcode,
'result_label' => $errorlabel));
441 dol_syslog(
"Function: createThirdParty login=".$authentication[
'login']);
443 if ($authentication[
'entity']) {
444 $conf->entity = $authentication[
'entity'];
448 $objectresp = array();
449 $errorcode =
''; $errorlabel =
'';
453 if (empty($thirdparty[
'ref'])) {
454 $error++; $errorcode =
'KO'; $errorlabel =
"Name is mandatory.";
459 include_once DOL_DOCUMENT_ROOT.
'/core/lib/company.lib.php';
462 $newobject->ref = $thirdparty[
'ref'];
463 $newobject->name = $thirdparty[
'ref'];
464 $newobject->ref_ext = $thirdparty[
'ref_ext'];
465 $newobject->status = $thirdparty[
'status'];
466 $newobject->client = $thirdparty[
'client'];
467 $newobject->fournisseur = $thirdparty[
'supplier'];
468 $newobject->code_client = $thirdparty[
'customer_code'];
469 $newobject->code_fournisseur = $thirdparty[
'supplier_code'];
470 $newobject->code_compta = $thirdparty[
'customer_code_accountancy'];
471 $newobject->code_compta_fournisseur = $thirdparty[
'supplier_code_accountancy'];
472 $newobject->date_creation = $now;
473 $newobject->note_private = $thirdparty[
'note_private'];
474 $newobject->note_public = $thirdparty[
'note_public'];
475 $newobject->address = $thirdparty[
'address'];
476 $newobject->zip = $thirdparty[
'zip'];
477 $newobject->town = $thirdparty[
'town'];
479 $newobject->country_id = $thirdparty[
'country_id'];
480 if ($thirdparty[
'country_code']) {
481 $newobject->country_id =
getCountry($thirdparty[
'country_code'], 3);
483 $newobject->region_code = empty($thirdparty[
'region_code']) ?
'' : $thirdparty[
'region_code'];
486 $newobject->phone = $thirdparty[
'phone'];
487 $newobject->fax = $thirdparty[
'fax'];
488 $newobject->email = $thirdparty[
'email'];
489 $newobject->url = $thirdparty[
'url'];
490 $newobject->idprof1 = $thirdparty[
'profid1'];
491 $newobject->idprof2 = $thirdparty[
'profid2'];
492 $newobject->idprof3 = $thirdparty[
'profid3'];
493 $newobject->idprof4 = $thirdparty[
'profid4'];
494 $newobject->idprof5 = $thirdparty[
'profid5'];
495 $newobject->idprof6 = $thirdparty[
'profid6'];
497 $newobject->capital = $thirdparty[
'capital'];
499 $newobject->barcode = empty($thirdparty[
'barcode']) ?
'' : $thirdparty[
'barcode'];
500 $newobject->tva_assuj = empty($thirdparty[
'vat_used']) ? 0 : $thirdparty[
'vat_used'];
501 $newobject->tva_intra = empty($thirdparty[
'vat_number']) ?
'' : $thirdparty[
'vat_number'];
503 $newobject->canvas = empty($thirdparty[
'canvas']) ?
'' : $thirdparty[
'canvas'];
504 $newobject->particulier = empty($thirdparty[
'individual']) ? 0 : $thirdparty[
'individual'];
506 $elementtype =
'societe';
511 $extrafields->fetch_name_optionals_label($elementtype,
true);
512 if (isset($extrafields->attributes[$elementtype][
'label']) && is_array($extrafields->attributes[$elementtype][
'label']) && count($extrafields->attributes[$elementtype][
'label'])) {
513 foreach ($extrafields->attributes[$elementtype][
'label'] as $key => $label) {
514 $key =
'options_'.$key;
515 if (isset($thirdparty[$key])) {
516 $newobject->array_options[$key] = $thirdparty[$key];
523 $result = $newobject->create($fuser);
524 if ($newobject->particulier && $result > 0) {
525 $newobject->firstname = $thirdparty[
'firstname'];
526 $newobject->name_bis = $thirdparty[
'lastname'];
527 $result = $newobject->create_individual($fuser);
537 if (!empty($thirdparty[
'commid']) && $thirdparty[
'commid'] > 0) {
538 $newobject->add_commercial($fuser, $thirdparty[
"commid"]);
541 $objectresp = array(
'result'=>array(
'result_code'=>
'OK',
'result_label'=>
''),
'id'=>$newobject->id,
'ref'=>$newobject->ref);
546 $errorlabel = $newobject->error;
551 $objectresp = array(
'result'=>array(
'result_code' => $errorcode,
'result_label' => $errorlabel));
570 dol_syslog(
"Function: updateThirdParty login=".$authentication[
'login']);
572 if ($authentication[
'entity']) {
573 $conf->entity = $authentication[
'entity'];
577 $objectresp = array();
578 $errorcode =
''; $errorlabel =
'';
582 if (empty($thirdparty[
'id'])) {
583 $error++; $errorcode =
'KO'; $errorlabel =
"Thirdparty id is mandatory.";
587 $objectfound =
false;
589 include_once DOL_DOCUMENT_ROOT.
'/core/lib/company.lib.php';
592 $result = $object->fetch($thirdparty[
'id']);
594 if (!empty($object->id)) {
597 $object->ref = $thirdparty[
'ref'];
598 $object->name = $thirdparty[
'ref'];
599 $object->ref_ext = $thirdparty[
'ref_ext'];
600 $object->status = $thirdparty[
'status'];
601 $object->client = $thirdparty[
'client'];
602 $object->fournisseur = $thirdparty[
'supplier'];
603 $object->code_client = $thirdparty[
'customer_code'];
604 $object->code_fournisseur = $thirdparty[
'supplier_code'];
605 $object->code_compta = $thirdparty[
'customer_code_accountancy'];
606 $object->code_compta_fournisseur = $thirdparty[
'supplier_code_accountancy'];
607 $object->date_creation = $now;
608 $object->note_private = $thirdparty[
'note_private'];
609 $object->note_public = $thirdparty[
'note_public'];
610 $object->address = $thirdparty[
'address'];
611 $object->zip = $thirdparty[
'zip'];
612 $object->town = $thirdparty[
'town'];
614 $object->country_id = $thirdparty[
'country_id'];
615 if ($thirdparty[
'country_code']) {
616 $object->country_id =
getCountry($thirdparty[
'country_code'], 3);
618 $object->region_code = $thirdparty[
'region_code'];
621 $object->phone = $thirdparty[
'phone'];
622 $object->fax = $thirdparty[
'fax'];
623 $object->email = $thirdparty[
'email'];
624 $object->url = $thirdparty[
'url'];
625 $object->idprof1 = $thirdparty[
'profid1'];
626 $object->idprof2 = $thirdparty[
'profid2'];
627 $object->idprof3 = $thirdparty[
'profid3'];
628 $object->idprof4 = $thirdparty[
'profid4'];
629 $object->idprof5 = $thirdparty[
'profid5'];
630 $object->idprof6 = $thirdparty[
'profid6'];
632 $object->capital = $thirdparty[
'capital'];
634 $object->barcode = $thirdparty[
'barcode'];
635 $object->tva_assuj = $thirdparty[
'vat_used'];
636 $object->tva_intra = $thirdparty[
'vat_number'];
638 $object->canvas = $thirdparty[
'canvas'];
640 $elementtype =
'societe';
645 $extrafields->fetch_name_optionals_label($elementtype,
true);
646 if (isset($extrafields->attributes[$elementtype][
'label']) && is_array($extrafields->attributes[$elementtype][
'label']) && count($extrafields->attributes[$elementtype][
'label'])) {
647 foreach ($extrafields->attributes[$elementtype][
'label'] as $key => $label) {
648 $key =
'options_'.$key;
649 if (isset($thirdparty[$key])) {
650 $object->array_options[$key] = $thirdparty[$key];
657 $result = $object->update($thirdparty[
'id'], $fuser);
663 if ((!$error) && ($objectfound)) {
666 'result'=>array(
'result_code'=>
'OK',
'result_label'=>
''),
669 } elseif ($objectfound) {
673 $errorlabel = $object->error;
676 $errorcode =
'NOT_FOUND';
677 $errorlabel =
'Thirdparty id='.$thirdparty[
'id'].
' cannot be found';
682 $objectresp = array(
'result'=>array(
'result_code' => $errorcode,
'result_label' => $errorlabel));
701 dol_syslog(
"Function: getListOfThirdParties login=".$authentication[
'login']);
703 if ($authentication[
'entity']) {
704 $conf->entity = $authentication[
'entity'];
708 $objectresp = array();
709 $arraythirdparties = array();
711 $errorcode =
''; $errorlabel =
'';
717 $sql =
"SELECT s.rowid as socRowid, s.nom as ref, s.ref_ext, s.address, s.zip, s.town, c.label as country, s.phone, s.fax, s.url, extra.*";
718 $sql .=
" FROM ".MAIN_DB_PREFIX.
"societe as s";
719 $sql .=
" LEFT JOIN ".MAIN_DB_PREFIX.
"c_country as c ON s.fk_pays = c.rowid";
720 $sql .=
" LEFT JOIN ".MAIN_DB_PREFIX.
"societe_extrafields as extra ON s.rowid=fk_object";
722 $sql .=
" WHERE entity=".$conf->entity;
723 foreach ($filterthirdparty as $key => $val) {
724 if ($key ==
'name' && $val !=
'') {
725 $sql .=
" AND s.name LIKE '%".$db->escape($val).
"%'";
727 if ($key ==
'client' && (
int) $val > 0) {
728 $sql .=
" AND s.client = ".((int) $val);
730 if ($key ==
'supplier' && (
int) $val > 0) {
731 $sql .=
" AND s.fournisseur = ".((int) $val);
733 if ($key ==
'category' && (
int) $val > 0) {
734 $sql .=
" AND s.rowid IN (SELECT fk_soc FROM ".MAIN_DB_PREFIX.
"categorie_societe WHERE fk_categorie = ".((int) $val).
") ";
737 dol_syslog(
"Function: getListOfThirdParties", LOG_DEBUG);
739 $elementtype =
'societe';
742 $extrafields->fetch_name_optionals_label($elementtype,
true);
745 $resql = $db->query($sql);
747 $num = $db->num_rows($resql);
751 $extrafieldsOptions = array();
752 $obj = $db->fetch_object($resql);
754 if (isset($extrafields->attributes[$elementtype][
'label']) && is_array($extrafields->attributes[$elementtype][
'label']) && count($extrafields->attributes[$elementtype][
'label'])) {
755 foreach ($extrafields->attributes[$elementtype][
'label'] as $key => $label) {
756 if (isset($obj->{$key})) {
757 $extrafieldsOptions[
'options_'.$key] = $obj->$key;
762 $arraythirdparties[] = array(
'id'=>$obj->socRowid,
764 'ref_ext'=>$obj->ref_ext,
765 'adress'=>$obj->adress,
768 'country'=>$obj->country,
769 'phone'=>$obj->phone,
773 $arraythirdparties[$i] = array_merge($arraythirdparties[$i], $extrafieldsOptions);
779 $errorcode = $db->lasterrno();
780 $errorlabel = $db->lasterror();
786 'result'=>array(
'result_code' => $errorcode,
'result_label' => $errorlabel),
787 'thirdparties'=>$arraythirdparties
791 'result'=>array(
'result_code' =>
'OK',
'result_label' =>
''),
792 'thirdparties'=>$arraythirdparties
812 dol_syslog(
"Function: deleteThirdParty login=".$authentication[
'login'].
" id=".$id.
" ref=".$ref.
" ref_ext=".$ref_ext);
814 if ($authentication[
'entity']) {
815 $conf->entity = $authentication[
'entity'];
819 $objectresp = array();
820 $errorcode =
''; $errorlabel =
'';
824 if (!$error && (($id && $ref) || ($id && $ref_ext) || ($ref && $ref_ext))) {
825 dol_syslog(
"Function: deleteThirdParty checkparam");
827 $errorcode =
'BAD_PARAMETERS'; $errorlabel =
"Parameter id, ref and ref_ext can't be both provided. You must choose one or other but not both.";
834 if ($fuser->rights->societe->lire && $fuser->rights->societe->supprimer) {
835 $thirdparty =
new Societe($db);
836 $result = $thirdparty->fetch($id, $ref, $ref_ext);
841 $result = $thirdparty->delete($thirdparty->id, $fuser);
846 $objectresp = array(
'result'=>array(
'result_code'=>
'OK',
'result_label'=>
''));
851 $errorlabel = $thirdparty->error;
852 dol_syslog(
"Function: deleteThirdParty cant delete");
856 $errorcode =
'NOT_FOUND'; $errorlabel =
'Object not found for id='.$id.
' nor ref='.$ref.
' nor ref_ext='.$ref_ext;
860 $errorcode =
'PERMISSION_DENIED'; $errorlabel =
'User does not have permission for this request';
865 $objectresp = array(
'result'=>array(
'result_code' => $errorcode,
'result_label' => $errorlabel));
872$server->service(file_get_contents(
"php://input"));
Class to manage third parties objects (customers, suppliers, prospects...)
getCountry($searchkey, $withcode='', $dbtouse=0, $outputlangs='', $entconv=1, $searchlabel='')
Return country label, code or id from an id, code or label.
dol_print_date($time, $format='', $tzoutput='auto', $outputlangs='', $encodetooutput=false)
Output date in a string format according to outputlangs (or langs if not defined).
dol_now($mode='auto')
Return date for now.
dol_syslog($message, $level=LOG_INFO, $ident=0, $suffixinfilename='', $restricttologhandler='', $logcontext=null)
Write log message into outputs.
getThirdParty($authentication, $id='', $ref='', $ref_ext='', $barcode='', $profid1='', $profid2='')
Get a thirdparty.
deleteThirdParty($authentication, $id='', $ref='', $ref_ext='')
Delete a thirdparty.
updateThirdParty($authentication, $thirdparty)
Update a thirdparty.
getListOfThirdParties($authentication, $filterthirdparty)
getListOfThirdParties
createThirdParty($authentication, $thirdparty)
Create a thirdparty.
check_authentication($authentication, &$error, &$errorcode, &$errorlabel)
Check authentication array and set error, errorcode, errorlabel.