50 public function __construct($db, $cachedir =
'', $refreshCache =
false)
52 global $conf, $dolibarr_main_url_root;
54 if (empty($cachedir)) {
55 $cachedir = $conf->api->dir_temp;
57 Defaults::$cacheDirectory = $cachedir;
60 $production_mode = (empty($conf->global->API_PRODUCTION_MODE) ? false :
true);
61 $this->r =
new Restler($production_mode, $refreshCache);
63 $urlwithouturlroot = preg_replace(
'/'.preg_quote(DOL_URL_ROOT,
'/').
'$/i',
'', trim($dolibarr_main_url_root));
64 $urlwithroot = $urlwithouturlroot.DOL_URL_ROOT;
66 $urlwithouturlrootautodetect = preg_replace(
'/'.preg_quote(DOL_URL_ROOT,
'/').
'$/i',
'', trim(DOL_MAIN_URL_ROOT));
67 $urlwithrootautodetect = $urlwithouturlroot.DOL_URL_ROOT;
69 $this->r->setBaseUrls($urlwithouturlroot, $urlwithouturlrootautodetect);
70 $this->r->setAPIVersion(1);
109 unset($object->isextrafieldmanaged);
110 unset($object->ismultientitymanaged);
111 unset($object->restrictiononfksoc);
112 unset($object->table_rowid);
113 unset($object->pass);
114 unset($object->pass_indatabase);
117 unset($object->linkedObjects);
120 unset($object->fields);
121 unset($object->oldline);
123 unset($object->error);
124 unset($object->errors);
125 unset($object->errorhidden);
127 unset($object->ref_previous);
128 unset($object->ref_next);
129 unset($object->imgWidth);
130 unset($object->imgHeight);
131 unset($object->barcode_type_code);
132 unset($object->barcode_type_label);
134 unset($object->mode_reglement);
135 unset($object->cond_reglement);
136 unset($object->note);
137 unset($object->contact);
138 unset($object->thirdparty);
140 unset($object->projet);
141 unset($object->project);
142 unset($object->fk_projet);
143 unset($object->author);
144 unset($object->timespent_old_duration);
145 unset($object->timespent_id);
146 unset($object->timespent_duration);
147 unset($object->timespent_date);
148 unset($object->timespent_datehour);
149 unset($object->timespent_withhour);
150 unset($object->timespent_fk_user);
151 unset($object->timespent_note);
152 unset($object->fk_delivery_address);
153 unset($object->modelpdf);
154 unset($object->sendtoid);
155 unset($object->name_bis);
156 unset($object->newref);
157 unset($object->alreadypaid);
158 unset($object->openid);
160 unset($object->statuts);
161 unset($object->statuts_short);
162 unset($object->statuts_logo);
163 unset($object->statuts_long);
168 unset($object->stats_propale);
169 unset($object->stats_commande);
170 unset($object->stats_contrat);
171 unset($object->stats_facture);
172 unset($object->stats_commande_fournisseur);
173 unset($object->stats_reception);
174 unset($object->stats_mrptoconsume);
175 unset($object->stats_mrptoproduce);
177 unset($object->element);
178 unset($object->element_for_permission);
179 unset($object->fk_element);
180 unset($object->table_element);
181 unset($object->table_element_line);
182 unset($object->class_element_line);
183 unset($object->picto);
185 unset($object->fieldsforcombobox);
186 unset($object->regeximgext);
188 unset($object->skip_update_total);
189 unset($object->context);
190 unset($object->next_prev_filter);
192 unset($object->region);
193 unset($object->region_code);
194 unset($object->country);
195 unset($object->state);
196 unset($object->state_code);
197 unset($object->departement);
198 unset($object->departement_code);
200 unset($object->libelle_statut);
201 unset($object->libelle_paiement);
203 unset($object->prefix_comm);
205 if (!isset($object->table_element) || $object->table_element !=
'ticket') {
206 unset($object->comments);
218 unset($object->oldcopy);
221 if (isset($object->lines) && is_array($object->lines) && count($object->lines) > 0) {
222 $nboflines = count($object->lines);
223 for ($i = 0; $i < $nboflines; $i++) {
226 unset($object->lines[$i]->contact);
227 unset($object->lines[$i]->contact_id);
228 unset($object->lines[$i]->country);
229 unset($object->lines[$i]->country_id);
230 unset($object->lines[$i]->country_code);
231 unset($object->lines[$i]->mode_reglement_id);
232 unset($object->lines[$i]->mode_reglement_code);
233 unset($object->lines[$i]->mode_reglement);
234 unset($object->lines[$i]->cond_reglement_id);
235 unset($object->lines[$i]->cond_reglement_code);
236 unset($object->lines[$i]->cond_reglement);
237 unset($object->lines[$i]->fk_delivery_address);
238 unset($object->lines[$i]->fk_projet);
239 unset($object->lines[$i]->fk_project);
240 unset($object->lines[$i]->thirdparty);
241 unset($object->lines[$i]->user);
242 unset($object->lines[$i]->model_pdf);
243 unset($object->lines[$i]->modelpdf);
244 unset($object->lines[$i]->note_public);
245 unset($object->lines[$i]->note_private);
246 unset($object->lines[$i]->fk_incoterms);
247 unset($object->lines[$i]->label_incoterms);
248 unset($object->lines[$i]->location_incoterms);
249 unset($object->lines[$i]->name);
250 unset($object->lines[$i]->lastname);
251 unset($object->lines[$i]->firstname);
252 unset($object->lines[$i]->civility_id);
253 unset($object->lines[$i]->fk_multicurrency);
254 unset($object->lines[$i]->multicurrency_code);
255 unset($object->lines[$i]->shipping_method_id);
259 if (!empty($object->thirdparty) && is_object($object->thirdparty)) {
263 if (!empty($object->product) && is_object($object->product)) {