server_actioncomm.php 18 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604
  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 (empty($conf->global->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 = ''; $errorlabel = '';
  252. $error = 0;
  253. $fuser = check_authentication($authentication, $error, $errorcode, $errorlabel);
  254. // Check parameters
  255. if ($error || (!$id)) {
  256. $error++;
  257. $errorcode = 'BAD_PARAMETERS'; $errorlabel = "Parameter id, ref and ref_ext can't be both provided. You must choose one or other but not both.";
  258. }
  259. if (!$error) {
  260. $fuser->getrights();
  261. if ($fuser->hasRight('agenda', 'allactions', 'read')) {
  262. $actioncomm = new ActionComm($db);
  263. $result = $actioncomm->fetch($id);
  264. if ($result > 0) {
  265. $actioncomm_result_fields = array(
  266. 'id' => $actioncomm->id,
  267. 'ref'=> $actioncomm->ref,
  268. 'ref_ext'=> $actioncomm->ref_ext,
  269. 'type_id'=> $actioncomm->type_id,
  270. 'type_code'=> $actioncomm->type_code,
  271. 'type'=> $actioncomm->type,
  272. 'label'=> $actioncomm->label,
  273. 'datep'=> dol_print_date($actioncomm->datep, 'dayhourrfc'),
  274. 'datef'=> dol_print_date($actioncomm->datef, 'dayhourrfc'),
  275. 'datec'=> dol_print_date($actioncomm->datec, 'dayhourrfc'),
  276. 'datem'=> dol_print_date($actioncomm->datem, 'dayhourrfc'),
  277. 'note'=> $actioncomm->note_private,
  278. 'percentage'=> $actioncomm->percentage,
  279. 'author'=> $actioncomm->authorid,
  280. 'usermod'=> $actioncomm->usermodid,
  281. 'userownerid'=> $actioncomm->userownerid,
  282. 'priority'=> $actioncomm->priority,
  283. 'fulldayevent'=> $actioncomm->fulldayevent,
  284. 'location'=> $actioncomm->location,
  285. 'socid'=> $actioncomm->socid,
  286. 'contactid'=> $actioncomm->contact_id,
  287. 'projectid'=> $actioncomm->fk_project,
  288. 'fk_element'=> $actioncomm->fk_element,
  289. 'elementtype'=> $actioncomm->elementtype
  290. );
  291. $elementtype = 'actioncomm';
  292. // Retrieve all extrafield for actioncomm
  293. // fetch optionals attributes and labels
  294. $extrafields = new ExtraFields($db);
  295. $extrafields->fetch_name_optionals_label($elementtype, true);
  296. //Get extrafield values
  297. $actioncomm->fetch_optionals();
  298. if (isset($extrafields->attributes[$elementtype]['label']) && is_array($extrafields->attributes[$elementtype]['label']) && count($extrafields->attributes[$elementtype]['label'])) {
  299. foreach ($extrafields->attributes[$elementtype]['label'] as $key => $label) {
  300. $actioncomm_result_fields = array_merge($actioncomm_result_fields, array('options_'.$key => $actioncomm->array_options['options_'.$key]));
  301. }
  302. }
  303. // Create
  304. $objectresp = array(
  305. 'result'=>array('result_code'=>'OK', 'result_label'=>''),
  306. 'actioncomm'=>$actioncomm_result_fields);
  307. } else {
  308. $error++;
  309. $errorcode = 'NOT_FOUND'; $errorlabel = 'Object not found for id='.$id;
  310. }
  311. } else {
  312. $error++;
  313. $errorcode = 'PERMISSION_DENIED'; $errorlabel = 'User does not have permission for this request';
  314. }
  315. }
  316. if ($error) {
  317. $objectresp = array('result'=>array('result_code' => $errorcode, 'result_label' => $errorlabel));
  318. }
  319. return $objectresp;
  320. }
  321. /**
  322. * Get getListActionCommType
  323. *
  324. * @param array $authentication Array of authentication information
  325. * @return mixed
  326. */
  327. function getListActionCommType($authentication)
  328. {
  329. global $db, $conf, $langs;
  330. dol_syslog("Function: getListActionCommType login=".$authentication['login']);
  331. if ($authentication['entity']) {
  332. $conf->entity = $authentication['entity'];
  333. }
  334. // Init and check authentication
  335. $objectresp = array();
  336. $errorcode = ''; $errorlabel = '';
  337. $error = 0;
  338. $fuser = check_authentication($authentication, $error, $errorcode, $errorlabel);
  339. if (!$error) {
  340. $fuser->getrights();
  341. if ($fuser->hasRight('agenda', 'myactions', 'read')) {
  342. $cactioncomm = new CActionComm($db);
  343. $result = $cactioncomm->liste_array('', 'code');
  344. if ($result > 0) {
  345. $resultarray = array();
  346. foreach ($cactioncomm->liste_array as $code => $libeller) {
  347. $resultarray[] = array('code'=>$code, 'libelle'=>$libeller);
  348. }
  349. $objectresp = array(
  350. 'result'=>array('result_code'=>'OK', 'result_label'=>''),
  351. 'actioncommtypes'=>$resultarray);
  352. } else {
  353. $error++;
  354. $errorcode = 'NOT_FOUND'; $errorlabel = 'Failed to execute liste_array';
  355. }
  356. } else {
  357. $error++;
  358. $errorcode = 'PERMISSION_DENIED'; $errorlabel = 'User does not have permission for this request';
  359. }
  360. }
  361. if ($error) {
  362. $objectresp = array('result'=>array('result_code' => $errorcode, 'result_label' => $errorlabel));
  363. }
  364. return $objectresp;
  365. }
  366. /**
  367. * Create ActionComm
  368. *
  369. * @param array $authentication Array of authentication information
  370. * @param ActionComm $actioncomm $actioncomm
  371. * @return array Array result
  372. */
  373. function createActionComm($authentication, $actioncomm)
  374. {
  375. global $db, $conf, $langs;
  376. $now = dol_now();
  377. dol_syslog("Function: createActionComm login=".$authentication['login']);
  378. if ($authentication['entity']) {
  379. $conf->entity = $authentication['entity'];
  380. }
  381. // Init and check authentication
  382. $objectresp = array();
  383. $errorcode = ''; $errorlabel = '';
  384. $error = 0;
  385. $fuser = check_authentication($authentication, $error, $errorcode, $errorlabel);
  386. if (!$error) {
  387. $newobject = new ActionComm($db);
  388. $newobject->datep = $actioncomm['datep'];
  389. $newobject->datef = $actioncomm['datef'];
  390. $newobject->type_code = $actioncomm['type_code'];
  391. $newobject->socid = $actioncomm['socid'];
  392. $newobject->fk_project = $actioncomm['projectid'];
  393. $newobject->note = $actioncomm['note'];
  394. $newobject->contact_id = $actioncomm['contactid'];
  395. $newobject->userownerid = $actioncomm['userownerid'];
  396. $newobject->label = $actioncomm['label'];
  397. $newobject->percentage = $actioncomm['percentage'];
  398. $newobject->priority = $actioncomm['priority'];
  399. $newobject->fulldayevent = $actioncomm['fulldayevent'];
  400. $newobject->location = $actioncomm['location'];
  401. $newobject->fk_element = $actioncomm['fk_element'];
  402. $newobject->elementtype = $actioncomm['elementtype'];
  403. $elementtype = 'actioncomm';
  404. //Retrieve all extrafield for actioncomm
  405. // fetch optionals attributes and labels
  406. $extrafields = new ExtraFields($db);
  407. $extrafields->fetch_name_optionals_label($elementtype, true);
  408. if (isset($extrafields->attributes[$elementtype]['label']) && is_array($extrafields->attributes[$elementtype]['label']) && count($extrafields->attributes[$elementtype]['label'])) {
  409. foreach ($extrafields->attributes[$elementtype]['label'] as $key => $label) {
  410. $key = 'options_'.$key;
  411. $newobject->array_options[$key] = $actioncomm[$key];
  412. }
  413. }
  414. $db->begin();
  415. $result = $newobject->create($fuser);
  416. if ($result <= 0) {
  417. $error++;
  418. }
  419. if (!$error) {
  420. $db->commit();
  421. $objectresp = array('result'=>array('result_code'=>'OK', 'result_label'=>''), 'id'=>$newobject->id);
  422. } else {
  423. $db->rollback();
  424. $error++;
  425. $errorcode = 'KO';
  426. $errorlabel = $newobject->error;
  427. }
  428. }
  429. if ($error) {
  430. $objectresp = array('result'=>array('result_code' => $errorcode, 'result_label' => $errorlabel));
  431. }
  432. return $objectresp;
  433. }
  434. /**
  435. * Create ActionComm
  436. *
  437. * @param array $authentication Array of authentication information
  438. * @param ActionComm $actioncomm $actioncomm
  439. * @return array Array result
  440. */
  441. function updateActionComm($authentication, $actioncomm)
  442. {
  443. global $db, $conf, $langs;
  444. $now = dol_now();
  445. dol_syslog("Function: updateActionComm login=".$authentication['login']);
  446. if ($authentication['entity']) {
  447. $conf->entity = $authentication['entity'];
  448. }
  449. // Init and check authentication
  450. $objectresp = array();
  451. $errorcode = ''; $errorlabel = '';
  452. $error = 0;
  453. $fuser = check_authentication($authentication, $error, $errorcode, $errorlabel);
  454. // Check parameters
  455. if (empty($actioncomm['id'])) {
  456. $error++; $errorcode = 'KO'; $errorlabel = "Actioncomm id is mandatory.";
  457. }
  458. if (!$error) {
  459. $objectfound = false;
  460. $object = new ActionComm($db);
  461. $result = $object->fetch($actioncomm['id']);
  462. if (!empty($object->id)) {
  463. $objectfound = true;
  464. $object->datep = $actioncomm['datep'];
  465. $object->datef = $actioncomm['datef'];
  466. $object->type_code = $actioncomm['type_code'];
  467. $object->socid = $actioncomm['socid'];
  468. $object->contact_id = $actioncomm['contactid'];
  469. $object->fk_project = $actioncomm['projectid'];
  470. $object->note = $actioncomm['note'];
  471. $object->userownerid = $actioncomm['userownerid'];
  472. $object->label = $actioncomm['label'];
  473. $object->percentage = $actioncomm['percentage'];
  474. $object->priority = $actioncomm['priority'];
  475. $object->fulldayevent = $actioncomm['fulldayevent'];
  476. $object->location = $actioncomm['location'];
  477. $object->fk_element = $actioncomm['fk_element'];
  478. $object->elementtype = $actioncomm['elementtype'];
  479. $elementtype = 'actioncomm';
  480. //Retrieve all extrafield for actioncomm
  481. // fetch optionals attributes and labels
  482. $extrafields = new ExtraFields($db);
  483. $extrafields->fetch_name_optionals_label($elementtype, true);
  484. if (isset($extrafields->attributes[$elementtype]['label']) && is_array($extrafields->attributes[$elementtype]['label']) && count($extrafields->attributes[$elementtype]['label'])) {
  485. foreach ($extrafields->attributes[$elementtype]['label'] as $key => $label) {
  486. $key = 'options_'.$key;
  487. $object->array_options[$key] = $actioncomm[$key];
  488. }
  489. }
  490. $db->begin();
  491. $result = $object->update($fuser);
  492. if ($result <= 0) {
  493. $error++;
  494. }
  495. }
  496. if ((!$error) && ($objectfound)) {
  497. $db->commit();
  498. $objectresp = array(
  499. 'result'=>array('result_code'=>'OK', 'result_label'=>''),
  500. 'id'=>$object->id
  501. );
  502. } elseif ($objectfound) {
  503. $db->rollback();
  504. $error++;
  505. $errorcode = 'KO';
  506. $errorlabel = $object->error;
  507. } else {
  508. $error++;
  509. $errorcode = 'NOT_FOUND';
  510. $errorlabel = 'Actioncomm id='.$actioncomm['id'].' cannot be found';
  511. }
  512. }
  513. if ($error) {
  514. $objectresp = array('result'=>array('result_code' => $errorcode, 'result_label' => $errorlabel));
  515. }
  516. return $objectresp;
  517. }
  518. // Return the results.
  519. $server->service(file_get_contents("php://input"));