server_actioncomm.php 18 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615
  1. <?php
  2. /* Copyright (C) 2006-2016 Laurent Destailleur <eldy@users.sourceforge.net>
  3. * Copyright (C) 2012 Florian Henry <florian.henry@open-concept.pro>
  4. *
  5. * This program is free software; you can redistribute it and/or modify
  6. * it under the terms of the GNU General Public License as published by
  7. * the Free Software Foundation; either version 3 of the License, or
  8. * (at your option) any later version.
  9. *
  10. * This program is distributed in the hope that it will be useful,
  11. * but WITHOUT ANY WARRANTY; without even the implied warranty of
  12. * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
  13. * GNU General Public License for more details.
  14. *
  15. * You should have received a copy of the GNU General Public License
  16. * along with this program. If not, see <https://www.gnu.org/licenses/>.
  17. *
  18. * Path to WSDL is: http://localhost/dolibarr/webservices/server_actioncomm.php?wsdl
  19. */
  20. /**
  21. * \file htdocs/webservices/server_actioncomm.php
  22. * \brief File that is entry point to call Dolibarr WebServices
  23. */
  24. if (!defined('NOCSRFCHECK')) {
  25. define('NOCSRFCHECK', '1'); // Do not check anti CSRF attack test
  26. }
  27. if (!defined('NOTOKENRENEWAL')) {
  28. define('NOTOKENRENEWAL', '1'); // Do not check anti POST attack test
  29. }
  30. if (!defined('NOREQUIREMENU')) {
  31. define('NOREQUIREMENU', '1'); // If there is no need to load and show top and left menu
  32. }
  33. if (!defined('NOREQUIREHTML')) {
  34. define('NOREQUIREHTML', '1'); // If we don't need to load the html.form.class.php
  35. }
  36. if (!defined('NOREQUIREAJAX')) {
  37. define('NOREQUIREAJAX', '1'); // Do not load ajax.lib.php library
  38. }
  39. if (!defined("NOLOGIN")) {
  40. define("NOLOGIN", '1'); // If this page is public (can be called outside logged session)
  41. }
  42. if (!defined("NOSESSION")) {
  43. define("NOSESSION", '1');
  44. }
  45. require '../main.inc.php';
  46. require_once NUSOAP_PATH.'/nusoap.php'; // Include SOAP
  47. require_once DOL_DOCUMENT_ROOT."/core/lib/ws.lib.php";
  48. require_once DOL_DOCUMENT_ROOT."/comm/action/class/actioncomm.class.php";
  49. require_once DOL_DOCUMENT_ROOT."/comm/action/class/cactioncomm.class.php";
  50. require_once DOL_DOCUMENT_ROOT.'/core/class/extrafields.class.php';
  51. dol_syslog("Call ActionComm webservices interfaces");
  52. // Enable and test if module web services is enabled
  53. if (!getDolGlobalString('MAIN_MODULE_WEBSERVICES')) {
  54. $langs->load("admin");
  55. dol_syslog("Call Dolibarr webservices interfaces with module webservices disabled");
  56. print $langs->trans("WarningModuleNotActive", 'WebServices').'.<br><br>';
  57. print $langs->trans("ToActivateModule");
  58. exit;
  59. }
  60. // Create the soap Object
  61. $server = new nusoap_server();
  62. $server->soap_defencoding = 'UTF-8';
  63. $server->decode_utf8 = false;
  64. $ns = 'http://www.dolibarr.org/ns/';
  65. $server->configureWSDL('WebServicesDolibarrActionComm', $ns);
  66. $server->wsdl->schemaTargetNamespace = $ns;
  67. // Define WSDL Authentication object
  68. $server->wsdl->addComplexType(
  69. 'authentication',
  70. 'complexType',
  71. 'struct',
  72. 'all',
  73. '',
  74. array(
  75. 'dolibarrkey' => array('name'=>'dolibarrkey', 'type'=>'xsd:string'),
  76. 'sourceapplication' => array('name'=>'sourceapplication', 'type'=>'xsd:string'),
  77. 'login' => array('name'=>'login', 'type'=>'xsd:string'),
  78. 'password' => array('name'=>'password', 'type'=>'xsd:string'),
  79. 'entity' => array('name'=>'entity', 'type'=>'xsd:string'),
  80. )
  81. );
  82. // Define WSDL Return object
  83. $server->wsdl->addComplexType(
  84. 'result',
  85. 'complexType',
  86. 'struct',
  87. 'all',
  88. '',
  89. array(
  90. 'result_code' => array('name'=>'result_code', 'type'=>'xsd:string'),
  91. 'result_label' => array('name'=>'result_label', 'type'=>'xsd:string'),
  92. )
  93. );
  94. $actioncomm_fields = array(
  95. 'id' => array('name'=>'id', 'type'=>'xsd:string'),
  96. 'ref' => array('name'=>'ref', 'type'=>'xsd:string'),
  97. 'ref_ext' => array('name'=>'ref_ext', 'type'=>'xsd:string'),
  98. 'type_id' => array('name'=>'type_id', 'type'=>'xsd:string'),
  99. 'type_code' => array('name'=>'type_code', 'type'=>'xsd:string'),
  100. 'type' => array('name'=>'type', 'type'=>'xsd:string'),
  101. 'label' => array('name'=>'label', 'type'=>'xsd:string'),
  102. 'datep' => array('name'=>'datep', 'type'=>'xsd:dateTime'),
  103. 'datef' => array('name'=>'datef', 'type'=>'xsd:dateTime'),
  104. 'datec' => array('name'=>'datec', 'type'=>'xsd:dateTime'),
  105. 'datem' => array('name'=>'datem', 'type'=>'xsd:dateTime'),
  106. 'note' => array('name'=>'note', 'type'=>'xsd:string'),
  107. 'percentage' => array('name'=>'percentage', 'type'=>'xsd:string'),
  108. 'author' => array('name'=>'author', 'type'=>'xsd:string'),
  109. 'usermod' => array('name'=>'usermod', 'type'=>'xsd:string'),
  110. 'userownerid' => array('name'=>'userownerid', 'type'=>'xsd:string'),
  111. 'priority' => array('name'=>'priority', 'type'=>'xsd:string'),
  112. 'fulldayevent' => array('name'=>'fulldayevent', 'type'=>'xsd:string'),
  113. 'location' => array('name'=>'location', 'type'=>'xsd:string'),
  114. 'socid' => array('name'=>'socid', 'type'=>'xsd:string'),
  115. 'contactid' => array('name'=>'contactid', 'type'=>'xsd:string'),
  116. 'projectid' => array('name'=>'projectid', 'type'=>'xsd:string'),
  117. 'fk_element' => array('name'=>'fk_element', 'type'=>'xsd:string'),
  118. 'elementtype' => array('name'=>'elementtype', 'type'=>'xsd:string'));
  119. $elementtype = 'actioncomm';
  120. //Retrieve all extrafield for actioncomm
  121. // fetch optionals attributes and labels
  122. $extrafields = new ExtraFields($db);
  123. $extrafields->fetch_name_optionals_label($elementtype, true);
  124. $extrafield_array = null;
  125. if (is_array($extrafields) && count($extrafields) > 0) {
  126. $extrafield_array = array();
  127. }
  128. if (isset($extrafields->attributes[$elementtype]['label']) && is_array($extrafields->attributes[$elementtype]['label']) && count($extrafields->attributes[$elementtype]['label'])) {
  129. foreach ($extrafields->attributes[$elementtype]['label'] as $key => $label) {
  130. $type = $extrafields->attributes[$elementtype]['type'][$key];
  131. if ($type == 'date' || $type == 'datetime') {
  132. $type = 'xsd:dateTime';
  133. } else {
  134. $type = 'xsd:string';
  135. }
  136. $extrafield_array['options_'.$key] = array('name'=>'options_'.$key, 'type'=>$type);
  137. }
  138. }
  139. if (is_array($extrafield_array)) {
  140. $actioncomm_fields = array_merge($actioncomm_fields, $extrafield_array);
  141. }
  142. // Define other specific objects
  143. $server->wsdl->addComplexType(
  144. 'actioncomm',
  145. 'complexType',
  146. 'struct',
  147. 'all',
  148. '',
  149. $actioncomm_fields
  150. );
  151. $server->wsdl->addComplexType(
  152. 'actioncommtype',
  153. 'complexType',
  154. 'array',
  155. 'sequence',
  156. '',
  157. array(
  158. 'code' => array('name'=>'code', 'type'=>'xsd:string'),
  159. 'libelle' => array('name'=>'libelle', 'type'=>'xsd:string')
  160. )
  161. );
  162. $server->wsdl->addComplexType(
  163. 'actioncommtypes',
  164. 'complexType',
  165. 'array',
  166. 'sequence',
  167. '',
  168. array(
  169. 'actioncommtype' => array(
  170. 'name' => 'actioncommtype',
  171. 'type' => 'tns:actioncommtype',
  172. 'minOccurs' => '0',
  173. 'maxOccurs' => 'unbounded'
  174. )
  175. )
  176. );
  177. // 5 styles: RPC/encoded, RPC/literal, Document/encoded (not WS-I compliant), Document/literal, Document/literal wrapped
  178. // Style merely dictates how to translate a WSDL binding to a SOAP message. Nothing more. You can use either style with any programming model.
  179. // http://www.ibm.com/developerworks/webservices/library/ws-whichwsdl/
  180. $styledoc = 'rpc'; // rpc/document (document is an extend into SOAP 1.0 to support unstructured messages)
  181. $styleuse = 'encoded'; // encoded/literal/literal wrapped
  182. // Better choice is document/literal wrapped but literal wrapped not supported by nusoap.
  183. // Register WSDL
  184. $server->register(
  185. 'getListActionCommType',
  186. // Entry values
  187. array('authentication'=>'tns:authentication'),
  188. // Exit values
  189. array('result'=>'tns:result', 'actioncommtypes'=>'tns:actioncommtypes'),
  190. $ns,
  191. $ns.'#getListActionCommType',
  192. $styledoc,
  193. $styleuse,
  194. 'WS to get actioncommType'
  195. );
  196. // Register WSDL
  197. $server->register(
  198. 'getActionComm',
  199. // Entry values
  200. array('authentication'=>'tns:authentication', 'id'=>'xsd:string'),
  201. // Exit values
  202. array('result'=>'tns:result', 'actioncomm'=>'tns:actioncomm'),
  203. $ns,
  204. $ns.'#getActionComm',
  205. $styledoc,
  206. $styleuse,
  207. 'WS to get actioncomm'
  208. );
  209. // Register WSDL
  210. $server->register(
  211. 'createActionComm',
  212. // Entry values
  213. array('authentication'=>'tns:authentication', 'actioncomm'=>'tns:actioncomm'),
  214. // Exit values
  215. array('result'=>'tns:result', 'id'=>'xsd:string'),
  216. $ns,
  217. $ns.'#createActionComm',
  218. $styledoc,
  219. $styleuse,
  220. 'WS to create a actioncomm'
  221. );
  222. // Register WSDL
  223. $server->register(
  224. 'updateActionComm',
  225. // Entry values
  226. array('authentication'=>'tns:authentication', 'actioncomm'=>'tns:actioncomm'),
  227. // Exit values
  228. array('result'=>'tns:result', 'id'=>'xsd:string'),
  229. $ns,
  230. $ns.'#updateActionComm',
  231. $styledoc,
  232. $styleuse,
  233. 'WS to update a actioncomm'
  234. );
  235. /**
  236. * Get ActionComm
  237. *
  238. * @param array $authentication Array of authentication information
  239. * @param int $id Id of object
  240. * @return mixed
  241. */
  242. function getActionComm($authentication, $id)
  243. {
  244. global $db, $conf, $langs;
  245. dol_syslog("Function: getActionComm login=".$authentication['login']." id=".$id);
  246. if ($authentication['entity']) {
  247. $conf->entity = $authentication['entity'];
  248. }
  249. // Init and check authentication
  250. $objectresp = array();
  251. $errorcode = '';
  252. $errorlabel = '';
  253. $error = 0;
  254. $fuser = check_authentication($authentication, $error, $errorcode, $errorlabel);
  255. // Check parameters
  256. if ($error || (!$id)) {
  257. $error++;
  258. $errorcode = 'BAD_PARAMETERS';
  259. $errorlabel = "Parameter id, ref and ref_ext can't be both provided. You must choose one or other but not both.";
  260. }
  261. if (!$error) {
  262. $fuser->getrights();
  263. if ($fuser->hasRight('agenda', 'allactions', 'read')) {
  264. $actioncomm = new ActionComm($db);
  265. $result = $actioncomm->fetch($id);
  266. if ($result > 0) {
  267. $actioncomm_result_fields = array(
  268. 'id' => $actioncomm->id,
  269. 'ref'=> $actioncomm->ref,
  270. 'ref_ext'=> $actioncomm->ref_ext,
  271. 'type_id'=> $actioncomm->type_id,
  272. 'type_code'=> $actioncomm->type_code,
  273. 'type'=> $actioncomm->type,
  274. 'label'=> $actioncomm->label,
  275. 'datep'=> dol_print_date($actioncomm->datep, 'dayhourrfc'),
  276. 'datef'=> dol_print_date($actioncomm->datef, 'dayhourrfc'),
  277. 'datec'=> dol_print_date($actioncomm->datec, 'dayhourrfc'),
  278. 'datem'=> dol_print_date($actioncomm->datem, 'dayhourrfc'),
  279. 'note'=> $actioncomm->note_private,
  280. 'percentage'=> $actioncomm->percentage,
  281. 'author'=> $actioncomm->authorid,
  282. 'usermod'=> $actioncomm->usermodid,
  283. 'userownerid'=> $actioncomm->userownerid,
  284. 'priority'=> $actioncomm->priority,
  285. 'fulldayevent'=> $actioncomm->fulldayevent,
  286. 'location'=> $actioncomm->location,
  287. 'socid'=> $actioncomm->socid,
  288. 'contactid'=> $actioncomm->contact_id,
  289. 'projectid'=> $actioncomm->fk_project,
  290. 'fk_element'=> $actioncomm->fk_element,
  291. 'elementtype'=> $actioncomm->elementtype
  292. );
  293. $elementtype = 'actioncomm';
  294. // Retrieve all extrafield for actioncomm
  295. // fetch optionals attributes and labels
  296. $extrafields = new ExtraFields($db);
  297. $extrafields->fetch_name_optionals_label($elementtype, true);
  298. //Get extrafield values
  299. $actioncomm->fetch_optionals();
  300. if (isset($extrafields->attributes[$elementtype]['label']) && is_array($extrafields->attributes[$elementtype]['label']) && count($extrafields->attributes[$elementtype]['label'])) {
  301. foreach ($extrafields->attributes[$elementtype]['label'] as $key => $label) {
  302. $actioncomm_result_fields = array_merge($actioncomm_result_fields, array('options_'.$key => $actioncomm->array_options['options_'.$key]));
  303. }
  304. }
  305. // Create
  306. $objectresp = array(
  307. 'result'=>array('result_code'=>'OK', 'result_label'=>''),
  308. 'actioncomm'=>$actioncomm_result_fields);
  309. } else {
  310. $error++;
  311. $errorcode = 'NOT_FOUND';
  312. $errorlabel = 'Object not found for id='.$id;
  313. }
  314. } else {
  315. $error++;
  316. $errorcode = 'PERMISSION_DENIED';
  317. $errorlabel = 'User does not have permission for this request';
  318. }
  319. }
  320. if ($error) {
  321. $objectresp = array('result'=>array('result_code' => $errorcode, 'result_label' => $errorlabel));
  322. }
  323. return $objectresp;
  324. }
  325. /**
  326. * Get getListActionCommType
  327. *
  328. * @param array $authentication Array of authentication information
  329. * @return mixed
  330. */
  331. function getListActionCommType($authentication)
  332. {
  333. global $db, $conf, $langs;
  334. dol_syslog("Function: getListActionCommType login=".$authentication['login']);
  335. if ($authentication['entity']) {
  336. $conf->entity = $authentication['entity'];
  337. }
  338. // Init and check authentication
  339. $objectresp = array();
  340. $errorcode = '';
  341. $errorlabel = '';
  342. $error = 0;
  343. $fuser = check_authentication($authentication, $error, $errorcode, $errorlabel);
  344. if (!$error) {
  345. $fuser->getrights();
  346. if ($fuser->hasRight('agenda', 'myactions', 'read')) {
  347. $cactioncomm = new CActionComm($db);
  348. $result = $cactioncomm->liste_array('', 'code');
  349. if ($result > 0) {
  350. $resultarray = array();
  351. foreach ($cactioncomm->liste_array as $code => $libeller) {
  352. $resultarray[] = array('code'=>$code, 'libelle'=>$libeller);
  353. }
  354. $objectresp = array(
  355. 'result'=>array('result_code'=>'OK', 'result_label'=>''),
  356. 'actioncommtypes'=>$resultarray);
  357. } else {
  358. $error++;
  359. $errorcode = 'NOT_FOUND';
  360. $errorlabel = 'Failed to execute liste_array';
  361. }
  362. } else {
  363. $error++;
  364. $errorcode = 'PERMISSION_DENIED';
  365. $errorlabel = 'User does not have permission for this request';
  366. }
  367. }
  368. if ($error) {
  369. $objectresp = array('result'=>array('result_code' => $errorcode, 'result_label' => $errorlabel));
  370. }
  371. return $objectresp;
  372. }
  373. /**
  374. * Create ActionComm
  375. *
  376. * @param array $authentication Array of authentication information
  377. * @param ActionComm $actioncomm $actioncomm
  378. * @return array Array result
  379. */
  380. function createActionComm($authentication, $actioncomm)
  381. {
  382. global $db, $conf, $langs;
  383. $now = dol_now();
  384. dol_syslog("Function: createActionComm login=".$authentication['login']);
  385. if ($authentication['entity']) {
  386. $conf->entity = $authentication['entity'];
  387. }
  388. // Init and check authentication
  389. $objectresp = array();
  390. $errorcode = '';
  391. $errorlabel = '';
  392. $error = 0;
  393. $fuser = check_authentication($authentication, $error, $errorcode, $errorlabel);
  394. if (!$error) {
  395. $newobject = new ActionComm($db);
  396. $newobject->datep = $actioncomm['datep'];
  397. $newobject->datef = $actioncomm['datef'];
  398. $newobject->type_code = $actioncomm['type_code'];
  399. $newobject->socid = $actioncomm['socid'];
  400. $newobject->fk_project = $actioncomm['projectid'];
  401. $newobject->note = $actioncomm['note'];
  402. $newobject->contact_id = $actioncomm['contactid'];
  403. $newobject->userownerid = $actioncomm['userownerid'];
  404. $newobject->label = $actioncomm['label'];
  405. $newobject->percentage = $actioncomm['percentage'];
  406. $newobject->priority = $actioncomm['priority'];
  407. $newobject->fulldayevent = $actioncomm['fulldayevent'];
  408. $newobject->location = $actioncomm['location'];
  409. $newobject->fk_element = $actioncomm['fk_element'];
  410. $newobject->elementtype = $actioncomm['elementtype'];
  411. $elementtype = 'actioncomm';
  412. //Retrieve all extrafield for actioncomm
  413. // fetch optionals attributes and labels
  414. $extrafields = new ExtraFields($db);
  415. $extrafields->fetch_name_optionals_label($elementtype, true);
  416. if (isset($extrafields->attributes[$elementtype]['label']) && is_array($extrafields->attributes[$elementtype]['label']) && count($extrafields->attributes[$elementtype]['label'])) {
  417. foreach ($extrafields->attributes[$elementtype]['label'] as $key => $label) {
  418. $key = 'options_'.$key;
  419. $newobject->array_options[$key] = $actioncomm[$key];
  420. }
  421. }
  422. $db->begin();
  423. $result = $newobject->create($fuser);
  424. if ($result <= 0) {
  425. $error++;
  426. }
  427. if (!$error) {
  428. $db->commit();
  429. $objectresp = array('result'=>array('result_code'=>'OK', 'result_label'=>''), 'id'=>$newobject->id);
  430. } else {
  431. $db->rollback();
  432. $error++;
  433. $errorcode = 'KO';
  434. $errorlabel = $newobject->error;
  435. }
  436. }
  437. if ($error) {
  438. $objectresp = array('result'=>array('result_code' => $errorcode, 'result_label' => $errorlabel));
  439. }
  440. return $objectresp;
  441. }
  442. /**
  443. * Create ActionComm
  444. *
  445. * @param array $authentication Array of authentication information
  446. * @param ActionComm $actioncomm $actioncomm
  447. * @return array Array result
  448. */
  449. function updateActionComm($authentication, $actioncomm)
  450. {
  451. global $db, $conf, $langs;
  452. $now = dol_now();
  453. dol_syslog("Function: updateActionComm login=".$authentication['login']);
  454. if ($authentication['entity']) {
  455. $conf->entity = $authentication['entity'];
  456. }
  457. // Init and check authentication
  458. $objectresp = array();
  459. $errorcode = '';
  460. $errorlabel = '';
  461. $error = 0;
  462. $fuser = check_authentication($authentication, $error, $errorcode, $errorlabel);
  463. // Check parameters
  464. if (empty($actioncomm['id'])) {
  465. $error++;
  466. $errorcode = 'KO';
  467. $errorlabel = "Actioncomm id is mandatory.";
  468. }
  469. if (!$error) {
  470. $objectfound = false;
  471. $object = new ActionComm($db);
  472. $result = $object->fetch($actioncomm['id']);
  473. if (!empty($object->id)) {
  474. $objectfound = true;
  475. $object->datep = $actioncomm['datep'];
  476. $object->datef = $actioncomm['datef'];
  477. $object->type_code = $actioncomm['type_code'];
  478. $object->socid = $actioncomm['socid'];
  479. $object->contact_id = $actioncomm['contactid'];
  480. $object->fk_project = $actioncomm['projectid'];
  481. $object->note = $actioncomm['note'];
  482. $object->userownerid = $actioncomm['userownerid'];
  483. $object->label = $actioncomm['label'];
  484. $object->percentage = $actioncomm['percentage'];
  485. $object->priority = $actioncomm['priority'];
  486. $object->fulldayevent = $actioncomm['fulldayevent'];
  487. $object->location = $actioncomm['location'];
  488. $object->fk_element = $actioncomm['fk_element'];
  489. $object->elementtype = $actioncomm['elementtype'];
  490. $elementtype = 'actioncomm';
  491. //Retrieve all extrafield for actioncomm
  492. // fetch optionals attributes and labels
  493. $extrafields = new ExtraFields($db);
  494. $extrafields->fetch_name_optionals_label($elementtype, true);
  495. if (isset($extrafields->attributes[$elementtype]['label']) && is_array($extrafields->attributes[$elementtype]['label']) && count($extrafields->attributes[$elementtype]['label'])) {
  496. foreach ($extrafields->attributes[$elementtype]['label'] as $key => $label) {
  497. $key = 'options_'.$key;
  498. $object->array_options[$key] = $actioncomm[$key];
  499. }
  500. }
  501. $db->begin();
  502. $result = $object->update($fuser);
  503. if ($result <= 0) {
  504. $error++;
  505. }
  506. }
  507. if ((!$error) && ($objectfound)) {
  508. $db->commit();
  509. $objectresp = array(
  510. 'result'=>array('result_code'=>'OK', 'result_label'=>''),
  511. 'id'=>$object->id
  512. );
  513. } elseif ($objectfound) {
  514. $db->rollback();
  515. $error++;
  516. $errorcode = 'KO';
  517. $errorlabel = $object->error;
  518. } else {
  519. $error++;
  520. $errorcode = 'NOT_FOUND';
  521. $errorlabel = 'Actioncomm id='.$actioncomm['id'].' cannot be found';
  522. }
  523. }
  524. if ($error) {
  525. $objectresp = array('result'=>array('result_code' => $errorcode, 'result_label' => $errorlabel));
  526. }
  527. return $objectresp;
  528. }
  529. // Return the results.
  530. $server->service(file_get_contents("php://input"));