dolibarr 25.0.0-alpha
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";
31require_once DOL_DOCUMENT_ROOT.'/core/lib/company.lib.php';
32
33
34
44{
48 public static $FIELDS = array(
49 'socid',
50 'fk_project',
51 'description',
52 );
53
57 public static $FIELDSLINE = array(
58 'description',
59 'date',
60 'duration',
61 );
62
66 public $fichinter;
67
71 public function __construct()
72 {
73 global $db;
74 $this->db = $db;
75 $this->fichinter = new Fichinter($this->db);
76 }
77
92 public function get($id, $ref = '', $ref_ext = '', $contact_list = 1)
93 {
94 if (!DolibarrApiAccess::$user->hasRight('ficheinter', 'lire')) {
95 throw new RestException(403);
96 }
97
98 $result = $this->fichinter->fetch($id, $ref, $ref_ext);
99 if (!$result) {
100 throw new RestException(404, 'Intervention not found');
101 }
102
103 if (!DolibarrApi::_checkAccessToResource('fichinter', $this->fichinter->id)) {
104 throw new RestException(403, 'Access not allowed for login '.DolibarrApiAccess::$user->login);
105 }
106
107 if ($contact_list > -1) {
108 // Add external contacts ids
109 $tmparray = $this->fichinter->liste_contact(-1, 'external', $contact_list);
110 if (is_array($tmparray)) {
111 $this->fichinter->contacts_ids = $tmparray;
112 }
113 $tmparray = $this->fichinter->liste_contact(-1, 'internal', $contact_list);
114 if (is_array($tmparray)) {
115 $this->fichinter->contacts_ids_internal = $tmparray;
116 }
117 }
118
119 $this->fichinter->fetchObjectLinked();
120
121 return $this->_cleanObjectDatas($this->fichinter);
122 }
123
147 public function index($sortfield = "t.rowid", $sortorder = 'ASC', $limit = 100, $page = 0, $thirdparty_ids = '', $sqlfilters = '', $properties = '', $contact_type = '', $pagination_data = false, $loadlinkedobjects = 0)
148 {
149 if (!DolibarrApiAccess::$user->hasRight('ficheinter', 'lire')) {
150 throw new RestException(403);
151 }
152
153 global $hookmanager;
154
155 $obj_ret = array();
156
157 // case of external user, $thirdparty_ids param is ignored and replaced by user's socid
158 $socids = DolibarrApiAccess::$user->socid ?: $thirdparty_ids;
159
160 // If the internal user must only see his customers, force searching by him
161 $search_sale = 0;
162 if (!DolibarrApiAccess::$user->hasRight('societe', 'client', 'voir') && !$socids) {
163 $search_sale = DolibarrApiAccess::$user->id;
164 }
165
166 $sql = "SELECT t.rowid";
167 $sql .= " FROM ".MAIN_DB_PREFIX."fichinter AS t";
168 $sql .= " INNER JOIN ".MAIN_DB_PREFIX."societe AS s ON (s.rowid = t.fk_soc)";
169 $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
170 $sql .= ' WHERE t.entity IN ('.getEntity('intervention').')';
171 if ($socids) {
172 $sql .= " AND t.fk_soc IN (".$this->db->sanitize($socids).")";
173 }
174 // Search on sale representative
175 if ($search_sale && $search_sale != '-1') {
176 if ($search_sale == -2) {
177 $sql .= " AND ".getSalesRepresentativeSqlFilter('t.fk_soc', 0, 1);
178 } elseif ($search_sale > 0) {
179 $sql .= " AND ".getSalesRepresentativeSqlFilter('t.fk_soc', (int) $search_sale);
180 }
181 }
182
183 if ($sqlfilters) {
184 $parameters = array('sqlfilters' => $sqlfilters, 'apiroute' => 'interventions', 'apimethod' => __METHOD__);
185 $action = 'list';
186 $reshook = $hookmanager->executeHooks('printFieldListWhere', $parameters, $this->fichinter, $action); // Note that $action and $object may have been modified by hook
187 if ($reshook > 0) {
188 $sql = $hookmanager->resPrint;
189 } elseif ($reshook == 0) {
190 $sql .= $hookmanager->resPrint;
191 }
192
193 $errormessage = '';
194 $sql .= forgeSQLFromUniversalSearchCriteria($sqlfilters, $errormessage);
195 if ($errormessage) {
196 throw new RestException(400, 'Error when validating parameter sqlfilters -> '.$errormessage);
197 }
198 }
199
200 //this query will return total interventions with the filters given
201 $sqlTotals = str_replace('SELECT t.rowid', 'SELECT count(t.rowid) as total', $sql);
202
203 $sql .= $this->db->order($sortfield, $sortorder);
204 if ($limit) {
205 if ($page < 0) {
206 $page = 0;
207 }
208 $offset = $limit * $page;
209
210 $sql .= $this->db->plimit($limit + 1, $offset);
211 }
212
213 dol_syslog("API Rest request");
214 $result = $this->db->query($sql);
215
216 if ($result) {
217 $num = $this->db->num_rows($result);
218 $min = min($num, ($limit <= 0 ? $num : $limit));
219 $i = 0;
220 while ($i < $min) {
221 $obj = $this->db->fetch_object($result);
222 $fichinter_static = new Fichinter($this->db);
223 if ($fichinter_static->fetch($obj->rowid)) {
224 if ($contact_type) {
225 $fichinter_static->contacts_ids = $fichinter_static->liste_contact(-1, $contact_type, 1);
226 }
227
228 if ($loadlinkedobjects) {
229 // retrieve linked objects
230 $fichinter_static->fetchObjectLinked();
231 }
232
233 $obj_ret[] = $this->_filterObjectProperties($this->_cleanObjectDatas($fichinter_static), $properties);
234 }
235 $i++;
236 }
237 } else {
238 throw new RestException(503, 'Error when retrieve intervention list : '.$this->db->lasterror());
239 }
240
241 //if $pagination_data is true the response will contain element data with all values and element pagination with pagination data(total,page,limit)
242 if ($pagination_data) {
243 $totalsResult = $this->db->query($sqlTotals);
244 $total = $this->db->fetch_object($totalsResult)->total;
245
246 $tmp = $obj_ret;
247 $obj_ret = [];
248
249 $obj_ret['data'] = $tmp;
250 $obj_ret['pagination'] = [
251 'total' => (int) $total,
252 'page' => $page, //count starts from 0
253 'page_count' => ceil((int) $total / $limit),
254 'limit' => $limit
255 ];
256 }
257
258 return $obj_ret;
259 }
260
273 public function post($request_data = null)
274 {
275 if (!DolibarrApiAccess::$user->hasRight('ficheinter', 'creer')) {
276 throw new RestException(403, "Insufficiant rights");
277 }
278 // Check mandatory fields
279 $result = $this->_validate($request_data);
280 foreach ($request_data as $field => $value) {
281 if ($field === 'caller') {
282 // 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
283 $this->fichinter->context['caller'] = sanitizeVal($request_data['caller'], 'aZ09');
284 continue;
285 }
286
287 $this->fichinter->$field = $this->_checkValForAPI($field, $value, $this->fichinter);
288 }
289
290 if ($this->fichinter->create(DolibarrApiAccess::$user) < 0) {
291 throw new RestException(500, "Error creating intervention", array_merge(array($this->fichinter->error), $this->fichinter->errors));
292 }
293
294 return $this->fichinter->id;
295 }
296
310 public function put($id, $request_data = null)
311 {
312 if (!DolibarrApiAccess::$user->hasRight('ficheinter', 'creer')) {
313 throw new RestException(403);
314 }
315
316 $result = $this->fichinter->fetch($id);
317 if (!$result) {
318 throw new RestException(404, 'Fichinter not found');
319 }
320
321 if (!DolibarrApi::_checkAccessToResource('fichinter', $this->fichinter->id)) {
322 throw new RestException(403, 'Access not allowed for login '.DolibarrApiAccess::$user->login);
323 }
324 foreach ($request_data as $field => $value) {
325 if ($field == 'id') {
326 continue;
327 }
328 if ($field === 'caller') {
329 // 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
330 $this->fichinter->context['caller'] = sanitizeVal($request_data['caller'], 'aZ09');
331 continue;
332 }
333 if ($field == 'array_options' && is_array($value)) {
334 foreach ($value as $index => $val) {
335 $this->fichinter->array_options[$index] = $this->_checkValExtrafieldsForAPI($index, $val, $this->fichinter);
336 }
337 continue;
338 }
339
340 $this->fichinter->$field = $this->_checkValForAPI($field, $value, $this->fichinter);
341 }
342
343 if ($this->fichinter->update(DolibarrApiAccess::$user) > 0) {
344 return $this->get($id);
345 } else {
346 throw new RestException(500, $this->fichinter->error);
347 }
348 }
349
359 /* TODO
360 public function getLines($id)
361 {
362 if(! DolibarrApiAccess::$user->hasRight('ficheinter', 'lire')) {
363 throw new RestException(403);
364 }
365
366 $result = $this->fichinter->fetch($id);
367 if( ! $result ) {
368 throw new RestException(404, 'Intervention not found');
369 }
370
371 if( ! DolibarrApi::_checkAccessToResource('fichinter',$this->fichinter->id)) {
372 throw new RestException(403, 'Access not allowed for login '.DolibarrApiAccess::$user->login);
373 }
374 $this->fichinter->getLinesArray();
375 $result = array();
376 foreach ($this->fichinter->lines as $line) {
377 array_push($result,$this->_cleanObjectDatas($line));
378 }
379 return $result;
380 }
381 */
382
399 public function postLine($id, $request_data = null)
400 {
401 if (!DolibarrApiAccess::$user->hasRight('ficheinter', 'creer')) {
402 throw new RestException(403, "Insufficiant rights");
403 }
404 // Check mandatory fields
405 $result = $this->_validateLine($request_data);
406
407 foreach ($request_data as $field => $value) {
408 if ($field === 'caller') {
409 // 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
410 $this->fichinter->context['caller'] = sanitizeVal($request_data['caller'], 'aZ09');
411 continue;
412 }
413
414 $this->fichinter->$field = $this->_checkValForAPI($field, $value, $this->fichinter);
415 }
416
417 if (!$result) {
418 throw new RestException(404, 'Intervention not found');
419 }
420
421 if (!DolibarrApi::_checkAccessToResource('fichinter', $this->fichinter->id)) {
422 throw new RestException(403, 'Access not allowed for login '.DolibarrApiAccess::$user->login);
423 }
424
425 $updateRes = $this->fichinter->addLine(
426 DolibarrApiAccess::$user,
427 $id,
428 $this->fichinter->description,
429 $this->fichinter->date,
430 $this->fichinter->duration
431 );
432
433 if ($updateRes > 0) {
434 return $updateRes;
435 } else {
436 throw new RestException(400, $this->fichinter->error);
437 }
438 }
439
452 public function delete($id)
453 {
454 if (!DolibarrApiAccess::$user->hasRight('ficheinter', 'supprimer')) {
455 throw new RestException(403);
456 }
457 $result = $this->fichinter->fetch($id);
458 if (!$result) {
459 throw new RestException(404, 'Intervention not found');
460 }
461
462 if (!DolibarrApi::_checkAccessToResource('fichinter', $this->fichinter->id)) {
463 throw new RestException(403, 'Access not allowed for login '.DolibarrApiAccess::$user->login);
464 }
465
466 if (!$this->fichinter->delete(DolibarrApiAccess::$user)) {
467 throw new RestException(500, 'Error when delete intervention : '.$this->fichinter->error);
468 }
469
470 return array(
471 'success' => array(
472 'code' => 200,
473 'message' => 'Intervention deleted'
474 )
475 );
476 }
477
497 public function validate($id, $notrigger = 0)
498 {
499 if (!DolibarrApiAccess::$user->hasRight('ficheinter', 'creer')) {
500 throw new RestException(403, "Insufficiant rights");
501 }
502 $result = $this->fichinter->fetch($id);
503 if (!$result) {
504 throw new RestException(404, 'Intervention not found');
505 }
506
507 if (!DolibarrApi::_checkAccessToResource('fichinter', $this->fichinter->id)) {
508 throw new RestException(403, 'Access not allowed for login '.DolibarrApiAccess::$user->login);
509 }
510
511 $result = $this->fichinter->setValid(DolibarrApiAccess::$user, $notrigger);
512 if ($result == 0) {
513 throw new RestException(304, 'Error nothing done. May be object is already validated');
514 }
515 if ($result < 0) {
516 throw new RestException(500, 'Error when validating Intervention: '.$this->fichinter->error);
517 }
518
519 $this->fichinter->fetchObjectLinked();
520
521 return $this->_cleanObjectDatas($this->fichinter);
522 }
523
545 public function close($id, $notrigger = 0)
546 {
547 if (!DolibarrApiAccess::$user->hasRight('ficheinter', 'creer')) {
548 throw new RestException(403, "Insufficiant rights");
549 }
550 $result = $this->fichinter->fetch($id);
551 if (!$result) {
552 throw new RestException(404, 'Intervention not found');
553 }
554
555 if (!DolibarrApi::_checkAccessToResource('fichinter', $this->fichinter->id)) {
556 throw new RestException(403, 'Access not allowed for login '.DolibarrApiAccess::$user->login);
557 }
558
559 $result = $this->fichinter->setClose(DolibarrApiAccess::$user, $notrigger);
560 if ($result == 0) {
561 throw new RestException(304, 'Error nothing done. May be object is already closed');
562 }
563 if ($result < 0) {
564 throw new RestException(500, 'Error when closing Intervention: '.$this->fichinter->error);
565 }
566
567 $this->fichinter->fetchObjectLinked();
568
569 return $this->_cleanObjectDatas($this->fichinter);
570 }
571
572
588 public function deleteLine($id, $lineid)
589 {
590 if (!DolibarrApiAccess::$user->hasRight('ficheinter', 'creer')) {
591 throw new RestException(403);
592 }
593
594 $result = $this->fichinter->fetch($id);
595 if (!$result) {
596 throw new RestException(404, 'Intervention not found');
597 }
598
599 if ($this->fichinter->status != 0) {
600 throw new RestException(403, 'Intervention not in draft status : '.$this->fichinter->getLibStatut(1));
601 }
602
603 if (!DolibarrApi::_checkAccessToResource('ficheinter', $this->fichinter->id)) {
604 throw new RestException(403, 'Access not allowed for login '.DolibarrApiAccess::$user->login);
605 }
606
607 $objectline = new FichinterLigne($this->db);
608 if ($objectline->fetch($lineid) <= 0) {
609 throw new RestException(404, 'Intervention line not found');
610 }
611
612 $updateRes = $objectline->deleteLine(DolibarrApiAccess::$user);
613
614 if ($updateRes >= 0) {
615 return $this->_cleanObjectDatas($this->fichinter);
616 } else {
617 throw new RestException(405, $this->fichinter->error);
618 }
619 }
620
637 public function settodraft($id)
638 {
639 if (!DolibarrApiAccess::$user->hasRight('ficheinter', 'creer')) {
640 throw new RestException(403, "Insufficiant rights");
641 }
642 $result = $this->fichinter->fetch($id);
643 if (!$result) {
644 throw new RestException(404, 'Intervention not found');
645 }
646
647 if (!DolibarrApi::_checkAccessToResource('ficheinter', $this->fichinter->id)) {
648 throw new RestException(403, 'Access not allowed for login '.DolibarrApiAccess::$user->login);
649 }
650
651 $result = $this->fichinter->setDraft(DolibarrApiAccess::$user);
652 if ($result == 0) {
653 throw new RestException(304, 'Nothing done. . May be object is already set as draft.');
654 }
655 if ($result < 0) {
656 throw new RestException(500, 'Error when closing intervention: '.$this->fichinter->error);
657 }
658
659 $this->fichinter->fetchObjectLinked();
660 return $this->_cleanObjectDatas($this->fichinter);
661 }
662
681 public function addContact($id, $fk_socpeople, $type_contact, $source, $notrigger = 0)
682 {
683 if (!DolibarrApiAccess::$user->hasRight('ficheinter', 'creer')) {
684 throw new RestException(403);
685 }
686 $result = $this->fichinter->fetch($id);
687 if (!$result) {
688 throw new RestException(404, 'Interventional not found');
689 }
690
691 if (!DolibarrApi::_checkAccessToResource('ficheinter', $this->fichinter->id)) {
692 throw new RestException(403, 'Access not allowed for login '.DolibarrApiAccess::$user->login);
693 }
694
695 $result = $this->fichinter->add_contact($fk_socpeople, $type_contact, $source, $notrigger);
696 if ($result < 0) {
697 throw new RestException(500, 'Error : '.$this->fichinter->error);
698 }
699
700 $result = $this->fichinter->fetch($id);
701 if (!$result) {
702 throw new RestException(404, 'Interventional not found');
703 }
704
705 return $this->_cleanObjectDatas($this->fichinter);
706 }
707
722 public function getContacts($id, $type = '', $source = '')
723 {
724 if (!DolibarrApiAccess::$user->hasRight('ficheinter', 'lire')) {
725 throw new RestException(403);
726 }
727
728 $result = $this->fichinter->fetch($id);
729 if (!$result) {
730 throw new RestException(404, 'Interventional not found');
731 }
732
733 if (!DolibarrApi::_checkAccessToResource('ficheinter', $this->fichinter->id)) {
734 throw new RestException(403, 'Access not allowed for login '.DolibarrApiAccess::$user->login);
735 }
736
737 if (empty($source) || $source == 'external') {
738 $contacts = $this->fichinter->liste_contact(-1, 'external', 0, $type);
739 } else {
740 $contacts = array();
741 }
742 if (empty($source) || $source == 'internal') {
743 $socpeoples = $this->fichinter->liste_contact(-1, 'internal', 0, $type);
744 } else {
745 $socpeoples = array();
746 }
747
748 $contacts = array_merge($contacts, $socpeoples);
749
750 return $contacts;
751 }
752
753
768 public function deleteContact($id, $contactid, $type)
769 {
770 if (!DolibarrApiAccess::$user->hasRight('ficheinter', 'creer')) {
771 throw new RestException(403);
772 }
773
774 $result = $this->fichinter->fetch($id);
775
776 if (!$result) {
777 throw new RestException(404, 'Interventional not found');
778 }
779
780 if (!DolibarrApi::_checkAccessToResource('ficheinter', $this->fichinter->id)) {
781 throw new RestException(403, 'Access not allowed for login '.DolibarrApiAccess::$user->login);
782 }
783 foreach (array('internal', 'external') as $source) {
784 $contacts = $this->fichinter->liste_contact(-1, $source);
785
786 foreach ($contacts as $contact) {
787 if ($contact['id'] == $contactid && $contact['code'] == $type) {
788 $result = $this->fichinter->delete_contact($contact['rowid']);
789 if (!$result) {
790 throw new RestException(500, 'Error when deleted the contact');
791 }
792 }
793 }
794 }
795 return $this->_cleanObjectDatas($this->fichinter);
796 }
797
814 public function putLine($id, $lineid, $request_data)
815 {
816 $result = $this->fichinter->fetch($id);
817 if (!$result) {
818 throw new RestException(404, 'Intervention not found');
819 }
820
821 if ($this->fichinter->status != 0) {
822 throw new RestException(403, 'Intervention not in draft status : '.$this->fichinter->getLibStatut(1));
823 }
824
825 if (!DolibarrApi::_checkAccessToResource('ficheinter', $this->fichinter->id)) {
826 throw new RestException(403, 'Access not allowed for login '.DolibarrApiAccess::$user->login);
827 }
828
829 $objectline = new FichinterLigne($this->db);
830 if ($objectline->fetch($lineid) <= 0) {
831 throw new RestException(404, 'Intervention line not found');
832 }
833 $request_data = (object) $request_data;
834
835 if (isset($request_data->desc) || isset($request_data->description)) {
836 $objectline->desc = sanitizeVal($request_data->desc ?? $request_data->description, 'restricthtml');
837 }
838 if (isset($request_data->date)) {
839 $objectline->date = (int) sanitizeVal($request_data->date);
840 }
841 if (isset($request_data->duration)) {
842 $objectline->duration = (int) sanitizeVal($request_data->duration);
843 }
844 if (isset($request_data->rang)) {
845 $objectline->rang = (int) sanitizeVal($request_data->rang);
846 }
847
848 $updateRes = $objectline->update(DolibarrApiAccess::$user);
849
850 if ($updateRes >= 0) {
851 $result = $this->fichinter->fetch($id);
852 if ($result > 0) {
853 return $this->_cleanObjectDatas($this->fichinter);
854 } else {
855 throw new RestException(500, $this->fichinter->error);
856 }
857 } else {
858 throw new RestException(500, $objectline->error);
859 }
860 }
861
862
871 private function _validate($data)
872 {
873 $fichinter = array();
874 foreach (Interventions::$FIELDS as $field) {
875 if (!isset($data[$field])) {
876 throw new RestException(400, "$field field missing");
877 }
878 $fichinter[$field] = $data[$field];
879 }
880 return $fichinter;
881 }
882
883
884 // phpcs:disable PEAR.NamingConventions.ValidFunctionName.PublicUnderscore
894 protected function _cleanObjectDatas($object)
895 {
896 // phpcs:enable
897 $object = parent::_cleanObjectDatas($object);
898
899 unset($object->labelStatus);
900 unset($object->labelStatusShort);
901
902 return $object;
903 }
904
913 private function _validateLine($data)
914 {
915 if ($data === null) {
916 $data = array();
917 }
918 $fichinter = array();
919 foreach (Interventions::$FIELDSLINE as $field) {
920 if (!isset($data[$field])) {
921 throw new RestException(400, "$field field missing");
922 }
923 $fichinter[$field] = $data[$field];
924 }
925 return $fichinter;
926 }
927}
$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.
_checkValForAPI($field, $value, $object)
Check and convert a string depending on its type/name.
static _checkAccessToResource($resource, $resource_id=0, $dbtablename='', $feature2='', $dbt_keyfield='fk_soc', $dbt_select='rowid', $parenttableforentity='')
Check access by user to a given resource.
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.
forgeSQLFromUniversalSearchCriteria($filter, &$errorstr='', $noand=0, $nopar=0, $noerror=0, $forbiddenfields=array())
forgeSQLFromUniversalSearchCriteria
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.