26use Luracast\Restler\RestException;
28require_once DOL_DOCUMENT_ROOT.
'/comm/propal/class/propal.class.php';
44 public static $FIELDS = array(
60 $this->propal =
new Propal($this->db);
76 public function get(
$id, $contact_list = 1)
78 return $this->
_fetch(
$id,
'',
'', $contact_list);
96 public function getByRef($ref, $contact_list = 1)
98 return $this->
_fetch(0, $ref,
'', $contact_list);
118 return $this->
_fetch(0,
'', $ref_ext, $contact_list);
134 private function _fetch(
$id, $ref =
'', $ref_ext =
'', $contact_list = 1)
136 if (!DolibarrApiAccess::$user->hasRight(
'propal',
'lire')) {
137 throw new RestException(403);
139 if (empty(
$id) && empty($ref) && empty($ref_ext)) {
140 throw new RestException(400,
'No ID or Ref provided');
142 $result = $this->propal->fetch(
$id, $ref, $ref_ext);
144 throw new RestException(404,
'Commercial Proposal not found');
148 throw new RestException(403,
'Access not allowed for login '.DolibarrApiAccess::$user->login);
151 if ($contact_list > -1) {
153 $tmparray = $this->propal->liste_contact(-1,
'external', $contact_list);
154 if (is_array($tmparray)) {
155 $this->propal->contacts_ids = $tmparray;
157 $tmparray = $this->propal->liste_contact(-1,
'internal', $contact_list);
158 if (is_array($tmparray)) {
159 $this->propal->contacts_ids_internal = $tmparray;
163 $this->propal->fetchObjectLinked();
190 public function index($sortfield =
"t.rowid", $sortorder =
'ASC', $limit = 100, $page = 0, $thirdparty_ids =
'', $sqlfilters =
'', $properties =
'', $pagination_data =
false, $loadlinkedobjects = 0)
194 if (!DolibarrApiAccess::$user->hasRight(
'propal',
'lire')) {
195 throw new RestException(403);
201 $socids = DolibarrApiAccess::$user->socid ?: $thirdparty_ids;
205 if (!DolibarrApiAccess::$user->hasRight(
'societe',
'client',
'voir') && !$socids) {
206 $search_sale = DolibarrApiAccess::$user->id;
208 $sql =
"SELECT t.rowid";
209 $sql .=
" FROM ".MAIN_DB_PREFIX.
"propal AS t";
210 $sql .=
" INNER JOIN ".MAIN_DB_PREFIX.
"societe AS s ON (s.rowid = t.fk_soc)";
211 $sql .=
" LEFT JOIN ".MAIN_DB_PREFIX.
"propal_extrafields AS ef ON (ef.fk_object = t.rowid)";
212 $sql .=
' WHERE t.entity IN ('.getEntity(
'propal').
')';
214 $sql .=
" AND t.fk_soc IN (".$this->db->sanitize($socids).
")";
217 if ($search_sale && $search_sale !=
'-1') {
218 if ($search_sale == -2) {
219 $sql .=
" AND NOT EXISTS (SELECT sc.fk_soc FROM ".MAIN_DB_PREFIX.
"societe_commerciaux as sc WHERE sc.fk_soc = t.fk_soc)";
220 } elseif ($search_sale > 0) {
221 $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).
")";
224 $parameters = array();
225 $hookmanager->executeHooks(
'printFieldListWhere', $parameters, $this->propal);
226 $sql .= $hookmanager->resPrint;
232 throw new RestException(400,
'Error when validating parameter sqlfilters -> '.$errormessage);
237 $sqlTotals = str_replace(
'SELECT t.rowid',
'SELECT count(t.rowid) as total', $sql);
239 $sql .= $this->db->order($sortfield, $sortorder);
244 $offset = $limit * $page;
246 $sql .= $this->db->plimit($limit + 1, $offset);
250 $result = $this->db->query($sql);
253 $num = $this->db->num_rows($result);
254 $min = min($num, ($limit <= 0 ? $num : $limit));
257 $obj = $this->db->fetch_object($result);
258 $proposal_static =
new Propal($this->db);
259 if ($proposal_static->fetch($obj->rowid) > 0) {
261 $tmparray = $proposal_static->liste_contact(-1,
'external', 1);
262 if (is_array($tmparray)) {
263 $proposal_static->contacts_ids = $tmparray;
266 if ($loadlinkedobjects) {
268 $proposal_static->fetchObjectLinked();
276 throw new RestException(503,
'Error when retrieve propal list : '.$this->db->lasterror());
280 if ($pagination_data) {
281 $totalsResult = $this->db->query($sqlTotals);
282 $total = $this->db->fetch_object($totalsResult)->total;
287 $obj_ret[
'data'] = $tmp;
288 $obj_ret[
'pagination'] = [
289 'total' => (int) $total,
291 'page_count' => ceil((
int) $total / $limit),
311 public function post($request_data =
null)
314 if (!DolibarrApiAccess::$user->hasRight(
'propal',
'creer')) {
315 throw new RestException(403,
"Insufficiant rights");
322 $socid = (int) $request_data[
'socid'];
323 $thirdpartytmp =
new Societe($this->db);
324 $thirdparty_result = $thirdpartytmp->fetch($socid);
325 if ($thirdparty_result < 1) {
326 throw new RestException(404,
'Thirdparty with id='.$socid.
' not found or not allowed');
329 throw new RestException(404,
'Thirdparty with id='.$thirdpartytmp->id.
' not found or not allowed');
332 foreach ($request_data as $field => $value) {
333 if ($field ===
'caller') {
335 $this->propal->context[
'caller'] =
sanitizeVal($request_data[
'caller'],
'aZ09');
338 if ($field ==
'id') {
339 throw new RestException(400,
'Creating with id field is forbidden');
341 if ($field ==
'entity' && ((
int) $value) != ((
int)
$conf->entity)) {
342 throw new RestException(403,
'Creating with entity='.((
int) $value).
' MUST be the same entity='.((
int)
$conf->entity).
' as your API user/key belongs to');
345 $this->propal->$field = $this->
_checkValForAPI($field, $value, $this->propal);
354 if ($this->propal->create(DolibarrApiAccess::$user) < 0) {
355 throw new RestException(500,
"Error creating order", array_merge(array($this->propal->error), $this->propal->errors));
358 return ((
int) $this->propal->id);
379 if (!DolibarrApiAccess::$user->hasRight(
'propal',
'lire')) {
380 throw new RestException(403);
383 $result = $this->propal->fetch(
$id);
385 throw new RestException(404,
'Commercial Proposal not found');
389 throw new RestException(403,
'Access not allowed for login '.DolibarrApiAccess::$user->login);
393 if (!empty($sqlfilters)) {
397 throw new RestException(400,
'Error when validating parameter sqlfilters -> '.$errormessage);
401 $this->propal->getLinesArray($sql);
403 foreach ($this->propal->lines as $line) {
427 if (!DolibarrApiAccess::$user->hasRight(
'propal',
'creer')) {
428 throw new RestException(403);
431 $result = $this->propal->fetch(
$id);
433 throw new RestException(404,
'Commercial Proposal not found');
437 throw new RestException(403,
'Access not allowed for login '.DolibarrApiAccess::$user->login);
440 $request_data = (object) $request_data;
442 $request_data->desc =
sanitizeVal($request_data->desc,
'restricthtml');
443 $request_data->label =
sanitizeVal($request_data->label);
445 $updateRes = $this->propal->addline(
447 $request_data->subprice,
449 $request_data->tva_tx,
450 $request_data->localtax1_tx,
451 $request_data->localtax2_tx,
452 $request_data->fk_product,
453 $request_data->remise_percent,
454 $request_data->price_base_type ? $request_data->price_base_type :
'HT',
455 $request_data->subprice,
456 $request_data->info_bits,
457 $request_data->product_type,
459 $request_data->special_code,
460 $request_data->fk_parent_line,
461 $request_data->fk_fournprice,
462 $request_data->pa_ht,
463 $request_data->label,
464 $request_data->date_start,
465 $request_data->date_end,
466 $request_data->array_options,
467 $request_data->fk_unit,
468 $request_data->origin,
469 $request_data->origin_id,
470 $request_data->multicurrency_subprice,
471 $request_data->fk_remise_except
474 if ($updateRes > 0) {
477 throw new RestException(400, $this->propal->error);
497 if (!DolibarrApiAccess::$user->hasRight(
'propal',
'creer')) {
498 throw new RestException(403);
501 $result = $this->propal->fetch(
$id);
503 throw new RestException(404,
'Commercial Proposal not found');
507 throw new RestException(403,
'Access not allowed for login '.DolibarrApiAccess::$user->login);
514 foreach ($request_data as $TData) {
515 if (empty($TData[0])) {
516 $TData = array($TData);
519 foreach ($TData as $lineData) {
520 $line = (object) $lineData;
522 $updateRes = $this->propal->addline(
530 $line->remise_percent,
537 $line->fk_parent_line,
538 $line->fk_fournprice,
543 $line->array_options,
547 $line->multicurrency_subprice,
548 $line->fk_remise_except
551 if ($updateRes < 0) {
552 $errors[
'lineLabel'] = $line->label;
553 $errors[
'msg'] = $this->propal->errors;
557 if (empty($errors)) {
561 $this->db->rollback();
562 throw new RestException(400, implode(
", ", $errors));
584 if (!DolibarrApiAccess::$user->hasRight(
'propal',
'creer')) {
585 throw new RestException(403);
588 $result = $this->propal->fetch(
$id);
590 throw new RestException(404,
'Proposal not found');
594 throw new RestException(403,
'Access not allowed for login '.DolibarrApiAccess::$user->login);
597 $request_data = (object) $request_data;
599 if (isset($request_data->desc)) {
600 $request_data->desc =
sanitizeVal($request_data->desc,
'restricthtml');
602 if (isset($request_data->label)) {
603 $request_data->label =
sanitizeVal($request_data->label);
607 $result = $propalline->fetch($lineid);
609 throw new RestException(404,
'Proposal line not found');
612 if ($propalline->fk_propal !=
$id) {
613 throw new RestException(403,
'Line does not belong to this proposal');
616 $updateRes = $this->propal->updateline(
618 isset($request_data->subprice) ? $request_data->subprice : $propalline->subprice,
619 isset($request_data->qty) ? $request_data->qty : $propalline->qty,
620 isset($request_data->remise_percent) ? $request_data->remise_percent : $propalline->remise_percent,
621 isset($request_data->tva_tx) ? $request_data->tva_tx : $propalline->tva_tx,
622 isset($request_data->localtax1_tx) ? $request_data->localtax1_tx : $propalline->localtax1_tx,
623 isset($request_data->localtax2_tx) ? $request_data->localtax2_tx : $propalline->localtax2_tx,
624 isset($request_data->desc) ? $request_data->desc : $propalline->desc,
625 isset($request_data->price_base_type) ? $request_data->price_base_type :
'HT',
626 isset($request_data->info_bits) ? $request_data->info_bits : $propalline->info_bits,
627 isset($request_data->special_code) ? $request_data->special_code : $propalline->special_code,
628 isset($request_data->fk_parent_line) ? $request_data->fk_parent_line : $propalline->fk_parent_line,
630 isset($request_data->fk_fournprice) ? $request_data->fk_fournprice : $propalline->fk_fournprice,
631 isset($request_data->pa_ht) ? $request_data->pa_ht : $propalline->pa_ht,
632 isset($request_data->label) ? $request_data->label : $propalline->label,
633 isset($request_data->product_type) ? $request_data->product_type : $propalline->product_type,
634 isset($request_data->date_start) ? $request_data->date_start : $propalline->date_start,
635 isset($request_data->date_end) ? $request_data->date_end : $propalline->date_end,
636 isset($request_data->array_options) ? $request_data->array_options : $propalline->array_options,
637 isset($request_data->fk_unit) ? $request_data->fk_unit : $propalline->fk_unit,
638 isset($request_data->multicurrency_subprice) ? $request_data->multicurrency_subprice : $propalline->subprice,
640 isset($request_data->rang) ? $request_data->rang : $propalline->rang
643 if ($updateRes > 0) {
644 $result = $this->
get(
$id);
645 unset($result->line);
667 if (!DolibarrApiAccess::$user->hasRight(
'propal',
'creer')) {
668 throw new RestException(403);
671 $result = $this->propal->fetch(
$id);
673 throw new RestException(404,
'Proposal not found');
677 throw new RestException(403,
'Access not allowed for login '.DolibarrApiAccess::$user->login);
680 $updateRes = $this->propal->deleteLine($lineid,
$id);
681 if ($updateRes > 0) {
682 return $this->
get(
$id);
684 throw new RestException(405, $this->propal->error);
702 if (!DolibarrApiAccess::$user->hasRight(
'propal',
'lire')) {
703 throw new RestException(403);
706 $result = $this->propal->fetch(
$id);
708 throw new RestException(404,
'Proposal not found');
712 throw new RestException(403,
'Access not allowed for login '.DolibarrApiAccess::$user->login);
715 $contacts = $this->propal->liste_contact(-1,
'external', 0, $type);
716 $socpeoples = $this->propal->liste_contact(-1,
'internal', 0, $type);
718 $contacts = array_merge($contacts, $socpeoples);
744 public function postContact(
$id, $contactid, $type, $source =
'external', $notrigger = 0)
746 if (!DolibarrApiAccess::$user->hasRight(
'propal',
'creer')) {
747 throw new RestException(403);
751 if (empty($source)) {
752 throw new RestException(400,
'Source can not be empty');
754 $sql_distinct_source =
"SELECT DISTINCT source";
755 $sql_distinct_source .=
" FROM ".MAIN_DB_PREFIX.
"c_type_contact";
756 $sql_distinct_source .=
" WHERE element LIKE 'propal'";
757 $sql_distinct_source .=
" AND source is NOT NULL";
758 $sql_distinct_source .=
" AND active != 0";
759 $source_result = $this->db->query($sql_distinct_source);
760 $source_array = array();
762 if ($source_result) {
763 $num = $this->db->num_rows($source_result);
766 $obj = $this->db->fetch_object($source_result);
767 $source_kind = (
string) $obj->source;
768 array_push($source_array, $source_kind);
773 throw new RestException(503,
'Error when retrieving a list of propal contact sources: '.$this->db->lasterror());
775 if (!in_array($source, (array) $source_array,
true)) {
776 throw new RestException(400,
'Combo of Source='.$source.
' and Type='.$type.
' not found in dictionary with active proposal contact types');
781 throw new RestException(400,
'type can not be empty');
784 $sql_distinct_type =
"SELECT DISTINCT code";
785 $sql_distinct_type .=
" FROM ".MAIN_DB_PREFIX.
"c_type_contact";
786 $sql_distinct_type .=
" WHERE element LIKE 'propal'";
787 $sql_distinct_type .=
" AND source='".$this->db->escape($source).
"'";
788 $sql_distinct_type .=
" AND code is NOT NULL";
789 $sql_distinct_type .=
" AND active != 0";
790 $type_result = $this->db->query($sql_distinct_type);
791 $type_array = array();
794 $num = $this->db->num_rows($type_result);
797 $obj = $this->db->fetch_object($type_result);
799 $type_kind = (
string) $obj->code;
800 array_push($type_array, $type_kind);
805 throw new RestException(503,
'Error when retrieving a list of propal contact types: '.$this->db->lasterror());
807 if (!in_array($type, (array) $type_array,
true)) {
808 throw new RestException(400,
'Combo of Type='.$type.
' and Source='.$source.
' not found in dictionary with active proposal contact types');
812 $result = $this->propal->fetch(
$id);
814 throw new RestException(404,
'Proposal not found');
817 throw new RestException(403,
'Access not allowed for login '.DolibarrApiAccess::$user->login);
820 $result = $this->propal->add_contact($contactid, $type, $source, $notrigger);
823 throw new RestException(400,
'Already exists: Contact='.$contactid.
' is already linked to the proposal='.
$id.
' as source='.$source.
' and type='.$type);
824 } elseif ($result == -1) {
825 throw new RestException(400,
'Wrong contact='.$contactid);
826 } elseif ($result == -2) {
827 throw new RestException(400,
'Wrong type='.$type);
828 } elseif ($result == -3) {
829 throw new RestException(400,
'Not allowed contacts');
830 } elseif ($result == -4) {
831 throw new RestException(400,
'ErrorCommercialNotAllowedForThirdparty');
832 } elseif ($result == -5) {
833 throw new RestException(400,
'Trigger failed');
834 } elseif ($result == -6) {
835 throw new RestException(400,
'DB_ERROR_RECORD_ALREADY_EXISTS');
836 } elseif ($result == -7) {
837 throw new RestException(400,
'Some other error');
841 throw new RestException(500,
'Error when added the contact');
847 'message' =>
'Contact='.$contactid.
' linked to the proposal='.
$id.
' as '.$source.
' '.$type
870 if (!DolibarrApiAccess::$user->hasRight(
'propal',
'creer')) {
871 throw new RestException(403);
874 $result = $this->propal->fetch(
$id);
877 throw new RestException(404,
'Proposal not found');
881 throw new RestException(403,
'Access not allowed for login '.DolibarrApiAccess::$user->login);
883 foreach (array(
'internal',
'external') as $source) {
884 $contacts = $this->propal->liste_contact(-1, $source);
885 foreach ($contacts as $contact) {
886 if ($contact[
'id'] == $contactid && $contact[
'code'] == $type) {
887 $result = $this->propal->delete_contact($contact[
'rowid']);
890 throw new RestException(500,
'Error when deleted the contact');
911 public function put(
$id, $request_data =
null)
913 if (!DolibarrApiAccess::$user->hasRight(
'propal',
'creer')) {
914 throw new RestException(403);
917 throw new RestException(400,
'No proposal with id=0 can exist');
919 $result = $this->propal->fetch(
$id);
921 throw new RestException(404,
'Proposal not found');
925 throw new RestException(403,
'Access not allowed for login '.DolibarrApiAccess::$user->login);
927 foreach ($request_data as $field => $value) {
928 if ($field ==
'id') {
931 if ($field ===
'caller') {
933 $this->propal->context[
'caller'] =
sanitizeVal($request_data[
'caller'],
'aZ09');
936 if ($field ==
'array_options' && is_array($value)) {
937 foreach ($value as $index => $val) {
943 $this->propal->$field = $this->
_checkValForAPI($field, $value, $this->propal);
947 if (empty($this->propal->fin_validite) && !empty($this->propal->duree_validite) && !empty($this->propal->date_creation)) {
948 $this->propal->fin_validite = $this->propal->date_creation + (int) ($this->propal->duree_validite * 24 * 3600);
950 if (!empty($this->propal->fin_validite)) {
951 if ($this->propal->set_echeance(DolibarrApiAccess::$user, $this->propal->fin_validite) < 0) {
952 throw new RestException(500, $this->propal->error);
956 if ($this->propal->update(DolibarrApiAccess::$user) > 0) {
957 return $this->
get(
$id);
959 throw new RestException(500, $this->propal->error);
975 public function delete(
$id)
977 if (!DolibarrApiAccess::$user->hasRight(
'propal',
'supprimer')) {
978 throw new RestException(403);
981 throw new RestException(400,
'No proposal with id=0 can exist');
984 $result = $this->propal->fetch(
$id);
986 throw new RestException(404,
'Commercial Proposal not found');
990 throw new RestException(403,
'Access not allowed for login '.DolibarrApiAccess::$user->login);
993 if (!$this->propal->delete(DolibarrApiAccess::$user)) {
994 throw new RestException(500,
'Error when delete Commercial Proposal : '.$this->propal->error);
1000 'message' =>
'Commercial Proposal deleted'
1019 if (!DolibarrApiAccess::$user->hasRight(
'propal',
'creer')) {
1020 throw new RestException(403);
1022 $result = $this->propal->fetch(
$id);
1024 throw new RestException(404,
'Proposal not found');
1028 throw new RestException(403,
'Access not allowed for login '.DolibarrApiAccess::$user->login);
1031 $result = $this->propal->setDraft(DolibarrApiAccess::$user);
1033 throw new RestException(304,
'Nothing done. May be object is already draft');
1036 throw new RestException(500,
'Error : '.$this->propal->error);
1039 $result = $this->propal->fetch(
$id);
1041 throw new RestException(404,
'Proposal not found');
1049 $this->propal->fetchObjectLinked();
1078 if (!DolibarrApiAccess::$user->hasRight(
'propal',
'creer')) {
1079 throw new RestException(403);
1081 $result = $this->propal->fetch(
$id);
1083 throw new RestException(404,
'Commercial Proposal not found');
1087 throw new RestException(403,
'Access not allowed for login '.DolibarrApiAccess::$user->login);
1090 $result = $this->propal->valid(DolibarrApiAccess::$user, $notrigger);
1092 throw new RestException(304,
'Error nothing done. May be object is already validated');
1095 throw new RestException(500,
'Error when validating Commercial Proposal: '.$this->propal->error);
1098 $result = $this->propal->fetch(
$id);
1100 throw new RestException(404,
'Commercial Proposal not found');
1108 $this->propal->fetchObjectLinked();
1129 public function close(
$id, $status, $note_private =
'', $notrigger = 0, $note_public =
'')
1131 if (!DolibarrApiAccess::$user->hasRight(
'propal',
'creer')) {
1132 throw new RestException(403);
1134 $result = $this->propal->fetch(
$id);
1136 throw new RestException(404,
'Commercial Proposal not found');
1140 throw new RestException(403,
'Access not allowed for login '.DolibarrApiAccess::$user->login);
1143 $result = $this->propal->closeProposal(DolibarrApiAccess::$user, $status, $note_private, $notrigger, $note_public);
1145 throw new RestException(304,
'Error nothing done. May be object is already closed');
1148 throw new RestException(500,
'Error when closing Commercial Proposal: '.$this->propal->error);
1151 $result = $this->propal->fetch(
$id);
1153 throw new RestException(404,
'Proposal not found');
1161 $this->propal->fetchObjectLinked();
1180 if (!DolibarrApiAccess::$user->hasRight(
'propal',
'creer')) {
1181 throw new RestException(403);
1183 $result = $this->propal->fetch(
$id);
1185 throw new RestException(404,
'Commercial Proposal not found');
1189 throw new RestException(403,
'Access not allowed for login '.DolibarrApiAccess::$user->login);
1192 $result = $this->propal->classifyBilled(DolibarrApiAccess::$user);
1194 throw new RestException(500,
'Error : '.$this->propal->error);
1197 $result = $this->propal->fetch(
$id);
1199 throw new RestException(404,
'Proposal not found');
1207 $this->propal->fetchObjectLinked();
1223 if ($data ===
null) {
1227 foreach (Proposals::$FIELDS as $field) {
1228 if (!isset($data[$field])) {
1229 throw new RestException(400,
"$field field missing");
1231 $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.
print $langs trans("Show") . '< td style="' . $timeColor . '" align="center"> s</td > badge status0 badge status4 badge status3 Error badge status8< td align="center">< span class="badge ' . $badge . '"></span ></td >< td align="center">< a href="#" class="button button-small" onclick="openLogModal(this)" data-req="' . dol_escape_htmltag($reqSafe) . '" data-res="' . dol_escape_htmltag($resSafe) . '" data-err="' . dol_escape_htmltag($errSafe) . '">< span class="fa fa-search-plus"></span ></a ></td ></tr >< tr >< td colspan="' . $colspan . '" class="opacitymedium"></td ></tr ></table ></div ></form > logModal none logModal none s a JSON string
buildzip.php