dolibarr 24.0.0-beta
api_interventions.class.php
Go to the documentation of this file.
1<?php
2/* Copyright (C) 2015 Jean-François Ferry <jfefe@aternatik.fr>
3 * Copyright (C) 2016 Laurent Destailleur <eldy@users.sourceforge.net>
4 * Copyright (C) 2025-2026 William Mead <william@m34d.com>
5 * Copyright (C) 2025-2026 Charlene Benke <charlene@patas-monkey.com>
6 * Copyright (C) 2025 Frédéric France <frederic.france@free.fr>
7 *
8 * This program is free software; you can redistribute it and/or modify
9 * it under the terms of the GNU General Public License as published by
10 * the Free Software Foundation; either version 3 of the License, or
11 * (at your option) any later version.
12 *
13 * This program is distributed in the hope that it will be useful,
14 * but WITHOUT ANY WARRANTY; without even the implied warranty of
15 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
16 * GNU General Public License for more details.
17 *
18 * You should have received a copy of the GNU General Public License
19 * along with this program. If not, see <https://www.gnu.org/licenses/>.
20 */
21
27use Luracast\Restler\RestException;
28
29require_once DOL_DOCUMENT_ROOT.'/fichinter/class/fichinter.class.php';
30include_once DOL_DOCUMENT_ROOT."/fichinter/class/fichinterligne.class.php";
31
32
33
43{
47 public static $FIELDS = array(
48 'socid',
49 'fk_project',
50 'description',
51 );
52
56 public static $FIELDSLINE = array(
57 'description',
58 'date',
59 'duration',
60 );
61
65 public $fichinter;
66
70 public function __construct()
71 {
72 global $db;
73 $this->db = $db;
74 $this->fichinter = new Fichinter($this->db);
75 }
76
91 public function get($id, $ref = '', $ref_ext = '', $contact_list = 1)
92 {
93 if (!DolibarrApiAccess::$user->hasRight('ficheinter', 'lire')) {
94 throw new RestException(403);
95 }
96
97 $result = $this->fichinter->fetch($id, $ref, $ref_ext);
98 if (!$result) {
99 throw new RestException(404, 'Intervention not found');
100 }
101
102 if (!DolibarrApi::_checkAccessToResource('fichinter', $this->fichinter->id)) {
103 throw new RestException(403, 'Access not allowed for login '.DolibarrApiAccess::$user->login);
104 }
105
106 if ($contact_list > -1) {
107 // Add external contacts ids
108 $tmparray = $this->fichinter->liste_contact(-1, 'external', $contact_list);
109 if (is_array($tmparray)) {
110 $this->fichinter->contacts_ids = $tmparray;
111 }
112 $tmparray = $this->fichinter->liste_contact(-1, 'internal', $contact_list);
113 if (is_array($tmparray)) {
114 $this->fichinter->contacts_ids_internal = $tmparray;
115 }
116 }
117
118 $this->fichinter->fetchObjectLinked();
119
120 return $this->_cleanObjectDatas($this->fichinter);
121 }
122
146 public function index($sortfield = "t.rowid", $sortorder = 'ASC', $limit = 100, $page = 0, $thirdparty_ids = '', $sqlfilters = '', $properties = '', $contact_type = '', $pagination_data = false, $loadlinkedobjects = 0)
147 {
148 if (!DolibarrApiAccess::$user->hasRight('ficheinter', 'lire')) {
149 throw new RestException(403);
150 }
151
152 global $hookmanager;
153
154 $obj_ret = array();
155
156 // case of external user, $thirdparty_ids param is ignored and replaced by user's socid
157 $socids = DolibarrApiAccess::$user->socid ?: $thirdparty_ids;
158
159 // If the internal user must only see his customers, force searching by him
160 $search_sale = 0;
161 if (!DolibarrApiAccess::$user->hasRight('societe', 'client', 'voir') && !$socids) {
162 $search_sale = DolibarrApiAccess::$user->id;
163 }
164
165 $sql = "SELECT t.rowid";
166 $sql .= " FROM ".MAIN_DB_PREFIX."fichinter AS t";
167 $sql .= " INNER JOIN ".MAIN_DB_PREFIX."societe AS s ON (s.rowid = t.fk_soc)";
168 $sql .= " LEFT JOIN ".MAIN_DB_PREFIX."fichinter_extrafields AS ef ON (ef.fk_object = t.rowid)"; // Modification VMR Global Solutions to include extrafields as search parameters in the API GET call, so we will be able to filter on extrafields
169 $sql .= ' WHERE t.entity IN ('.getEntity('intervention').')';
170 if ($socids) {
171 $sql .= " AND t.fk_soc IN (".$this->db->sanitize($socids).")";
172 }
173 // Search on sale representative
174 if ($search_sale && $search_sale != '-1') {
175 if ($search_sale == -2) {
176 $sql .= " AND NOT EXISTS (SELECT sc.fk_soc FROM ".MAIN_DB_PREFIX."societe_commerciaux as sc WHERE sc.fk_soc = t.fk_soc)";
177 } elseif ($search_sale > 0) {
178 $sql .= " AND EXISTS (SELECT sc.fk_soc FROM ".MAIN_DB_PREFIX."societe_commerciaux as sc WHERE sc.fk_soc = t.fk_soc AND sc.fk_user = ".((int) $search_sale).")";
179 }
180 }
181
182 if ($sqlfilters) {
183 $parameters = array('sqlfilters' => $sqlfilters, 'apiroute' => 'interventions', 'apimethod' => __METHOD__);
184 $action = 'list';
185 $reshook = $hookmanager->executeHooks('printFieldListWhere', $parameters, $this->fichinter, $action); // Note that $action and $object may have been modified by hook
186 if ($reshook > 0) {
187 $sql = $hookmanager->resPrint;
188 } elseif ($reshook == 0) {
189 $sql .= $hookmanager->resPrint;
190 }
191
192 $errormessage = '';
193 $sql .= forgeSQLFromUniversalSearchCriteria($sqlfilters, $errormessage);
194 if ($errormessage) {
195 throw new RestException(400, 'Error when validating parameter sqlfilters -> '.$errormessage);
196 }
197 }
198
199 //this query will return total interventions with the filters given
200 $sqlTotals = str_replace('SELECT t.rowid', 'SELECT count(t.rowid) as total', $sql);
201
202 $sql .= $this->db->order($sortfield, $sortorder);
203 if ($limit) {
204 if ($page < 0) {
205 $page = 0;
206 }
207 $offset = $limit * $page;
208
209 $sql .= $this->db->plimit($limit + 1, $offset);
210 }
211
212 dol_syslog("API Rest request");
213 $result = $this->db->query($sql);
214
215 if ($result) {
216 $num = $this->db->num_rows($result);
217 $min = min($num, ($limit <= 0 ? $num : $limit));
218 $i = 0;
219 while ($i < $min) {
220 $obj = $this->db->fetch_object($result);
221 $fichinter_static = new Fichinter($this->db);
222 if ($fichinter_static->fetch($obj->rowid)) {
223 if ($contact_type) {
224 $fichinter_static->contacts_ids = $fichinter_static->liste_contact(-1, $contact_type, 1);
225 }
226
227 if ($loadlinkedobjects) {
228 // retrieve linked objects
229 $fichinter_static->fetchObjectLinked();
230 }
231
232 $obj_ret[] = $this->_filterObjectProperties($this->_cleanObjectDatas($fichinter_static), $properties);
233 }
234 $i++;
235 }
236 } else {
237 throw new RestException(503, 'Error when retrieve intervention list : '.$this->db->lasterror());
238 }
239
240 //if $pagination_data is true the response will contain element data with all values and element pagination with pagination data(total,page,limit)
241 if ($pagination_data) {
242 $totalsResult = $this->db->query($sqlTotals);
243 $total = $this->db->fetch_object($totalsResult)->total;
244
245 $tmp = $obj_ret;
246 $obj_ret = [];
247
248 $obj_ret['data'] = $tmp;
249 $obj_ret['pagination'] = [
250 'total' => (int) $total,
251 'page' => $page, //count starts from 0
252 'page_count' => ceil((int) $total / $limit),
253 'limit' => $limit
254 ];
255 }
256
257 return $obj_ret;
258 }
259
272 public function post($request_data = null)
273 {
274 if (!DolibarrApiAccess::$user->hasRight('ficheinter', 'creer')) {
275 throw new RestException(403, "Insufficiant rights");
276 }
277 // Check mandatory fields
278 $result = $this->_validate($request_data);
279 foreach ($request_data as $field => $value) {
280 if ($field === 'caller') {
281 // Add a mention of caller so on trigger called after action, we can filter to avoid a loop if we try to sync back again with the caller
282 $this->fichinter->context['caller'] = sanitizeVal($request_data['caller'], 'aZ09');
283 continue;
284 }
285
286 $this->fichinter->$field = $this->_checkValForAPI($field, $value, $this->fichinter);
287 }
288
289 if ($this->fichinter->create(DolibarrApiAccess::$user) < 0) {
290 throw new RestException(500, "Error creating intervention", array_merge(array($this->fichinter->error), $this->fichinter->errors));
291 }
292
293 return $this->fichinter->id;
294 }
295
309 public function put($id, $request_data = null)
310 {
311 if (!DolibarrApiAccess::$user->hasRight('ficheinter', 'creer')) {
312 throw new RestException(403);
313 }
314
315 $result = $this->fichinter->fetch($id);
316 if (!$result) {
317 throw new RestException(404, 'Fichinter not found');
318 }
319
320 if (!DolibarrApi::_checkAccessToResource('fichinter', $this->fichinter->id)) {
321 throw new RestException(403, 'Access not allowed for login '.DolibarrApiAccess::$user->login);
322 }
323 foreach ($request_data as $field => $value) {
324 if ($field == 'id') {
325 continue;
326 }
327 if ($field === 'caller') {
328 // Add a mention of caller so on trigger called after action, we can filter to avoid a loop if we try to sync back again with the caller
329 $this->fichinter->context['caller'] = sanitizeVal($request_data['caller'], 'aZ09');
330 continue;
331 }
332 if ($field == 'array_options' && is_array($value)) {
333 foreach ($value as $index => $val) {
334 $this->fichinter->array_options[$index] = $this->_checkValExtrafieldsForAPI($index, $val, $this->fichinter);
335 }
336 continue;
337 }
338
339 $this->fichinter->$field = $this->_checkValForAPI($field, $value, $this->fichinter);
340 }
341
342 if ($this->fichinter->update(DolibarrApiAccess::$user) > 0) {
343 return $this->get($id);
344 } else {
345 throw new RestException(500, $this->fichinter->error);
346 }
347 }
348
358 /* TODO
359 public function getLines($id)
360 {
361 if(! DolibarrApiAccess::$user->hasRight('ficheinter', 'lire')) {
362 throw new RestException(403);
363 }
364
365 $result = $this->fichinter->fetch($id);
366 if( ! $result ) {
367 throw new RestException(404, 'Intervention not found');
368 }
369
370 if( ! DolibarrApi::_checkAccessToResource('fichinter',$this->fichinter->id)) {
371 throw new RestException(403, 'Access not allowed for login '.DolibarrApiAccess::$user->login);
372 }
373 $this->fichinter->getLinesArray();
374 $result = array();
375 foreach ($this->fichinter->lines as $line) {
376 array_push($result,$this->_cleanObjectDatas($line));
377 }
378 return $result;
379 }
380 */
381
398 public function postLine($id, $request_data = null)
399 {
400 if (!DolibarrApiAccess::$user->hasRight('ficheinter', 'creer')) {
401 throw new RestException(403, "Insufficiant rights");
402 }
403 // Check mandatory fields
404 $result = $this->_validateLine($request_data);
405
406 foreach ($request_data as $field => $value) {
407 if ($field === 'caller') {
408 // Add a mention of caller so on trigger called after action, we can filter to avoid a loop if we try to sync back again with the caller
409 $this->fichinter->context['caller'] = sanitizeVal($request_data['caller'], 'aZ09');
410 continue;
411 }
412
413 $this->fichinter->$field = $this->_checkValForAPI($field, $value, $this->fichinter);
414 }
415
416 if (!$result) {
417 throw new RestException(404, 'Intervention not found');
418 }
419
420 if (!DolibarrApi::_checkAccessToResource('fichinter', $this->fichinter->id)) {
421 throw new RestException(403, 'Access not allowed for login '.DolibarrApiAccess::$user->login);
422 }
423
424 $updateRes = $this->fichinter->addLine(
425 DolibarrApiAccess::$user,
426 $id,
427 $this->fichinter->description,
428 $this->fichinter->date,
429 $this->fichinter->duration
430 );
431
432 if ($updateRes > 0) {
433 return $updateRes;
434 } else {
435 throw new RestException(400, $this->fichinter->error);
436 }
437 }
438
451 public function delete($id)
452 {
453 if (!DolibarrApiAccess::$user->hasRight('ficheinter', 'supprimer')) {
454 throw new RestException(403);
455 }
456 $result = $this->fichinter->fetch($id);
457 if (!$result) {
458 throw new RestException(404, 'Intervention not found');
459 }
460
461 if (!DolibarrApi::_checkAccessToResource('fichinter', $this->fichinter->id)) {
462 throw new RestException(403, 'Access not allowed for login '.DolibarrApiAccess::$user->login);
463 }
464
465 if (!$this->fichinter->delete(DolibarrApiAccess::$user)) {
466 throw new RestException(500, 'Error when delete intervention : '.$this->fichinter->error);
467 }
468
469 return array(
470 'success' => array(
471 'code' => 200,
472 'message' => 'Intervention deleted'
473 )
474 );
475 }
476
496 public function validate($id, $notrigger = 0)
497 {
498 if (!DolibarrApiAccess::$user->hasRight('ficheinter', 'creer')) {
499 throw new RestException(403, "Insufficiant rights");
500 }
501 $result = $this->fichinter->fetch($id);
502 if (!$result) {
503 throw new RestException(404, 'Intervention not found');
504 }
505
506 if (!DolibarrApi::_checkAccessToResource('fichinter', $this->fichinter->id)) {
507 throw new RestException(403, 'Access not allowed for login '.DolibarrApiAccess::$user->login);
508 }
509
510 $result = $this->fichinter->setValid(DolibarrApiAccess::$user, $notrigger);
511 if ($result == 0) {
512 throw new RestException(304, 'Error nothing done. May be object is already validated');
513 }
514 if ($result < 0) {
515 throw new RestException(500, 'Error when validating Intervention: '.$this->fichinter->error);
516 }
517
518 $this->fichinter->fetchObjectLinked();
519
520 return $this->_cleanObjectDatas($this->fichinter);
521 }
522
544 public function close($id, $notrigger = 0)
545 {
546 if (!DolibarrApiAccess::$user->hasRight('ficheinter', 'creer')) {
547 throw new RestException(403, "Insufficiant rights");
548 }
549 $result = $this->fichinter->fetch($id);
550 if (!$result) {
551 throw new RestException(404, 'Intervention not found');
552 }
553
554 if (!DolibarrApi::_checkAccessToResource('fichinter', $this->fichinter->id)) {
555 throw new RestException(403, 'Access not allowed for login '.DolibarrApiAccess::$user->login);
556 }
557
558 $result = $this->fichinter->setClose(DolibarrApiAccess::$user, $notrigger);
559 if ($result == 0) {
560 throw new RestException(304, 'Error nothing done. May be object is already closed');
561 }
562 if ($result < 0) {
563 throw new RestException(500, 'Error when closing Intervention: '.$this->fichinter->error);
564 }
565
566 $this->fichinter->fetchObjectLinked();
567
568 return $this->_cleanObjectDatas($this->fichinter);
569 }
570
571
587 public function deleteLine($id, $lineid)
588 {
589 if (!DolibarrApiAccess::$user->hasRight('ficheinter', 'creer')) {
590 throw new RestException(403);
591 }
592
593 $result = $this->fichinter->fetch($id);
594 if (!$result) {
595 throw new RestException(404, 'Intervention not found');
596 }
597
598 if ($this->fichinter->status != 0) {
599 throw new RestException(403, 'Intervention not in draft status : '.$this->fichinter->getLibStatut(1));
600 }
601
602 if (!DolibarrApi::_checkAccessToResource('ficheinter', $this->fichinter->id)) {
603 throw new RestException(403, 'Access not allowed for login '.DolibarrApiAccess::$user->login);
604 }
605
606 $objectline = new FichinterLigne($this->db);
607 if ($objectline->fetch($lineid) <= 0) {
608 throw new RestException(404, 'Intervention line not found');
609 }
610
611 $updateRes = $objectline->deleteLine(DolibarrApiAccess::$user);
612
613 if ($updateRes >= 0) {
614 return $this->_cleanObjectDatas($this->fichinter);
615 } else {
616 throw new RestException(405, $this->fichinter->error);
617 }
618 }
619
636 public function settodraft($id)
637 {
638 if (!DolibarrApiAccess::$user->hasRight('ficheinter', 'creer')) {
639 throw new RestException(403, "Insufficiant rights");
640 }
641 $result = $this->fichinter->fetch($id);
642 if (!$result) {
643 throw new RestException(404, 'Intervention not found');
644 }
645
646 if (!DolibarrApi::_checkAccessToResource('ficheinter', $this->fichinter->id)) {
647 throw new RestException(403, 'Access not allowed for login '.DolibarrApiAccess::$user->login);
648 }
649
650 $result = $this->fichinter->setDraft(DolibarrApiAccess::$user);
651 if ($result == 0) {
652 throw new RestException(304, 'Nothing done. . May be object is already set as draft.');
653 }
654 if ($result < 0) {
655 throw new RestException(500, 'Error when closing intervention: '.$this->fichinter->error);
656 }
657
658 $this->fichinter->fetchObjectLinked();
659 return $this->_cleanObjectDatas($this->fichinter);
660 }
661
680 public function addContact($id, $fk_socpeople, $type_contact, $source, $notrigger = 0)
681 {
682 if (!DolibarrApiAccess::$user->hasRight('ficheinter', 'creer')) {
683 throw new RestException(403);
684 }
685 $result = $this->fichinter->fetch($id);
686 if (!$result) {
687 throw new RestException(404, 'Interventional not found');
688 }
689
690 if (!DolibarrApi::_checkAccessToResource('ficheinter', $this->fichinter->id)) {
691 throw new RestException(403, 'Access not allowed for login '.DolibarrApiAccess::$user->login);
692 }
693
694 $result = $this->fichinter->add_contact($fk_socpeople, $type_contact, $source, $notrigger);
695 if ($result < 0) {
696 throw new RestException(500, 'Error : '.$this->fichinter->error);
697 }
698
699 $result = $this->fichinter->fetch($id);
700 if (!$result) {
701 throw new RestException(404, 'Interventional not found');
702 }
703
704 return $this->_cleanObjectDatas($this->fichinter);
705 }
706
721 public function getContacts($id, $type = '', $source = '')
722 {
723 if (!DolibarrApiAccess::$user->hasRight('ficheinter', 'lire')) {
724 throw new RestException(403);
725 }
726
727 $result = $this->fichinter->fetch($id);
728 if (!$result) {
729 throw new RestException(404, 'Interventional not found');
730 }
731
732 if (!DolibarrApi::_checkAccessToResource('ficheinter', $this->fichinter->id)) {
733 throw new RestException(403, 'Access not allowed for login '.DolibarrApiAccess::$user->login);
734 }
735
736 if (empty($source) || $source == 'external') {
737 $contacts = $this->fichinter->liste_contact(-1, 'external', 0, $type);
738 } else {
739 $contacts = array();
740 }
741 if (empty($source) || $source == 'internal') {
742 $socpeoples = $this->fichinter->liste_contact(-1, 'internal', 0, $type);
743 } else {
744 $socpeoples = array();
745 }
746
747 $contacts = array_merge($contacts, $socpeoples);
748
749 return $contacts;
750 }
751
752
767 public function deleteContact($id, $contactid, $type)
768 {
769 if (!DolibarrApiAccess::$user->hasRight('ficheinter', 'creer')) {
770 throw new RestException(403);
771 }
772
773 $result = $this->fichinter->fetch($id);
774
775 if (!$result) {
776 throw new RestException(404, 'Interventional not found');
777 }
778
779 if (!DolibarrApi::_checkAccessToResource('ficheinter', $this->fichinter->id)) {
780 throw new RestException(403, 'Access not allowed for login '.DolibarrApiAccess::$user->login);
781 }
782 foreach (array('internal', 'external') as $source) {
783 $contacts = $this->fichinter->liste_contact(-1, $source);
784
785 foreach ($contacts as $contact) {
786 if ($contact['id'] == $contactid && $contact['code'] == $type) {
787 $result = $this->fichinter->delete_contact($contact['rowid']);
788 if (!$result) {
789 throw new RestException(500, 'Error when deleted the contact');
790 }
791 }
792 }
793 }
794 return $this->_cleanObjectDatas($this->fichinter);
795 }
796
813 public function putLine($id, $lineid, $request_data)
814 {
815 $result = $this->fichinter->fetch($id);
816 if (!$result) {
817 throw new RestException(404, 'Intervention not found');
818 }
819
820 if ($this->fichinter->status != 0) {
821 throw new RestException(403, 'Intervention not in draft status : '.$this->fichinter->getLibStatut(1));
822 }
823
824 if (!DolibarrApi::_checkAccessToResource('ficheinter', $this->fichinter->id)) {
825 throw new RestException(403, 'Access not allowed for login '.DolibarrApiAccess::$user->login);
826 }
827
828 $objectline = new FichinterLigne($this->db);
829 if ($objectline->fetch($lineid) <= 0) {
830 throw new RestException(404, 'Intervention line not found');
831 }
832 $request_data = (object) $request_data;
833
834 if (isset($request_data->desc) || isset($request_data->description)) {
835 $objectline->desc = sanitizeVal($request_data->desc ?? $request_data->description, 'restricthtml');
836 }
837 if (isset($request_data->date)) {
838 $objectline->date = (int) sanitizeVal($request_data->date);
839 }
840 if (isset($request_data->duration)) {
841 $objectline->duration = (int) sanitizeVal($request_data->duration);
842 }
843 if (isset($request_data->rang)) {
844 $objectline->rang = (int) sanitizeVal($request_data->rang);
845 }
846
847 $updateRes = $objectline->update(DolibarrApiAccess::$user);
848
849 if ($updateRes >= 0) {
850 $result = $this->fichinter->fetch($id);
851 if ($result > 0) {
852 return $this->_cleanObjectDatas($this->fichinter);
853 } else {
854 throw new RestException(500, $this->fichinter->error);
855 }
856 } else {
857 throw new RestException(500, $objectline->error);
858 }
859 }
860
861
870 private function _validate($data)
871 {
872 $fichinter = array();
873 foreach (Interventions::$FIELDS as $field) {
874 if (!isset($data[$field])) {
875 throw new RestException(400, "$field field missing");
876 }
877 $fichinter[$field] = $data[$field];
878 }
879 return $fichinter;
880 }
881
882
883 // phpcs:disable PEAR.NamingConventions.ValidFunctionName.PublicUnderscore
893 protected function _cleanObjectDatas($object)
894 {
895 // phpcs:enable
896 $object = parent::_cleanObjectDatas($object);
897
898 unset($object->labelStatus);
899 unset($object->labelStatusShort);
900
901 return $object;
902 }
903
912 private function _validateLine($data)
913 {
914 if ($data === null) {
915 $data = array();
916 }
917 $fichinter = array();
918 foreach (Interventions::$FIELDSLINE as $field) {
919 if (!isset($data[$field])) {
920 throw new RestException(400, "$field field missing");
921 }
922 $fichinter[$field] = $data[$field];
923 }
924 return $fichinter;
925 }
926}
$id
Support class for third parties, contacts, members, users or resources.
Definition account.php:47
if(! $sortfield) if(! $sortorder) $object
Definition account.php:100
Class for API REST v1.
Definition api.class.php:35
_checkValExtrafieldsForAPI($field, $value, $object)
Check and convert a string depending on its type/name.
_filterObjectProperties($object, $properties)
Filter properties that will be returned on object.
static _checkAccessToResource($resource, $resource_id=0, $dbtablename='', $feature2='', $dbt_keyfield='fk_soc', $dbt_select='rowid')
Check access by user to a given resource.
_checkValForAPI($field, $value, $object)
Check and convert a string depending on its type/name.
Class to manage intervention lines.
index($sortfield="t.rowid", $sortorder='ASC', $limit=100, $page=0, $thirdparty_ids='', $sqlfilters='', $properties='', $contact_type='', $pagination_data=false, $loadlinkedobjects=0)
List interventions.
addContact($id, $fk_socpeople, $type_contact, $source, $notrigger=0)
Adds a contact to an interventional.
_cleanObjectDatas($object)
Clean sensible object data @phpstan-template T.
validate($id, $notrigger=0)
Validate an intervention.
_validateLine($data)
Validate fields before create or update object.
getContacts($id, $type='', $source='')
Get contacts of given interventional.
put($id, $request_data=null)
Update intervention general fields (won't touch lines of fichinter)
post($request_data=null)
Create an intervention.
_validate($data)
Validate fields before create or update object.
close($id, $notrigger=0)
Close an intervention.
putLine($id, $lineid, $request_data)
Update a line of an intervention.
deleteLine($id, $lineid)
Delete the line of the intervention.
deleteContact($id, $contactid, $type)
Delete a contact type of given interventional.
settodraft($id)
Sets an intervention as draft.
postLine($id, $request_data=null)
Get lines of intervention.
if(!isModEnabled('ai')||!getDolGlobalString('AI_ASSISTANT_ENABLED')) global $db
API class for accounts.
sanitizeVal($out='', $check='alphanohtml', $filter=null, $options=null)
Return a sanitized or empty value after checking value against a rule.
dol_syslog($message, $level=LOG_INFO, $ident=0, $suffixinfilename='', $restricttologhandler='', $logcontext=null)
Write log message into outputs.