26use Luracast\Restler\RestException;
28require_once DOL_DOCUMENT_ROOT.
'/comm/propal/class/propal.class.php';
29require_once DOL_DOCUMENT_ROOT.
'/core/lib/company.lib.php';
45 public static $FIELDS = array(
61 $this->propal =
new Propal($this->db);
77 public function get(
$id, $contact_list = 1)
79 return $this->
_fetch(
$id,
'',
'', $contact_list);
97 public function getByRef($ref, $contact_list = 1)
99 return $this->
_fetch(0, $ref,
'', $contact_list);
119 return $this->
_fetch(0,
'', $ref_ext, $contact_list);
135 private function _fetch(
$id, $ref =
'', $ref_ext =
'', $contact_list = 1)
137 if (!DolibarrApiAccess::$user->hasRight(
'propal',
'lire')) {
138 throw new RestException(403);
140 if (empty(
$id) && empty($ref) && empty($ref_ext)) {
141 throw new RestException(400,
'No ID or Ref provided');
143 $result = $this->propal->fetch(
$id, $ref, $ref_ext);
145 throw new RestException(404,
'Commercial Proposal not found');
149 throw new RestException(403,
'Access not allowed for login '.DolibarrApiAccess::$user->login);
152 if ($contact_list > -1) {
154 $tmparray = $this->propal->liste_contact(-1,
'external', $contact_list);
155 if (is_array($tmparray)) {
156 $this->propal->contacts_ids = $tmparray;
158 $tmparray = $this->propal->liste_contact(-1,
'internal', $contact_list);
159 if (is_array($tmparray)) {
160 $this->propal->contacts_ids_internal = $tmparray;
164 $this->propal->fetchObjectLinked();
191 public function index($sortfield =
"t.rowid", $sortorder =
'ASC', $limit = 100, $page = 0, $thirdparty_ids =
'', $sqlfilters =
'', $properties =
'', $pagination_data =
false, $loadlinkedobjects = 0)
195 if (!DolibarrApiAccess::$user->hasRight(
'propal',
'lire')) {
196 throw new RestException(403);
202 $socids = DolibarrApiAccess::$user->socid ?: $thirdparty_ids;
206 if (!DolibarrApiAccess::$user->hasRight(
'societe',
'client',
'voir') && !$socids) {
207 $search_sale = DolibarrApiAccess::$user->id;
209 $sql =
"SELECT t.rowid";
210 $sql .=
" FROM ".MAIN_DB_PREFIX.
"propal AS t";
211 $sql .=
" INNER JOIN ".MAIN_DB_PREFIX.
"societe AS s ON (s.rowid = t.fk_soc)";
212 $sql .=
" LEFT JOIN ".MAIN_DB_PREFIX.
"propal_extrafields AS ef ON (ef.fk_object = t.rowid)";
213 $sql .=
' WHERE t.entity IN ('.getEntity(
'propal').
')';
215 $sql .=
" AND t.fk_soc IN (".$this->db->sanitize($socids).
")";
218 if ($search_sale && $search_sale !=
'-1') {
219 if ($search_sale == -2) {
220 $sql .=
" AND ".getSalesRepresentativeSqlFilter(
't.fk_soc', 0, 1);
221 } elseif ($search_sale > 0) {
222 $sql .=
" AND ".getSalesRepresentativeSqlFilter(
't.fk_soc', (
int) $search_sale);
225 $parameters = array();
226 $hookmanager->executeHooks(
'printFieldListWhere', $parameters, $this->propal);
227 $sql .= $hookmanager->resPrint;
233 throw new RestException(400,
'Error when validating parameter sqlfilters -> '.$errormessage);
238 $sqlTotals = str_replace(
'SELECT t.rowid',
'SELECT count(t.rowid) as total', $sql);
240 $sql .= $this->db->order($sortfield, $sortorder);
245 $offset = $limit * $page;
247 $sql .= $this->db->plimit($limit + 1, $offset);
251 $result = $this->db->query($sql);
254 $num = $this->db->num_rows($result);
255 $min = min($num, ($limit <= 0 ? $num : $limit));
258 $obj = $this->db->fetch_object($result);
259 $proposal_static =
new Propal($this->db);
260 if ($proposal_static->fetch($obj->rowid) > 0) {
262 $tmparray = $proposal_static->liste_contact(-1,
'external', 1);
263 if (is_array($tmparray)) {
264 $proposal_static->contacts_ids = $tmparray;
267 if ($loadlinkedobjects) {
269 $proposal_static->fetchObjectLinked();
277 throw new RestException(503,
'Error when retrieve propal list : '.$this->db->lasterror());
281 if ($pagination_data) {
282 $totalsResult = $this->db->query($sqlTotals);
283 $total = $this->db->fetch_object($totalsResult)->total;
288 $obj_ret[
'data'] = $tmp;
289 $obj_ret[
'pagination'] = [
290 'total' => (int) $total,
292 'page_count' => ceil((
int) $total / $limit),
312 public function post($request_data =
null)
315 if (!DolibarrApiAccess::$user->hasRight(
'propal',
'creer')) {
316 throw new RestException(403,
"Insufficiant rights");
323 $socid = (int) $request_data[
'socid'];
324 $thirdpartytmp =
new Societe($this->db);
325 $thirdparty_result = $thirdpartytmp->fetch($socid);
326 if ($thirdparty_result < 1) {
327 throw new RestException(404,
'Thirdparty with id='.$socid.
' not found or not allowed');
330 throw new RestException(404,
'Thirdparty with id='.$thirdpartytmp->id.
' not found or not allowed');
333 foreach ($request_data as $field => $value) {
334 if ($field ===
'caller') {
336 $this->propal->context[
'caller'] =
sanitizeVal($request_data[
'caller'],
'aZ09');
339 if ($field ==
'id') {
340 throw new RestException(400,
'Creating with id field is forbidden');
342 if ($field ==
'entity' && ((
int) $value) != ((
int)
$conf->entity)) {
343 throw new RestException(403,
'Creating with entity='.((
int) $value).
' MUST be the same entity='.((
int)
$conf->entity).
' as your API user/key belongs to');
346 $this->propal->$field = $this->
_checkValForAPI($field, $value, $this->propal);
348 if ($this->propal->create(DolibarrApiAccess::$user) < 0) {
349 throw new RestException(500,
"Error creating proposal", array_merge(array($this->propal->error), $this->propal->errors));
352 return ((
int) $this->propal->id);
373 if (!DolibarrApiAccess::$user->hasRight(
'propal',
'lire')) {
374 throw new RestException(403);
377 $result = $this->propal->fetch(
$id);
379 throw new RestException(404,
'Commercial Proposal not found');
383 throw new RestException(403,
'Access not allowed for login '.DolibarrApiAccess::$user->login);
387 if (!empty($sqlfilters)) {
391 throw new RestException(400,
'Error when validating parameter sqlfilters -> '.$errormessage);
395 $this->propal->getLinesArray($sql);
397 foreach ($this->propal->lines as $line) {
421 if (!DolibarrApiAccess::$user->hasRight(
'propal',
'creer')) {
422 throw new RestException(403);
425 $result = $this->propal->fetch(
$id);
427 throw new RestException(404,
'Commercial Proposal not found');
431 throw new RestException(403,
'Access not allowed for login '.DolibarrApiAccess::$user->login);
434 $request_data = (object) $request_data;
436 $request_data->desc =
sanitizeVal($request_data->desc,
'restricthtml');
437 $request_data->label =
sanitizeVal($request_data->label);
439 $updateRes = $this->propal->addline(
441 $request_data->subprice,
443 $request_data->tva_tx,
444 $request_data->localtax1_tx,
445 $request_data->localtax2_tx,
446 $request_data->fk_product,
447 $request_data->remise_percent,
448 $request_data->price_base_type ? $request_data->price_base_type :
'HT',
449 $request_data->subprice,
450 $request_data->info_bits,
451 $request_data->product_type,
453 $request_data->special_code,
454 $request_data->fk_parent_line,
455 $request_data->fk_fournprice,
456 $request_data->pa_ht,
457 $request_data->label,
458 $request_data->date_start,
459 $request_data->date_end,
460 $request_data->array_options,
461 $request_data->fk_unit,
462 $request_data->origin,
463 $request_data->origin_id,
464 $request_data->multicurrency_subprice,
465 $request_data->fk_remise_except
468 if ($updateRes > 0) {
471 throw new RestException(400, $this->propal->errorsToString());
491 if (!DolibarrApiAccess::$user->hasRight(
'propal',
'creer')) {
492 throw new RestException(403);
495 $result = $this->propal->fetch(
$id);
497 throw new RestException(404,
'Commercial Proposal not found');
501 throw new RestException(403,
'Access not allowed for login '.DolibarrApiAccess::$user->login);
508 foreach ($request_data as $TData) {
509 if (empty($TData[0])) {
510 $TData = array($TData);
513 foreach ($TData as $lineData) {
514 $line = (object) $lineData;
516 $updateRes = $this->propal->addline(
524 $line->remise_percent,
531 $line->fk_parent_line,
532 $line->fk_fournprice,
537 $line->array_options,
541 $line->multicurrency_subprice,
542 $line->fk_remise_except
545 if ($updateRes < 0) {
546 $errors[
'lineLabel'] = $line->label;
547 $errors[
'msg'] = $this->propal->errors;
551 if (empty($errors)) {
555 $this->db->rollback();
556 throw new RestException(400, implode(
", ", $errors));
578 if (!DolibarrApiAccess::$user->hasRight(
'propal',
'creer')) {
579 throw new RestException(403);
582 $result = $this->propal->fetch(
$id);
584 throw new RestException(404,
'Proposal not found');
588 throw new RestException(403,
'Access not allowed for login '.DolibarrApiAccess::$user->login);
591 $request_data = (object) $request_data;
593 if (isset($request_data->desc)) {
594 $request_data->desc =
sanitizeVal($request_data->desc,
'restricthtml');
596 if (isset($request_data->label)) {
597 $request_data->label =
sanitizeVal($request_data->label);
601 $result = $propalline->fetch($lineid);
603 throw new RestException(404,
'Proposal line not found');
606 if ($propalline->fk_propal !=
$id) {
607 throw new RestException(403,
'Line does not belong to this proposal');
610 $updateRes = $this->propal->updateline(
612 isset($request_data->subprice) ? $request_data->subprice : $propalline->subprice,
613 isset($request_data->qty) ? $request_data->qty : $propalline->qty,
614 isset($request_data->remise_percent) ? $request_data->remise_percent : $propalline->remise_percent,
615 isset($request_data->tva_tx) ? $request_data->tva_tx : $propalline->tva_tx,
616 isset($request_data->localtax1_tx) ? $request_data->localtax1_tx : $propalline->localtax1_tx,
617 isset($request_data->localtax2_tx) ? $request_data->localtax2_tx : $propalline->localtax2_tx,
618 isset($request_data->desc) ? $request_data->desc : $propalline->desc,
619 isset($request_data->price_base_type) ? $request_data->price_base_type :
'HT',
620 isset($request_data->info_bits) ? $request_data->info_bits : $propalline->info_bits,
621 isset($request_data->special_code) ? $request_data->special_code : $propalline->special_code,
622 isset($request_data->fk_parent_line) ? $request_data->fk_parent_line : $propalline->fk_parent_line,
624 isset($request_data->fk_fournprice) ? $request_data->fk_fournprice : $propalline->fk_fournprice,
625 isset($request_data->pa_ht) ? $request_data->pa_ht : $propalline->pa_ht,
626 isset($request_data->label) ? $request_data->label : $propalline->label,
627 isset($request_data->product_type) ? $request_data->product_type : $propalline->product_type,
628 isset($request_data->date_start) ? $request_data->date_start : $propalline->date_start,
629 isset($request_data->date_end) ? $request_data->date_end : $propalline->date_end,
630 isset($request_data->array_options) ? $request_data->array_options : $propalline->array_options,
631 isset($request_data->fk_unit) ? $request_data->fk_unit : $propalline->fk_unit,
632 isset($request_data->multicurrency_subprice) ? $request_data->multicurrency_subprice : $propalline->subprice,
634 isset($request_data->rang) ? $request_data->rang : $propalline->rang
637 if ($updateRes > 0) {
638 $result = $this->
get(
$id);
639 unset($result->line);
661 if (!DolibarrApiAccess::$user->hasRight(
'propal',
'creer')) {
662 throw new RestException(403);
665 $result = $this->propal->fetch(
$id);
667 throw new RestException(404,
'Proposal not found');
671 throw new RestException(403,
'Access not allowed for login '.DolibarrApiAccess::$user->login);
674 $updateRes = $this->propal->deleteLine($lineid,
$id);
675 if ($updateRes > 0) {
676 return $this->
get(
$id);
678 throw new RestException(405, $this->propal->errorsToString());
696 if (!DolibarrApiAccess::$user->hasRight(
'propal',
'lire')) {
697 throw new RestException(403);
700 $result = $this->propal->fetch(
$id);
702 throw new RestException(404,
'Proposal not found');
706 throw new RestException(403,
'Access not allowed for login '.DolibarrApiAccess::$user->login);
709 $contacts = $this->propal->liste_contact(-1,
'external', 0, $type);
710 $socpeoples = $this->propal->liste_contact(-1,
'internal', 0, $type);
712 $contacts = array_merge($contacts, $socpeoples);
738 public function postContact(
$id, $contactid, $type, $source =
'external', $notrigger = 0)
740 if (!DolibarrApiAccess::$user->hasRight(
'propal',
'creer')) {
741 throw new RestException(403);
745 if (empty($source)) {
746 throw new RestException(400,
'Source can not be empty');
748 $sql_distinct_source =
"SELECT DISTINCT source";
749 $sql_distinct_source .=
" FROM ".MAIN_DB_PREFIX.
"c_type_contact";
750 $sql_distinct_source .=
" WHERE element LIKE 'propal'";
751 $sql_distinct_source .=
" AND source is NOT NULL";
752 $sql_distinct_source .=
" AND active != 0";
753 $source_result = $this->db->query($sql_distinct_source);
754 $source_array = array();
756 if ($source_result) {
757 $num = $this->db->num_rows($source_result);
760 $obj = $this->db->fetch_object($source_result);
761 $source_kind = (string) $obj->source;
762 array_push($source_array, $source_kind);
767 throw new RestException(503,
'Error when retrieving a list of propal contact sources: '.$this->db->lasterror());
769 if (!in_array($source, (array) $source_array,
true)) {
770 throw new RestException(400,
'Combo of Source='.$source.
' and Type='.$type.
' not found in dictionary with active proposal contact types');
775 throw new RestException(400,
'type can not be empty');
778 $sql_distinct_type =
"SELECT DISTINCT code";
779 $sql_distinct_type .=
" FROM ".MAIN_DB_PREFIX.
"c_type_contact";
780 $sql_distinct_type .=
" WHERE element LIKE 'propal'";
781 $sql_distinct_type .=
" AND source='".$this->db->escape($source).
"'";
782 $sql_distinct_type .=
" AND code is NOT NULL";
783 $sql_distinct_type .=
" AND active != 0";
784 $type_result = $this->db->query($sql_distinct_type);
785 $type_array = array();
788 $num = $this->db->num_rows($type_result);
791 $obj = $this->db->fetch_object($type_result);
793 $type_kind = (string) $obj->code;
794 array_push($type_array, $type_kind);
799 throw new RestException(503,
'Error when retrieving a list of propal contact types: '.$this->db->lasterror());
801 if (!in_array($type, (array) $type_array,
true)) {
802 throw new RestException(400,
'Combo of Type='.$type.
' and Source='.$source.
' not found in dictionary with active proposal contact types');
806 $result = $this->propal->fetch(
$id);
808 throw new RestException(404,
'Proposal not found');
811 throw new RestException(403,
'Access not allowed for login '.DolibarrApiAccess::$user->login);
814 $result = $this->propal->add_contact($contactid, $type, $source, $notrigger);
817 throw new RestException(400,
'Already exists: Contact='.$contactid.
' is already linked to the proposal='.
$id.
' as source='.$source.
' and type='.$type);
818 } elseif ($result == -1) {
819 throw new RestException(400,
'Wrong contact='.$contactid);
820 } elseif ($result == -2) {
821 throw new RestException(400,
'Wrong type='.$type);
822 } elseif ($result == -3) {
823 throw new RestException(400,
'Not allowed contacts');
824 } elseif ($result == -4) {
825 throw new RestException(400,
'ErrorCommercialNotAllowedForThirdparty');
826 } elseif ($result == -5) {
827 throw new RestException(400,
'Trigger failed');
828 } elseif ($result == -6) {
829 throw new RestException(400,
'DB_ERROR_RECORD_ALREADY_EXISTS');
830 } elseif ($result == -7) {
831 throw new RestException(400,
'Some other error');
835 throw new RestException(500,
'Error when added the contact');
841 'message' =>
'Contact='.$contactid.
' linked to the proposal='.
$id.
' as '.$source.
' '.$type
864 if (!DolibarrApiAccess::$user->hasRight(
'propal',
'creer')) {
865 throw new RestException(403);
868 $result = $this->propal->fetch(
$id);
871 throw new RestException(404,
'Proposal not found');
875 throw new RestException(403,
'Access not allowed for login '.DolibarrApiAccess::$user->login);
877 foreach (array(
'internal',
'external') as $source) {
878 $contacts = $this->propal->liste_contact(-1, $source);
879 foreach ($contacts as $contact) {
880 if ($contact[
'id'] == $contactid && $contact[
'code'] == $type) {
881 $result = $this->propal->delete_contact($contact[
'rowid']);
884 throw new RestException(500,
'Error when deleted the contact');
905 public function put(
$id, $request_data =
null)
907 if (!DolibarrApiAccess::$user->hasRight(
'propal',
'creer')) {
908 throw new RestException(403);
911 throw new RestException(400,
'No proposal with id=0 can exist');
913 $result = $this->propal->fetch(
$id);
915 throw new RestException(404,
'Proposal not found');
919 throw new RestException(403,
'Access not allowed for login '.DolibarrApiAccess::$user->login);
921 foreach ($request_data as $field => $value) {
922 if ($field ==
'id') {
925 if ($field ===
'caller') {
927 $this->propal->context[
'caller'] =
sanitizeVal($request_data[
'caller'],
'aZ09');
930 if ($field ==
'array_options' && is_array($value)) {
931 foreach ($value as $index => $val) {
937 $this->propal->$field = $this->
_checkValForAPI($field, $value, $this->propal);
941 if (empty($this->propal->fin_validite) && !empty($this->propal->duree_validite) && !empty($this->propal->date_creation)) {
942 $this->propal->fin_validite = $this->propal->date_creation + (int) ($this->propal->duree_validite * 24 * 3600);
944 if (!empty($this->propal->fin_validite)) {
945 if ($this->propal->set_echeance(DolibarrApiAccess::$user, $this->propal->fin_validite) < 0) {
946 throw new RestException(500, $this->propal->errorsToString());
950 if ($this->propal->update(DolibarrApiAccess::$user) > 0) {
951 return $this->
get(
$id);
953 throw new RestException(500, $this->propal->errorsToString());
969 public function delete(
$id)
971 if (!DolibarrApiAccess::$user->hasRight(
'propal',
'supprimer')) {
972 throw new RestException(403);
975 throw new RestException(400,
'No proposal with id=0 can exist');
978 $result = $this->propal->fetch(
$id);
980 throw new RestException(404,
'Commercial Proposal not found');
984 throw new RestException(403,
'Access not allowed for login '.DolibarrApiAccess::$user->login);
987 if (!$this->propal->delete(DolibarrApiAccess::$user)) {
988 throw new RestException(500,
'Error when delete Commercial Proposal : '.$this->propal->errorsToString());
994 'message' =>
'Commercial Proposal deleted'
1013 if (!DolibarrApiAccess::$user->hasRight(
'propal',
'creer')) {
1014 throw new RestException(403);
1016 $result = $this->propal->fetch(
$id);
1018 throw new RestException(404,
'Proposal not found');
1022 throw new RestException(403,
'Access not allowed for login '.DolibarrApiAccess::$user->login);
1025 $result = $this->propal->setDraft(DolibarrApiAccess::$user);
1027 throw new RestException(304,
'Nothing done. May be object is already draft');
1030 throw new RestException(500,
'Error : '.$this->propal->errorsToString());
1033 $result = $this->propal->fetch(
$id);
1035 throw new RestException(404,
'Proposal not found');
1043 $this->propal->fetchObjectLinked();
1072 if (!DolibarrApiAccess::$user->hasRight(
'propal',
'creer')) {
1073 throw new RestException(403);
1075 $result = $this->propal->fetch(
$id);
1077 throw new RestException(404,
'Commercial Proposal not found');
1081 throw new RestException(403,
'Access not allowed for login '.DolibarrApiAccess::$user->login);
1084 $result = $this->propal->valid(DolibarrApiAccess::$user, $notrigger);
1086 throw new RestException(304,
'Error nothing done. May be object is already validated');
1089 throw new RestException(500,
'Error when validating Commercial Proposal: '.$this->propal->errorsToString());
1092 $result = $this->propal->fetch(
$id);
1094 throw new RestException(404,
'Commercial Proposal not found');
1102 $this->propal->fetchObjectLinked();
1123 public function close(
$id, $status, $note_private =
'', $notrigger = 0, $note_public =
'')
1125 if (!DolibarrApiAccess::$user->hasRight(
'propal',
'creer')) {
1126 throw new RestException(403);
1128 $result = $this->propal->fetch(
$id);
1130 throw new RestException(404,
'Commercial Proposal not found');
1134 throw new RestException(403,
'Access not allowed for login '.DolibarrApiAccess::$user->login);
1137 $result = $this->propal->closeProposal(DolibarrApiAccess::$user, $status, $note_private, $notrigger, $note_public);
1139 throw new RestException(304,
'Error nothing done. May be object is already closed');
1142 throw new RestException(500,
'Error when closing Commercial Proposal: '.$this->propal->errorsToString());
1145 $result = $this->propal->fetch(
$id);
1147 throw new RestException(404,
'Proposal not found');
1155 $this->propal->fetchObjectLinked();
1174 if (!DolibarrApiAccess::$user->hasRight(
'propal',
'creer')) {
1175 throw new RestException(403);
1177 $result = $this->propal->fetch(
$id);
1179 throw new RestException(404,
'Commercial Proposal not found');
1183 throw new RestException(403,
'Access not allowed for login '.DolibarrApiAccess::$user->login);
1186 $result = $this->propal->classifyBilled(DolibarrApiAccess::$user);
1188 throw new RestException(500,
'Error : '.$this->propal->errorsToString());
1191 $result = $this->propal->fetch(
$id);
1193 throw new RestException(404,
'Proposal not found');
1201 $this->propal->fetchObjectLinked();
1217 if ($data ===
null) {
1221 foreach (Proposals::$FIELDS as $field) {
1222 if (!isset($data[$field])) {
1223 throw new RestException(400,
"$field field missing");
1225 $propal[$field] = $data[$field];
$id
Support class for third parties, contacts, members, users or resources.
if(! $sortfield) if(! $sortorder) $object
_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 proposals.
Class to manage commercial proposal lines.
_fetch($id, $ref='', $ref_ext='', $contact_list=1)
Get properties of an proposal object.
getLines($id, $sqlfilters='')
Get lines of a commercial proposal.
settodraft($id)
Set a commercial proposal to draft.
put($id, $request_data=null)
Update a commercial proposal general fields (won't change lines of commercial proposal)
setinvoiced($id)
Set a commercial proposal to billed.
post($request_data=null)
Create a commercial proposal.
index($sortfield="t.rowid", $sortorder='ASC', $limit=100, $page=0, $thirdparty_ids='', $sqlfilters='', $properties='', $pagination_data=false, $loadlinkedobjects=0)
List commercial proposals.
postContact($id, $contactid, $type, $source='external', $notrigger=0)
Add (link) a contact to a commercial proposal.
getContacts($id, $type='')
Get contacts of given proposal.
close($id, $status, $note_private='', $notrigger=0, $note_public='')
Close (accept or refuse) a commercial proposal.
getByRefExt($ref_ext, $contact_list=1)
Get a commercial proposal by ref_ext.
postLine($id, $request_data=null)
Add a line to a commercial proposal.
_cleanObjectDatas($object)
Clean sensible object datas @phpstan-template T.
postLines($id, $request_data=null)
Add lines to a commercial proposal.
_validate($data)
Validate fields before create or update object.
deleteLine($id, $lineid)
Delete a line of a commercial proposal.
deleteContact($id, $contactid, $type)
Remove (unlink) a contact from commercial proposal.
validate($id, $notrigger=0)
Validate a commercial proposal.
__construct()
Constructor.
getByRef($ref, $contact_list=1)
Get a commercial proposal by ref.
putLine($id, $lineid, $request_data=null)
Update a line of a commercial proposal.
Class to manage third parties objects (customers, suppliers, prospects...)
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.