49 public function __construct($db, $cachedir =
'', $refreshCache =
false)
51 global $conf, $dolibarr_main_url_root;
53 if (empty($cachedir)) {
54 $cachedir = $conf->api->dir_temp;
56 Defaults::$cacheDirectory = $cachedir;
60 $this->r =
new Restler($production_mode, $refreshCache);
62 $urlwithouturlroot = preg_replace(
'/'.preg_quote(DOL_URL_ROOT,
'/').
'$/i',
'', trim($dolibarr_main_url_root));
63 $urlwithroot = $urlwithouturlroot.DOL_URL_ROOT;
65 $urlwithouturlrootautodetect = preg_replace(
'/'.preg_quote(DOL_URL_ROOT,
'/').
'$/i',
'', trim(DOL_MAIN_URL_ROOT));
66 $urlwithrootautodetect = $urlwithouturlroot.DOL_URL_ROOT;
68 $this->r->setBaseUrls($urlwithouturlroot, $urlwithouturlrootautodetect);
69 $this->r->setAPIVersion(1);
137 unset($object->isextrafieldmanaged);
138 unset($object->ismultientitymanaged);
139 unset($object->restrictiononfksoc);
140 unset($object->table_rowid);
141 unset($object->pass);
142 unset($object->pass_indatabase);
145 unset($object->linkedObjects);
148 unset($object->fields);
149 unset($object->oldline);
151 unset($object->error);
152 unset($object->errors);
153 unset($object->errorhidden);
155 unset($object->ref_previous);
156 unset($object->ref_next);
157 unset($object->imgWidth);
158 unset($object->imgHeight);
159 unset($object->barcode_type_code);
160 unset($object->barcode_type_label);
162 unset($object->mode_reglement);
163 unset($object->cond_reglement);
164 unset($object->note);
165 unset($object->contact);
166 unset($object->thirdparty);
168 unset($object->projet);
169 unset($object->project);
170 unset($object->fk_projet);
171 unset($object->author);
172 unset($object->timespent_old_duration);
173 unset($object->timespent_id);
174 unset($object->timespent_duration);
175 unset($object->timespent_date);
176 unset($object->timespent_datehour);
177 unset($object->timespent_withhour);
178 unset($object->timespent_fk_user);
179 unset($object->timespent_note);
180 unset($object->fk_delivery_address);
181 unset($object->modelpdf);
182 unset($object->sendtoid);
183 unset($object->name_bis);
184 unset($object->newref);
185 unset($object->alreadypaid);
186 unset($object->openid);
191 unset($object->stats_propale);
192 unset($object->stats_commande);
193 unset($object->stats_contrat);
194 unset($object->stats_facture);
195 unset($object->stats_commande_fournisseur);
196 unset($object->stats_reception);
197 unset($object->stats_mrptoconsume);
198 unset($object->stats_mrptoproduce);
200 unset($object->element);
201 unset($object->element_for_permission);
202 unset($object->fk_element);
203 unset($object->table_element);
204 unset($object->table_element_line);
205 unset($object->class_element_line);
206 unset($object->picto);
208 unset($object->fieldsforcombobox);
209 unset($object->regeximgext);
211 unset($object->skip_update_total);
212 unset($object->context);
213 unset($object->next_prev_filter);
215 unset($object->region);
216 unset($object->region_code);
217 unset($object->country);
218 unset($object->state);
219 unset($object->state_code);
220 unset($object->departement);
221 unset($object->departement_code);
223 unset($object->libelle_statut);
224 unset($object->libelle_paiement);
226 unset($object->prefix_comm);
228 if (!isset($object->table_element) || $object->table_element !=
'ticket') {
229 unset($object->comments);
241 unset($object->oldcopy);
244 if (isset($object->lines) && is_array($object->lines) && count($object->lines) > 0) {
245 $nboflines = count($object->lines);
246 for ($i = 0; $i < $nboflines; $i++) {
249 unset($object->lines[$i]->contact);
250 unset($object->lines[$i]->contact_id);
251 unset($object->lines[$i]->country);
252 unset($object->lines[$i]->country_id);
253 unset($object->lines[$i]->country_code);
254 unset($object->lines[$i]->mode_reglement_id);
255 unset($object->lines[$i]->mode_reglement_code);
256 unset($object->lines[$i]->mode_reglement);
257 unset($object->lines[$i]->cond_reglement_id);
258 unset($object->lines[$i]->cond_reglement_code);
259 unset($object->lines[$i]->cond_reglement);
260 unset($object->lines[$i]->fk_delivery_address);
261 unset($object->lines[$i]->fk_projet);
262 unset($object->lines[$i]->fk_project);
263 unset($object->lines[$i]->thirdparty);
264 unset($object->lines[$i]->user);
265 unset($object->lines[$i]->model_pdf);
266 unset($object->lines[$i]->modelpdf);
267 unset($object->lines[$i]->note_public);
268 unset($object->lines[$i]->note_private);
269 unset($object->lines[$i]->fk_incoterms);
270 unset($object->lines[$i]->label_incoterms);
271 unset($object->lines[$i]->location_incoterms);
272 unset($object->lines[$i]->name);
273 unset($object->lines[$i]->lastname);
274 unset($object->lines[$i]->firstname);
275 unset($object->lines[$i]->civility_id);
276 unset($object->lines[$i]->fk_multicurrency);
277 unset($object->lines[$i]->multicurrency_code);
278 unset($object->lines[$i]->shipping_method_id);
282 if (!empty($object->thirdparty) && is_object($object->thirdparty)) {
286 if (!empty($object->product) && is_object($object->product)) {