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->errorsToString());
347 }
348 }
349
364 public function getLines($id)
365 {
366 if (!DolibarrApiAccess::$user->hasRight('ficheinter', 'lire')) {
367 throw new RestException(403);
368 }
369
370 $result = $this->fichinter->fetch($id);
371 if (!$result) {
372 throw new RestException(404, 'Intervention not found');
373 }
374
375 if (!DolibarrApi::_checkAccessToResource('fichinter', $this->fichinter->id)) {
376 throw new RestException(403, 'Access not allowed for login '.DolibarrApiAccess::$user->login);
377 }
378
379 $this->fichinter->fetch_lines();
380 $result = array();
381 foreach ($this->fichinter->lines as $line) {
382 $result[] = $this->_cleanObjectDatas($line);
383 }
384 return $result;
385 }
386
403 public function postLine($id, $request_data = null)
404 {
405 if (!DolibarrApiAccess::$user->hasRight('ficheinter', 'creer')) {
406 throw new RestException(403, "Insufficiant rights");
407 }
408 // Check mandatory fields
409 $result = $this->_validateLine($request_data);
410
411 foreach ($request_data as $field => $value) {
412 if ($field === 'caller') {
413 // 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
414 $this->fichinter->context['caller'] = sanitizeVal($request_data['caller'], 'aZ09');
415 continue;
416 }
417
418 $this->fichinter->$field = $this->_checkValForAPI($field, $value, $this->fichinter);
419 }
420
421 if (!$result) {
422 throw new RestException(404, 'Intervention not found');
423 }
424
425 if (!DolibarrApi::_checkAccessToResource('fichinter', $this->fichinter->id)) {
426 throw new RestException(403, 'Access not allowed for login '.DolibarrApiAccess::$user->login);
427 }
428
429 $updateRes = $this->fichinter->addLine(
430 DolibarrApiAccess::$user,
431 $id,
432 $this->fichinter->description,
433 $this->fichinter->date,
434 $this->fichinter->duration
435 );
436
437 if ($updateRes > 0) {
438 return $updateRes;
439 } else {
440 throw new RestException(400, $this->fichinter->errorsToString());
441 }
442 }
443
456 public function delete($id)
457 {
458 if (!DolibarrApiAccess::$user->hasRight('ficheinter', 'supprimer')) {
459 throw new RestException(403);
460 }
461 $result = $this->fichinter->fetch($id);
462 if (!$result) {
463 throw new RestException(404, 'Intervention not found');
464 }
465
466 if (!DolibarrApi::_checkAccessToResource('fichinter', $this->fichinter->id)) {
467 throw new RestException(403, 'Access not allowed for login '.DolibarrApiAccess::$user->login);
468 }
469
470 if (!$this->fichinter->delete(DolibarrApiAccess::$user)) {
471 throw new RestException(500, 'Error when delete intervention : '.$this->fichinter->errorsToString());
472 }
473
474 return array(
475 'success' => array(
476 'code' => 200,
477 'message' => 'Intervention deleted'
478 )
479 );
480 }
481
501 public function validate($id, $notrigger = 0)
502 {
503 if (!DolibarrApiAccess::$user->hasRight('ficheinter', 'creer')) {
504 throw new RestException(403, "Insufficiant rights");
505 }
506 $result = $this->fichinter->fetch($id);
507 if (!$result) {
508 throw new RestException(404, 'Intervention not found');
509 }
510
511 if (!DolibarrApi::_checkAccessToResource('fichinter', $this->fichinter->id)) {
512 throw new RestException(403, 'Access not allowed for login '.DolibarrApiAccess::$user->login);
513 }
514
515 $result = $this->fichinter->setValid(DolibarrApiAccess::$user, $notrigger);
516 if ($result == 0) {
517 throw new RestException(304, 'Error nothing done. May be object is already validated');
518 }
519 if ($result < 0) {
520 throw new RestException(500, 'Error when validating Intervention: '.$this->fichinter->errorsToString());
521 }
522
523 $this->fichinter->fetchObjectLinked();
524
525 return $this->_cleanObjectDatas($this->fichinter);
526 }
527
549 public function close($id, $notrigger = 0)
550 {
551 if (!DolibarrApiAccess::$user->hasRight('ficheinter', 'creer')) {
552 throw new RestException(403, "Insufficiant rights");
553 }
554 $result = $this->fichinter->fetch($id);
555 if (!$result) {
556 throw new RestException(404, 'Intervention not found');
557 }
558
559 if (!DolibarrApi::_checkAccessToResource('fichinter', $this->fichinter->id)) {
560 throw new RestException(403, 'Access not allowed for login '.DolibarrApiAccess::$user->login);
561 }
562
563 $result = $this->fichinter->setClose(DolibarrApiAccess::$user, $notrigger);
564 if ($result == 0) {
565 throw new RestException(304, 'Error nothing done. May be object is already closed');
566 }
567 if ($result < 0) {
568 throw new RestException(500, 'Error when closing Intervention: '.$this->fichinter->errorsToString());
569 }
570
571 $this->fichinter->fetchObjectLinked();
572
573 return $this->_cleanObjectDatas($this->fichinter);
574 }
575
576
592 public function deleteLine($id, $lineid)
593 {
594 if (!DolibarrApiAccess::$user->hasRight('ficheinter', 'creer')) {
595 throw new RestException(403);
596 }
597
598 $result = $this->fichinter->fetch($id);
599 if (!$result) {
600 throw new RestException(404, 'Intervention not found');
601 }
602
603 if ($this->fichinter->status != 0) {
604 throw new RestException(403, 'Intervention not in draft status : '.$this->fichinter->getLibStatut(1));
605 }
606
607 if (!DolibarrApi::_checkAccessToResource('ficheinter', $this->fichinter->id)) {
608 throw new RestException(403, 'Access not allowed for login '.DolibarrApiAccess::$user->login);
609 }
610
611 $objectline = new FichinterLigne($this->db);
612 if ($objectline->fetch($lineid) <= 0) {
613 throw new RestException(404, 'Intervention line not found');
614 }
615 if ($objectline->fk_fichinter != $this->fichinter->id) {
616 throw new RestException(403, 'Line does not belong to this intervention');
617 }
618
619 $updateRes = $objectline->deleteLine(DolibarrApiAccess::$user);
620
621 if ($updateRes >= 0) {
622 return $this->_cleanObjectDatas($this->fichinter);
623 } else {
624 throw new RestException(405, $this->fichinter->errorsToString());
625 }
626 }
627
644 public function settodraft($id)
645 {
646 if (!DolibarrApiAccess::$user->hasRight('ficheinter', 'creer')) {
647 throw new RestException(403, "Insufficiant rights");
648 }
649 $result = $this->fichinter->fetch($id);
650 if (!$result) {
651 throw new RestException(404, 'Intervention not found');
652 }
653
654 if (!DolibarrApi::_checkAccessToResource('ficheinter', $this->fichinter->id)) {
655 throw new RestException(403, 'Access not allowed for login '.DolibarrApiAccess::$user->login);
656 }
657
658 $result = $this->fichinter->setDraft(DolibarrApiAccess::$user);
659 if ($result == 0) {
660 throw new RestException(304, 'Nothing done. . May be object is already set as draft.');
661 }
662 if ($result < 0) {
663 throw new RestException(500, 'Error when closing intervention: '.$this->fichinter->errorsToString());
664 }
665
666 $this->fichinter->fetchObjectLinked();
667 return $this->_cleanObjectDatas($this->fichinter);
668 }
669
688 public function addContact($id, $fk_socpeople, $type_contact, $source, $notrigger = 0)
689 {
690 if (!DolibarrApiAccess::$user->hasRight('ficheinter', 'creer')) {
691 throw new RestException(403);
692 }
693 $result = $this->fichinter->fetch($id);
694 if (!$result) {
695 throw new RestException(404, 'Interventional not found');
696 }
697
698 if (!DolibarrApi::_checkAccessToResource('ficheinter', $this->fichinter->id)) {
699 throw new RestException(403, 'Access not allowed for login '.DolibarrApiAccess::$user->login);
700 }
701
702 $result = $this->fichinter->add_contact($fk_socpeople, $type_contact, $source, $notrigger);
703 if ($result < 0) {
704 throw new RestException(500, 'Error : '.$this->fichinter->errorsToString());
705 }
706
707 $result = $this->fichinter->fetch($id);
708 if (!$result) {
709 throw new RestException(404, 'Interventional not found');
710 }
711
712 return $this->_cleanObjectDatas($this->fichinter);
713 }
714
729 public function getContacts($id, $type = '', $source = '')
730 {
731 if (!DolibarrApiAccess::$user->hasRight('ficheinter', 'lire')) {
732 throw new RestException(403);
733 }
734
735 $result = $this->fichinter->fetch($id);
736 if (!$result) {
737 throw new RestException(404, 'Interventional not found');
738 }
739
740 if (!DolibarrApi::_checkAccessToResource('ficheinter', $this->fichinter->id)) {
741 throw new RestException(403, 'Access not allowed for login '.DolibarrApiAccess::$user->login);
742 }
743
744 if (empty($source) || $source == 'external') {
745 $contacts = $this->fichinter->liste_contact(-1, 'external', 0, $type);
746 } else {
747 $contacts = array();
748 }
749 if (empty($source) || $source == 'internal') {
750 $socpeoples = $this->fichinter->liste_contact(-1, 'internal', 0, $type);
751 } else {
752 $socpeoples = array();
753 }
754
755 $contacts = array_merge($contacts, $socpeoples);
756
757 return $contacts;
758 }
759
760
775 public function deleteContact($id, $contactid, $type)
776 {
777 if (!DolibarrApiAccess::$user->hasRight('ficheinter', 'creer')) {
778 throw new RestException(403);
779 }
780
781 $result = $this->fichinter->fetch($id);
782
783 if (!$result) {
784 throw new RestException(404, 'Interventional not found');
785 }
786
787 if (!DolibarrApi::_checkAccessToResource('ficheinter', $this->fichinter->id)) {
788 throw new RestException(403, 'Access not allowed for login '.DolibarrApiAccess::$user->login);
789 }
790 foreach (array('internal', 'external') as $source) {
791 $contacts = $this->fichinter->liste_contact(-1, $source);
792
793 foreach ($contacts as $contact) {
794 if ($contact['id'] == $contactid && $contact['code'] == $type) {
795 $result = $this->fichinter->delete_contact($contact['rowid']);
796 if (!$result) {
797 throw new RestException(500, 'Error when deleted the contact');
798 }
799 }
800 }
801 }
802 return $this->_cleanObjectDatas($this->fichinter);
803 }
804
821 public function putLine($id, $lineid, $request_data)
822 {
823 $result = $this->fichinter->fetch($id);
824 if (!$result) {
825 throw new RestException(404, 'Intervention not found');
826 }
827
828 if ($this->fichinter->status != 0) {
829 throw new RestException(403, 'Intervention not in draft status : '.$this->fichinter->getLibStatut(1));
830 }
831
832 if (!DolibarrApi::_checkAccessToResource('ficheinter', $this->fichinter->id)) {
833 throw new RestException(403, 'Access not allowed for login '.DolibarrApiAccess::$user->login);
834 }
835
836 $objectline = new FichinterLigne($this->db);
837 if ($objectline->fetch($lineid) <= 0) {
838 throw new RestException(404, 'Intervention line not found');
839 }
840 if ($objectline->fk_fichinter != $this->fichinter->id) {
841 throw new RestException(403, 'Line does not belong to this intervention');
842 }
843 $request_data = (object) $request_data;
844
845 if (isset($request_data->desc) || isset($request_data->description)) {
846 $objectline->desc = sanitizeVal($request_data->desc ?? $request_data->description, 'restricthtml');
847 }
848 if (isset($request_data->date)) {
849 $objectline->date = (int) sanitizeVal($request_data->date);
850 }
851 if (isset($request_data->duration)) {
852 $objectline->duration = (int) sanitizeVal($request_data->duration);
853 }
854 if (isset($request_data->rang)) {
855 $objectline->rang = (int) sanitizeVal($request_data->rang);
856 }
857
858 $updateRes = $objectline->update(DolibarrApiAccess::$user);
859
860 if ($updateRes >= 0) {
861 $result = $this->fichinter->fetch($id);
862 if ($result > 0) {
863 return $this->_cleanObjectDatas($this->fichinter);
864 } else {
865 throw new RestException(500, $this->fichinter->errorsToString());
866 }
867 } else {
868 throw new RestException(500, $objectline->errorsToString());
869 }
870 }
871
872
881 private function _validate($data)
882 {
883 $fichinter = array();
884 foreach (Interventions::$FIELDS as $field) {
885 if (!isset($data[$field])) {
886 throw new RestException(400, "$field field missing");
887 }
888 $fichinter[$field] = $data[$field];
889 }
890 return $fichinter;
891 }
892
893
894 // phpcs:disable PEAR.NamingConventions.ValidFunctionName.PublicUnderscore
904 protected function _cleanObjectDatas($object)
905 {
906 // phpcs:enable
907 $object = parent::_cleanObjectDatas($object);
908
909 unset($object->labelStatus);
910 unset($object->labelStatusShort);
911
912 return $object;
913 }
914
923 private function _validateLine($data)
924 {
925 if ($data === null) {
926 $data = array();
927 }
928 $fichinter = array();
929 foreach (Interventions::$FIELDSLINE as $field) {
930 if (!isset($data[$field])) {
931 throw new RestException(400, "$field field missing");
932 }
933 $fichinter[$field] = $data[$field];
934 }
935 return $fichinter;
936 }
937}
$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.
getLines($id)
Get lines of 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)
Add a line to an intervention.
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.