51 public $errors = array();
61 public $extrafieldsCache;
66 public $update_main_doc_field;
92 public $option_multilang;
93 public $option_freetext;
94 public $option_draft_watermark;
96 public $option_modereg;
97 public $option_condreg;
98 public $option_escompte;
99 public $option_credit_note;
126 global $conf, $extrafields;
128 $logotouse = $conf->user->dir_output.
'/'.
get_exdir($user->id, 2, 0, 1, $user,
'user').
'/'.$user->photo;
131 'myuser_lastname'=>$user->lastname,
132 'myuser_firstname'=>$user->firstname,
133 'myuser_fullname'=>$user->getFullName($outputlangs, 1),
134 'myuser_login'=>$user->login,
135 'myuser_phone'=>$user->office_phone,
136 'myuser_address'=>$user->address,
137 'myuser_zip'=>$user->zip,
138 'myuser_town'=>$user->town,
139 'myuser_country'=>$user->country,
140 'myuser_country_code'=>$user->country_code,
141 'myuser_state'=>$user->state,
142 'myuser_state_code'=>$user->state_code,
143 'myuser_fax'=>$user->office_fax,
144 'myuser_mobile'=>$user->user_mobile,
145 'myuser_email'=>$user->email,
146 'myuser_logo'=>$logotouse,
147 'myuser_job'=>$user->job,
150 'myuser_dateemployment'=>
dol_print_date($user->dateemployment,
'day',
'tzuser'),
151 'myuser_dateemploymentend'=>
dol_print_date($user->dateemploymentend,
'day',
'tzuser'),
152 'myuser_gender'=>$user->gender,
155 if (is_array($user->array_options) && count($user->array_options)) {
171 global $conf, $extrafields;
173 if ($member->photo) {
174 $logotouse = $conf->adherent->dir_output.
'/'.
get_exdir(0, 0, 0, 1, $member,
'user').
'/photos/'.$member->photo;
176 $logotouse = DOL_DOCUMENT_ROOT.
'/public/theme/common/nophoto.png';
179 $array_member = array(
180 'mymember_lastname' => $member->lastname,
181 'mymember_firstname' => $member->firstname,
182 'mymember_fullname' => $member->getFullName($outputlangs, 1),
183 'mymember_login' => $member->login,
184 'mymember_address' => $member->address,
185 'mymember_zip' => $member->zip,
186 'mymember_town' => $member->town,
187 'mymember_country_code' => $member->country_code,
188 'mymember_country' => $member->country,
189 'mymember_state_code' => $member->state_code,
190 'mymember_state' => $member->state,
191 'mymember_phone_perso' => $member->phone_perso,
192 'mymember_phone_pro' => $member->phone,
193 'mymember_phone_mobile' => $member->phone_mobile,
194 'mymember_email' => $member->email,
195 'mymember_logo' => $logotouse,
196 'mymember_gender' => $member->gender,
197 'mymember_birth_locale' =>
dol_print_date($member->birth,
'day',
'tzuser', $outputlangs),
198 'mymember_birth' =>
dol_print_date($member->birth,
'day',
'tzuser'),
201 if (is_array($member->array_options) && count($member->array_options)) {
204 return $array_member;
221 if (empty($mysoc->forme_juridique) && !empty($mysoc->forme_juridique_code)) {
224 if (empty($mysoc->country) && !empty($mysoc->country_code)) {
225 $mysoc->country = $outputlangs->transnoentitiesnoconv(
"Country".$mysoc->country_code);
227 if (empty($mysoc->state) && !empty($mysoc->state_code)) {
228 $mysoc->state =
getState($mysoc->state_code, 0);
231 $logotouse = $conf->mycompany->dir_output.
'/logos/thumbs/'.$mysoc->logo_small;
234 'mycompany_logo'=>$logotouse,
235 'mycompany_name'=>$mysoc->name,
236 'mycompany_email'=>$mysoc->email,
237 'mycompany_phone'=>$mysoc->phone,
238 'mycompany_fax'=>$mysoc->fax,
239 'mycompany_address'=>$mysoc->address,
240 'mycompany_zip'=>$mysoc->zip,
241 'mycompany_town'=>$mysoc->town,
242 'mycompany_country'=>$mysoc->country,
243 'mycompany_country_code'=>$mysoc->country_code,
244 'mycompany_state'=>$mysoc->state,
245 'mycompany_state_code'=>$mysoc->state_code,
246 'mycompany_web'=>$mysoc->url,
247 'mycompany_juridicalstatus'=>$mysoc->forme_juridique,
248 'mycompany_managers'=>$mysoc->managers,
249 'mycompany_capital'=>$mysoc->capital,
250 'mycompany_barcode'=>$mysoc->barcode,
251 'mycompany_idprof1'=>$mysoc->idprof1,
252 'mycompany_idprof2'=>$mysoc->idprof2,
253 'mycompany_idprof3'=>$mysoc->idprof3,
254 'mycompany_idprof4'=>$mysoc->idprof4,
255 'mycompany_idprof5'=>$mysoc->idprof5,
256 'mycompany_idprof6'=>$mysoc->idprof6,
257 'mycompany_vatnumber'=>$mysoc->tva_intra,
258 'mycompany_object'=>$mysoc->object,
259 'mycompany_note_private'=>$mysoc->note_private,
278 global $conf, $extrafields;
280 if (empty($object->country) && !empty($object->country_code)) {
281 $object->country = $outputlangs->transnoentitiesnoconv(
"Country".$object->country_code);
283 if (empty($object->state) && !empty($object->state_code)) {
284 $object->state =
getState($object->state_code, 0);
287 $array_thirdparty = array(
288 'company_name'=>$object->name,
289 'company_name_alias' => $object->name_alias,
290 'company_email'=>$object->email,
291 'company_phone'=>$object->phone,
292 'company_fax'=>$object->fax,
293 'company_address'=>$object->address,
294 'company_zip'=>$object->zip,
295 'company_town'=>$object->town,
296 'company_country'=>$object->country,
297 'company_country_code'=>$object->country_code,
298 'company_state'=>$object->state,
299 'company_state_code'=>$object->state_code,
300 'company_web'=>$object->url,
301 'company_barcode'=>$object->barcode,
302 'company_vatnumber'=>$object->tva_intra,
303 'company_customercode'=>$object->code_client,
304 'company_suppliercode'=>$object->code_fournisseur,
305 'company_customeraccountancycode'=>$object->code_compta,
306 'company_supplieraccountancycode'=>$object->code_compta_fournisseur,
307 'company_juridicalstatus'=>$object->forme_juridique,
308 'company_outstanding_limit'=>$object->outstanding_limit,
309 'company_capital'=>$object->capital,
310 'company_idprof1'=>$object->idprof1,
311 'company_idprof2'=>$object->idprof2,
312 'company_idprof3'=>$object->idprof3,
313 'company_idprof4'=>$object->idprof4,
314 'company_idprof5'=>$object->idprof5,
315 'company_idprof6'=>$object->idprof6,
316 'company_note_public'=>$object->note_public,
317 'company_note_private'=>$object->note_private,
318 'company_default_bank_iban'=>(is_object($object->bank_account) ? $object->bank_account->iban :
''),
319 'company_default_bank_bic'=>(is_object($object->bank_account) ? $object->bank_account->bic :
'')
323 if (is_array($object->array_options) && count($object->array_options)) {
324 $object->fetch_optionals();
328 return $array_thirdparty;
343 global $conf, $extrafields;
345 if (empty($object->country) && !empty($object->country_code)) {
346 $object->country = $outputlangs->transnoentitiesnoconv(
"Country".$object->country_code);
348 if (empty($object->state) && !empty($object->state_code)) {
349 $object->state =
getState($object->state_code, 0);
352 $array_contact = array(
353 $array_key.
'_fullname' => $object->getFullName($outputlangs, 1),
354 $array_key.
'_lastname' => $object->lastname,
355 $array_key.
'_firstname' => $object->firstname,
356 $array_key.
'_address' => $object->address,
357 $array_key.
'_zip' => $object->zip,
358 $array_key.
'_town' => $object->town,
359 $array_key.
'_state_id' => $object->state_id,
360 $array_key.
'_state_code' => $object->state_code,
361 $array_key.
'_state' => $object->state,
362 $array_key.
'_country_id' => $object->country_id,
363 $array_key.
'_country_code' => $object->country_code,
364 $array_key.
'_country' => $object->country,
365 $array_key.
'_poste' => $object->poste,
366 $array_key.
'_socid' => $object->socid,
367 $array_key.
'_statut' => $object->statut,
368 $array_key.
'_code' => $object->code,
369 $array_key.
'_email' => $object->email,
370 $array_key.
'_phone_pro' => $object->phone_pro,
371 $array_key.
'_phone_perso' => $object->phone_perso,
372 $array_key.
'_phone_mobile' => $object->phone_mobile,
373 $array_key.
'_fax' => $object->fax,
374 $array_key.
'_birthday' => $object->birthday,
375 $array_key.
'_default_lang' => $object->default_lang,
376 $array_key.
'_note_public' => $object->note_public,
377 $array_key.
'_note_private' => $object->note_private,
378 $array_key.
'_civility' => $object->civility,
382 if (is_array($object->array_options) && count($object->array_options)) {
383 $object->fetch_optionals();
387 return $array_contact;
404 $array_other = array(
409 'current_server_datehour'=>
dol_print_date($now,
'dayhour',
'tzserver'),
411 'current_date_locale'=>
dol_print_date($now,
'day',
'tzuser', $outputlangs),
412 'current_datehour_locale'=>
dol_print_date($now,
'dayhour',
'tzuser', $outputlangs),
413 'current_server_date_locale'=>
dol_print_date($now,
'day',
'tzserver', $outputlangs),
414 'current_server_datehour_locale'=>
dol_print_date($now,
'dayhour',
'tzserver', $outputlangs),
418 foreach ($conf->global as $key => $val) {
420 $newval =
'*****forbidden*****';
424 $array_other[
'__['.$key.
']__'] = $newval;
443 global $conf, $extrafields;
445 $sumpayed = $sumdeposit = $sumcreditnote =
'';
446 $already_payed_all = 0;
448 if ($object->element ==
'facture') {
449 $invoice_source =
new Facture($this->
db);
450 if ($object->fk_facture_source > 0) {
451 $invoice_source->fetch($object->fk_facture_source);
453 $sumpayed = $object->getSommePaiement();
454 $sumdeposit = $object->getSumDepositsUsed();
455 $sumcreditnote = $object->getSumCreditNotesUsed();
456 $already_payed_all = $sumpayed + $sumdeposit + $sumcreditnote;
458 if ($object->fk_account > 0) {
459 require_once DOL_DOCUMENT_ROOT.
'/compta/bank/class/account.class.php';
461 $bank_account->fetch($object->fk_account);
465 $date = (isset($object->element) && $object->element ==
'contrat' && isset($object->date_contrat)) ? $object->date_contrat : (isset($object->date) ? $object->date :
null);
468 $array_key.
'_id'=>$object->id,
469 $array_key.
'_ref' => (property_exists($object,
'ref') ? $object->ref :
''),
470 $array_key.
'_label' => (property_exists($object,
'label') ? $object->label :
''),
471 $array_key.
'_ref_ext' => (property_exists($object,
'ref_ext') ? $object->ref_ext :
''),
472 $array_key.
'_ref_customer'=>(!empty($object->ref_client) ? $object->ref_client : (empty($object->ref_customer) ?
'' : $object->ref_customer)),
473 $array_key.
'_ref_supplier'=>(!empty($object->ref_fournisseur) ? $object->ref_fournisseur : (empty($object->ref_supplier) ?
'' : $object->ref_supplier)),
474 $array_key.
'_source_invoice_ref'=>((empty($invoice_source) || empty($invoice_source->ref)) ?
'' : $invoice_source->ref),
479 $array_key.
'_date_limit'=>(!empty($object->date_lim_reglement) ?
dol_print_date($object->date_lim_reglement,
'day') :
''),
480 $array_key.
'_date_end'=>(!empty($object->fin_validite) ?
dol_print_date($object->fin_validite,
'day') :
''),
481 $array_key.
'_date_creation'=>
dol_print_date($object->date_creation,
'day'),
482 $array_key.
'_date_modification'=>(!empty($object->date_modification) ?
dol_print_date($object->date_modification,
'day') :
''),
483 $array_key.
'_date_validation'=>(!empty($object->date_validation) ?
dol_print_date($object->date_validation,
'dayhour') :
''),
484 $array_key.
'_date_delivery_planed'=>(!empty($object->date_livraison) ?
dol_print_date($object->date_livraison,
'day') :
''),
485 $array_key.
'_date_close'=>(!empty($object->date_cloture) ?
dol_print_date($object->date_cloture,
'dayhour') :
''),
487 $array_key.
'_payment_mode_code'=>$object->mode_reglement_code,
488 $array_key.
'_payment_mode'=>($outputlangs->transnoentitiesnoconv(
'PaymentType'.$object->mode_reglement_code) !=
'PaymentType'.$object->mode_reglement_code ? $outputlangs->transnoentitiesnoconv(
'PaymentType'.$object->mode_reglement_code) : $object->mode_reglement),
489 $array_key.
'_payment_term_code'=>$object->cond_reglement_code,
490 $array_key.
'_payment_term'=>($outputlangs->transnoentitiesnoconv(
'PaymentCondition'.$object->cond_reglement_code) !=
'PaymentCondition'.$object->cond_reglement_code ? $outputlangs->transnoentitiesnoconv(
'PaymentCondition'.$object->cond_reglement_code) : ($object->cond_reglement_doc ? $object->cond_reglement_doc : $object->cond_reglement)),
492 $array_key.
'_incoterms' => (method_exists($object,
'display_incoterms') ? $object->display_incoterms() :
''),
494 $array_key.
'_bank_iban'=>$bank_account->iban,
495 $array_key.
'_bank_bic'=>$bank_account->bic,
496 $array_key.
'_bank_label'=>$bank_account->label,
497 $array_key.
'_bank_number'=>$bank_account->number,
498 $array_key.
'_bank_proprio'=>$bank_account->proprio,
500 $array_key.
'_total_ht_locale'=>
price($object->total_ht, 0, $outputlangs),
501 $array_key.
'_total_vat_locale'=>(!empty($object->total_vat) ?
price($object->total_vat, 0, $outputlangs) :
price($object->total_tva, 0, $outputlangs)),
502 $array_key.
'_total_localtax1_locale'=>
price($object->total_localtax1, 0, $outputlangs),
503 $array_key.
'_total_localtax2_locale'=>
price($object->total_localtax2, 0, $outputlangs),
504 $array_key.
'_total_ttc_locale'=>
price($object->total_ttc, 0, $outputlangs),
506 $array_key.
'_total_ht'=>
price2num($object->total_ht),
507 $array_key.
'_total_vat'=>(!empty($object->total_vat) ?
price2num($object->total_vat) :
price2num($object->total_tva)),
508 $array_key.
'_total_localtax1'=>
price2num($object->total_localtax1),
509 $array_key.
'_total_localtax2'=>
price2num($object->total_localtax2),
510 $array_key.
'_total_ttc'=>
price2num($object->total_ttc),
512 $array_key.
'_multicurrency_code' => $object->multicurrency_code,
513 $array_key.
'_multicurrency_tx' =>
price2num($object->multicurrency_tx),
514 $array_key.
'_multicurrency_total_ht' =>
price2num($object->multicurrency_total_ht),
515 $array_key.
'_multicurrency_total_tva' =>
price2num($object->multicurrency_total_tva),
516 $array_key.
'_multicurrency_total_ttc' =>
price2num($object->multicurrency_total_ttc),
517 $array_key.
'_multicurrency_total_ht_locale' =>
price($object->multicurrency_total_ht, 0, $outputlangs),
518 $array_key.
'_multicurrency_total_tva_locale' =>
price($object->multicurrency_total_tva, 0, $outputlangs),
519 $array_key.
'_multicurrency_total_ttc_locale' =>
price($object->multicurrency_total_ttc, 0, $outputlangs),
521 $array_key.
'_note_private'=>$object->note,
522 $array_key.
'_note_public'=>$object->note_public,
523 $array_key.
'_note'=>$object->note_public,
526 $array_key.
'_already_payed_locale'=>
price($sumpayed, 0, $outputlangs),
527 $array_key.
'_already_payed'=>
price2num($sumpayed),
528 $array_key.
'_already_deposit_locale'=>
price($sumdeposit, 0, $outputlangs),
529 $array_key.
'_already_deposit'=>
price2num($sumdeposit),
530 $array_key.
'_already_creditnote_locale'=>
price($sumcreditnote, 0, $outputlangs),
531 $array_key.
'_already_creditnote'=>
price2num($sumcreditnote),
533 $array_key.
'_already_payed_all_locale'=>
price(
price2num($already_payed_all,
'MT'), 0, $outputlangs),
534 $array_key.
'_already_payed_all'=>
price2num($already_payed_all,
'MT'),
537 $array_key.
'_remain_to_pay_locale'=>
price(
price2num($object->total_ttc - $already_payed_all,
'MT'), 0, $outputlangs),
538 $array_key.
'_remain_to_pay'=>
price2num($object->total_ttc - $already_payed_all,
'MT')
541 if (method_exists($object,
'getTotalDiscount') && in_array(get_class($object), array(
'Propal',
'Proposal',
'Commande',
'Facture',
'SupplierProposal',
'CommandeFournisseur',
'FactureFournisseur'))) {
542 $resarray[$array_key.
'_total_discount_ht_locale'] =
price($object->getTotalDiscount(), 0, $outputlangs);
543 $resarray[$array_key.
'_total_discount_ht'] =
price2num($object->getTotalDiscount());
545 $resarray[$array_key.
'_total_discount_ht_locale'] =
'';
546 $resarray[$array_key.
'_total_discount_ht'] =
'';
550 if ($object->element !=
"project" && !empty($object->fk_project) && $object->fk_project > 0) {
551 if (!is_object($object->project)) {
552 $object->fetch_projet();
555 $resarray[$array_key.
'_project_ref'] = $object->project->ref;
556 $resarray[$array_key.
'_project_title'] = $object->project->title;
557 $resarray[$array_key.
'_project_description'] = $object->project->description;
558 $resarray[$array_key.
'_project_date_start'] =
dol_print_date($object->project->date_start,
'day');
559 $resarray[$array_key.
'_project_date_end'] =
dol_print_date($object->project->date_end,
'day');
561 $resarray[$array_key.
'_project_ref'] =
'';
562 $resarray[$array_key.
'_project_title'] =
'';
563 $resarray[$array_key.
'_project_description'] =
'';
564 $resarray[$array_key.
'_project_date_start'] =
'';
565 $resarray[$array_key.
'_project_date_end'] =
'';
569 if (is_array($object->lines) && count($object->lines) > 0) {
572 foreach ($object->lines as $line) {
574 if (empty($resarray[$array_key.
'_total_vat_'.$line->tva_tx])) {
575 $resarray[$array_key.
'_total_vat_'.$line->tva_tx] = 0;
577 $resarray[$array_key.
'_total_vat_'.$line->tva_tx] += $line->total_tva;
578 $resarray[$array_key.
'_total_vat_locale_'.$line->tva_tx] =
price($resarray[$array_key.
'_total_vat_'.$line->tva_tx]);
580 $vatformated =
vatrate($line->tva_tx);
581 if (empty($resarray[$array_key.
'_total_vat_'.$vatformated])) {
582 $resarray[$array_key.
'_total_vat_'.$vatformated] = 0;
584 $resarray[$array_key.
'_total_vat_'.$vatformated] += $line->total_tva;
585 $resarray[$array_key.
'_total_vat_locale_'.$vatformated] =
price($resarray[$array_key.
'_total_vat_'.$vatformated]);
587 $totalUp += $line->subprice * $line->qty;
592 $resarray[
'object_total_up'] = $totalUp;
593 $resarray[
'object_total_up_locale'] =
price($resarray[
'object_total_up'], 0, $outputlangs);
594 if (method_exists($object,
'getTotalDiscount') && in_array(get_class($object), array(
'Propal',
'Proposal',
'Commande',
'Facture',
'SupplierProposal',
'CommandeFournisseur',
'FactureFournisseur'))) {
595 $totalDiscount = $object->getTotalDiscount();
599 if (!empty($totalUp) && !empty($totalDiscount)) {
600 $resarray[
'object_total_discount'] = round(100 / $totalUp * $totalDiscount, 2);
601 $resarray[
'object_total_discount_locale'] =
price($resarray[
'object_total_discount'], 0, $outputlangs);
603 $resarray[
'object_total_discount'] =
'';
604 $resarray[
'object_total_discount_locale'] =
'';
609 if (is_array($object->array_options) && count($object->array_options)) {
610 $object->fetch_optionals();
633 'line_pos' => $linenumber,
636 'line_product_ref'=>(empty($line->product_ref) ?
'' : $line->product_ref),
637 'line_product_ref_fourn'=>(empty($line->ref_fourn) ?
'' : $line->ref_fourn),
638 'line_product_label'=>(empty($line->product_label) ?
'' : $line->product_label),
639 'line_product_type'=>(empty($line->product_type) ?
'' : $line->product_type),
640 'line_product_barcode'=>(empty($line->product_barcode) ?
'' : $line->product_barcode),
641 'line_product_desc'=>(empty($line->product_desc) ?
'' : $line->product_desc),
643 'line_desc'=>$line->desc,
644 'line_vatrate'=>
vatrate($line->tva_tx,
true, $line->info_bits),
645 'line_localtax1_rate'=>
vatrate($line->localtax1_tx),
646 'line_localtax2_rate'=>
vatrate($line->localtax1_tx),
648 'line_up_locale'=>
price($line->subprice, 0, $outputlangs),
649 'line_total_up'=>
price2num($line->subprice * $line->qty),
650 'line_total_up_locale'=>
price($line->subprice * $line->qty, 0, $outputlangs),
651 'line_qty'=>$line->qty,
652 'line_discount_percent'=>($line->remise_percent ? $line->remise_percent.
'%' :
''),
653 'line_price_ht'=>
price2num($line->total_ht),
654 'line_price_ttc'=>
price2num($line->total_ttc),
655 'line_price_vat'=>
price2num($line->total_tva),
656 'line_price_ht_locale'=>
price($line->total_ht, 0, $outputlangs),
657 'line_price_ttc_locale'=>
price($line->total_ttc, 0, $outputlangs),
658 'line_price_vat_locale'=>
price($line->total_tva, 0, $outputlangs),
661 'line_date_start_locale'=>
dol_print_date($line->date_start,
'day',
'tzserver', $outputlangs),
662 'line_date_start_rfc'=>
dol_print_date($line->date_start,
'dayrfc'),
664 'line_date_end_locale'=>
dol_print_date($line->date_end,
'day',
'tzserver', $outputlangs),
667 'line_multicurrency_code' =>
price2num($line->multicurrency_code),
668 'line_multicurrency_subprice' =>
price2num($line->multicurrency_subprice),
669 'line_multicurrency_total_ht' =>
price2num($line->multicurrency_total_ht),
670 'line_multicurrency_total_tva' =>
price2num($line->multicurrency_total_tva),
671 'line_multicurrency_total_ttc' =>
price2num($line->multicurrency_total_ttc),
672 'line_multicurrency_subprice_locale' =>
price($line->multicurrency_subprice, 0, $outputlangs),
673 'line_multicurrency_total_ht_locale' =>
price($line->multicurrency_total_ht, 0, $outputlangs),
674 'line_multicurrency_total_tva_locale' =>
price($line->multicurrency_total_tva, 0, $outputlangs),
675 'line_multicurrency_total_ttc_locale' =>
price($line->multicurrency_total_ttc, 0, $outputlangs),
680 $resarray[
'line_unit'] = $outputlangs->trans($line->getLabelOfUnit(
'long'));
681 $resarray[
'line_unit_short'] = $outputlangs->trans($line->getLabelOfUnit(
'short'));
685 $extrafieldkey = $line->table_element;
687 require_once DOL_DOCUMENT_ROOT.
'/core/class/extrafields.class.php';
689 $extrafields->fetch_name_optionals_label($extrafieldkey,
true);
690 $line->fetch_optionals();
695 if (get_class($line) ==
'CommandeFournisseurLigne') {
697 $extrafields->fetch_name_optionals_label(
"product_fournisseur_price");
698 $extralabels = $extrafields->attributes[
"product_fournisseur_price"][
'label'];
700 if (!empty($extralabels) && is_array($extralabels)) {
703 foreach ($extralabels as $key => $label) {
704 $columns .=
"$key, ";
707 if ($columns !=
"") {
708 $columns = substr($columns, 0, strlen($columns) - 2);
709 $resql = $this->
db->query(
"SELECT ".$columns.
" FROM ".$this->db->prefix().
"product_fournisseur_price_extrafields AS ex INNER JOIN ".$this->db->prefix().
"product_fournisseur_price AS f ON ex.fk_object = f.rowid WHERE f.ref_fourn = '".$this->db->escape($line->ref_supplier).
"'");
711 if ($this->
db->num_rows($resql) > 0) {
712 $resql = $this->
db->fetch_object($resql);
714 foreach ($extralabels as $key => $label) {
715 $resarray[
'line_product_supplier_'.$key] = $resql->$key;
723 if (isset($line->fk_product) && $line->fk_product > 0) {
725 $result = $tmpproduct->fetch($line->fk_product);
726 foreach ($tmpproduct->array_options as $key => $label) {
727 $resarray[
"line_product_".$key] = $label;
731 $extrafields->fetch_name_optionals_label(
"product");
732 $extralabels = $extrafields->attributes[
"product"][
'label'];
734 foreach ($extralabels as $key => $label) {
735 $resarray[
'line_product_options_'.$key] =
'';
754 global $conf, $extrafields;
756 $object->list_delivery_methods($object->shipping_method_id);
757 $calculatedVolume = ($object->trueWidth * $object->trueHeight * $object->trueDepth);
759 $array_shipment = array(
760 $array_key.
'_id'=>$object->id,
761 $array_key.
'_ref'=>$object->ref,
762 $array_key.
'_ref_ext'=>$object->ref_ext,
763 $array_key.
'_ref_customer'=>$object->ref_customer,
764 $array_key.
'_date_delivery'=>
dol_print_date($object->date_delivery,
'day'),
765 $array_key.
'_hour_delivery'=>
dol_print_date($object->date_delivery,
'hour'),
766 $array_key.
'_date_creation'=>
dol_print_date($object->date_creation,
'day'),
767 $array_key.
'_total_ht'=>
price($object->total_ht),
768 $array_key.
'_total_vat'=>
price($object->total_tva),
769 $array_key.
'_total_ttc'=>
price($object->total_ttc),
770 $array_key.
'_total_discount_ht' =>
price($object->getTotalDiscount()),
771 $array_key.
'_note_private'=>$object->note_private,
772 $array_key.
'_note'=>$object->note_public,
773 $array_key.
'_tracking_number'=>$object->tracking_number,
774 $array_key.
'_tracking_url'=>$object->tracking_url,
775 $array_key.
'_shipping_method'=>$object->listmeths[0][
'libelle'],
776 $array_key.
'_weight'=>$object->trueWeight.
' '.
measuringUnitString(0,
'weight', $object->weight_units),
777 $array_key.
'_width'=>$object->trueWidth.
' '.
measuringUnitString(0,
'size', $object->width_units),
778 $array_key.
'_height'=>$object->trueHeight.
' '.
measuringUnitString(0,
'size', $object->height_units),
779 $array_key.
'_depth'=>$object->trueDepth.
' '.
measuringUnitString(0,
'size', $object->depth_units),
784 foreach ($object->lines as $line) {
785 if (empty($array_shipment[$array_key.
'_total_vat_'.$line->tva_tx])) {
786 $array_shipment[$array_key.
'_total_vat_'.$line->tva_tx] = 0;
788 $array_shipment[$array_key.
'_total_vat_'.$line->tva_tx] += $line->total_tva;
792 if (is_array($object->array_options) && count($object->array_options)) {
793 $object->fetch_optionals();
799 if (!empty($object->commande) && is_object($object->commande)) {
800 $array_shipment[
'order_ref'] = $object->commande->ref;
801 $array_shipment[
'order_ref_customer'] = $object->commande->ref_customer;
804 return $array_shipment;
824 'line_product_ref'=>$line->product_ref,
825 'line_product_label'=>$line->product_label,
826 'line_desc'=>$line->desc,
827 'line_vatrate'=>
vatrate($line->tva_tx,
true, $line->info_bits),
828 'line_up'=>
price($line->subprice),
829 'line_total_up'=>
price($line->subprice * $line->qty),
830 'line_qty'=>$line->qty,
831 'line_qty_shipped'=>$line->qty_shipped,
832 'line_qty_asked'=>$line->qty_asked,
833 'line_discount_percent'=>($line->remise_percent ? $line->remise_percent.
'%' :
''),
834 'line_price_ht'=>
price($line->total_ht),
835 'line_price_ttc'=>
price($line->total_ttc),
836 'line_price_vat'=>
price($line->total_tva),
837 'line_weight'=>empty($line->weight) ?
'' : $line->weight * $line->qty_shipped.
' '.
measuringUnitString(0,
'weight', $line->weight_units),
838 'line_length'=>empty($line->length) ?
'' : $line->length * $line->qty_shipped.
' '.
measuringUnitString(0,
'size', $line->length_units),
839 'line_surface'=>empty($line->surface) ?
'' : $line->surface * $line->qty_shipped.
' '.
measuringUnitString(0,
'surface', $line->surface_units),
840 'line_volume'=>empty($line->volume) ?
'' : $line->volume * $line->qty_shipped.
' '.
measuringUnitString(0,
'volume', $line->volume_units),
844 $extrafieldkey = $line->element;
846 require_once DOL_DOCUMENT_ROOT.
'/core/class/extrafields.class.php';
848 $extrafields->fetch_name_optionals_label($extrafieldkey,
true);
849 $line->fetch_optionals();
854 if (isset($line->fk_product) && $line->fk_product > 0) {
856 $tmpproduct->fetch($line->fk_product);
857 foreach ($tmpproduct->array_options as $key=>$label)
858 $resarray[
"line_product_".$key] = $label;
877 $array_other = array();
878 if (!empty($object)) {
879 foreach ($object as $key => $value) {
880 if (in_array($key, array(
'db',
'fields',
'lines',
'modelpdf',
'model_pdf'))) {
883 if (!empty($value)) {
884 if (!is_array($value) && !is_object($value)) {
885 $array_other[
'object_'.$key] = $value;
886 } elseif (is_array($value) && $recursive) {
888 foreach ($tmparray as $key2 => $value2) {
889 $array_other[
'object_'.$key.
'_'.preg_replace(
'/^object_/',
'', $key2)] = $value2;
891 } elseif (is_object($value) && $recursive) {
893 foreach ($tmparray as $key2 => $value2) {
894 $array_other[
'object_'.$key.
'_'.preg_replace(
'/^object_/',
'', $key2)] = $value2;
923 if (is_array($extrafields->attributes[$object->table_element][
'label'])) {
924 foreach ($extrafields->attributes[$object->table_element][
'label'] as $key => $label) {
925 if ($extrafields->attributes[$object->table_element][
'type'][$key] ==
'price') {
926 $object->array_options[
'options_'.$key] =
price2num($object->array_options[
'options_'.$key]);
927 $object->array_options[
'options_'.$key.
'_currency'] =
price($object->array_options[
'options_'.$key], 0, $outputlangs, 0, 0, -1, $conf->currency);
929 $array_to_fill = array_merge($array_to_fill, array($array_key.
'_options_'.$key.
'_currency' => $object->array_options[
'options_'.$key.
'_currency']));
930 } elseif ($extrafields->attributes[$object->table_element][
'type'][$key] ==
'select') {
931 $valueofselectkey = $object->array_options[
'options_'.$key];
932 if (array_key_exists($valueofselectkey, $extrafields->attributes[$object->table_element][
'param'][$key][
'options'])) {
933 $object->array_options[
'options_'.$key] = $extrafields->attributes[$object->table_element][
'param'][$key][
'options'][$valueofselectkey];
935 $object->array_options[
'options_'.$key] =
'';
937 } elseif ($extrafields->attributes[$object->table_element][
'type'][$key] ==
'checkbox') {
938 $valArray = explode(
',', $object->array_options[
'options_'.$key]);
940 foreach ($extrafields->attributes[$object->table_element][
'param'][$key][
'options'] as $keyopt => $valopt) {
941 if (in_array($keyopt, $valArray)) {
945 $object->array_options[
'options_'.$key] = implode(
', ', $output);
946 } elseif ($extrafields->attributes[$object->table_element][
'type'][$key] ==
'date') {
947 if (strlen($object->array_options[
'options_'.$key]) > 0) {
948 $date = $object->array_options[
'options_'.$key];
949 $object->array_options[
'options_'.$key] =
dol_print_date($date,
'day');
950 $object->array_options[
'options_'.$key.
'_locale'] =
dol_print_date($date,
'day',
'tzserver', $outputlangs);
951 $object->array_options[
'options_'.$key.
'_rfc'] =
dol_print_date($date,
'dayrfc');
953 $object->array_options[
'options_'.$key] =
'';
954 $object->array_options[
'options_'.$key.
'_locale'] =
'';
955 $object->array_options[
'options_'.$key.
'_rfc'] =
'';
957 $array_to_fill = array_merge($array_to_fill, array($array_key.
'_options_'.$key.
'_locale' => $object->array_options[
'options_'.$key.
'_locale']));
958 $array_to_fill = array_merge($array_to_fill, array($array_key.
'_options_'.$key.
'_rfc' => $object->array_options[
'options_'.$key.
'_rfc']));
959 } elseif ($extrafields->attributes[$object->table_element][
'label'][$key] ==
'datetime') {
960 $datetime = $object->array_options[
'options_'.$key];
961 $object->array_options[
'options_'.$key] = ($datetime !=
"0000-00-00 00:00:00" ?
dol_print_date($object->array_options[
'options_'.$key],
'dayhour') :
'');
962 $object->array_options[
'options_'.$key.
'_locale'] = ($datetime !=
"0000-00-00 00:00:00" ?
dol_print_date($object->array_options[
'options_'.$key],
'dayhour',
'tzserver', $outputlangs) :
'');
963 $object->array_options[
'options_'.$key.
'_rfc'] = ($datetime !=
"0000-00-00 00:00:00" ?
dol_print_date($object->array_options[
'options_'.$key],
'dayhourrfc') :
'');
964 $array_to_fill = array_merge($array_to_fill, array($array_key.
'_options_'.$key.
'_locale' => $object->array_options[
'options_'.$key.
'_locale']));
965 $array_to_fill = array_merge($array_to_fill, array($array_key.
'_options_'.$key.
'_rfc' => $object->array_options[
'options_'.$key.
'_rfc']));
966 } elseif ($extrafields->attributes[$object->table_element][
'type'][$key] ==
'link') {
967 $id = $object->array_options[
'options_'.$key];
969 $param = $extrafields->attributes[$object->table_element][
'param'][$key];
970 $param_list = array_keys($param[
'options']);
971 $InfoFieldList = explode(
":", $param_list[0]);
972 $classname = $InfoFieldList[0];
973 $classpath = $InfoFieldList[1];
974 if (!empty($classpath)) {
976 if ($classname && class_exists($classname)) {
977 $tmpobject =
new $classname($this->
db);
978 $tmpobject->fetch($id);
980 $object->array_options[
'options_'.$key] = $tmpobject->name;
986 if (array_key_exists(
'options_'.$key, $object->array_options)) {
987 $array_to_fill = array_merge($array_to_fill, array($array_key.
'_options_'.$key => $object->array_options[
'options_'.$key]));
989 $array_to_fill = array_merge($array_to_fill, array($array_key.
'_options_'.$key =>
''));
994 return $array_to_fill;
1010 public function printRect($pdf, $x, $y, $l, $h, $hidetop = 0, $hidebottom = 0)
1012 if (empty($hidetop) || $hidetop == -1) {
1013 $pdf->line($x, $y, $x + $l, $y);
1015 $pdf->line($x + $l, $y, $x + $l, $y + $h);
1016 if (empty($hidebottom)) {
1017 $pdf->line($x + $l, $y + $h, $x, $y + $h);
1019 $pdf->line($x, $y + $h, $x, $y);
1032 if (empty($a[
'rank'])) {
1035 if (empty($b[
'rank'])) {
1038 if ($a[
'rank'] == $b[
'rank']) {
1041 return ($a[
'rank'] > $b[
'rank']) ? -1 : 1;
1056 $this->defineColumnField($object, $outputlangs, $hidedetails, $hidedesc, $hideref);
1060 uasort($this->cols, array($this,
'columnSort'));
1063 $curX = $this->page_largeur - $this->marge_droite;
1066 $arrayWidth = $this->page_largeur - $this->marge_droite - $this->marge_gauche;
1069 $totalDefinedColWidth = 0;
1071 foreach ($this->cols as $colKey => & $colDef) {
1076 if (!empty($colDef[
'scale'])) {
1078 $colDef[
'width'] = abs($arrayWidth * $colDef[
'scale'] / 100);
1081 if (empty($colDef[
'width'])) {
1084 $totalDefinedColWidth += $colDef[
'width'];
1088 foreach ($this->cols as $colKey => & $colDef) {
1090 if (!empty($colDef[
'title'])) {
1091 $colDef[
'title'] = array_replace($this->defaultTitlesFieldsStyle, $colDef[
'title']);
1093 $colDef[
'title'] = $this->defaultTitlesFieldsStyle;
1097 if (!empty($colDef[
'content'])) {
1098 $colDef[
'content'] = array_replace($this->defaultContentsFieldsStyle, $colDef[
'content']);
1100 $colDef[
'content'] = $this->defaultContentsFieldsStyle;
1105 if (empty($colDef[
'width'])) {
1106 $colDef[
'width'] = abs(($arrayWidth - $totalDefinedColWidth)) / $countFlexCol;
1111 $curX = $lastX - $colDef[
'width'];
1112 $colDef[
'xStartPos'] = $curX;
1113 $colDef[
'xEndPos'] = $lastX;
1126 $colDef = $this->cols[$colKey];
1127 return $colDef[
'width'] - $colDef[
'content'][
'padding'][3] - $colDef[
'content'][
'padding'][1];
1139 $colDef = $this->cols[$colKey];
1140 return (isset($colDef[
'xStartPos']) ? $colDef[
'xStartPos'] : 0) + $colDef[
'content'][
'padding'][3];
1151 if (!isset($this->cols[$colKey][
'rank'])) {
1154 return $this->cols[$colKey][
'rank'];
1166 public function insertNewColumnDef($newColKey, $defArray, $targetCol =
false, $insertAfterTarget =
false)
1172 if (!empty($targetCol)) {
1174 if ($rank >= 0 && $insertAfterTarget) {
1180 if ($rank < 0 && !empty($defArray[
'rank'])) {
1181 $rank = $defArray[
'rank'];
1189 foreach ($this->cols as $colKey => & $colDef) {
1190 if ($rank <= $colDef[
'rank']) {
1191 $colDef[
'rank'] = $colDef[
'rank'] + 1;
1195 $defArray[
'rank'] = $rank;
1196 $this->cols[$newColKey] = $defArray;
1213 global $hookmanager;
1215 $parameters = array(
1217 'columnText' => $columnText,
1218 'colKey' => $colKey,
1221 $reshook = $hookmanager->executeHooks(
'printStdColumnContent', $parameters, $this);
1226 if (empty($columnText)) {
1230 $colDef = $this->cols[$colKey];
1232 $curentCellPaddinds = $pdf->getCellPaddings();
1234 $pdf->setCellPaddings($colDef[
'content'][
'padding'][3], $colDef[
'content'][
'padding'][0], $colDef[
'content'][
'padding'][1], $colDef[
'content'][
'padding'][2]);
1235 $pdf->writeHTMLCell($colDef[
'width'], 2, $colDef[
'xStartPos'], $curY, $columnText, 0, 1, 0,
true, $colDef[
'content'][
'align']);
1238 $pdf->setCellPaddings($curentCellPaddinds[
'L'], $curentCellPaddinds[
'T'], $curentCellPaddinds[
'R'], $curentCellPaddinds[
'B']);
1259 public function printColDescContent($pdf, &$curY, $colKey, $object, $i, $outputlangs, $hideref = 0, $hidedesc = 0, $issupplierline = 0)
1262 $colDef = $this->cols[$colKey];
1264 $curentCellPaddinds = $pdf->getCellPaddings();
1266 $pdf->setCellPaddings($colDef[
'content'][
'padding'][3], $colDef[
'content'][
'padding'][0], $colDef[
'content'][
'padding'][1], $colDef[
'content'][
'padding'][2]);
1269 pdf_writelinedesc($pdf, $object, $i, $outputlangs, $colDef[
'width'], 3, $colDef[
'xStartPos'], $curY, $hideref, $hidedesc, $issupplierline);
1270 $posYAfterDescription = $pdf->GetY() - $colDef[
'content'][
'padding'][0];
1273 $pdf->setCellPaddings($curentCellPaddinds[
'L'], $curentCellPaddinds[
'T'], $curentCellPaddinds[
'R'], $curentCellPaddinds[
'B']);
1277 'display' =>
'list',
1278 'printableEnable' => array(3),
1279 'printableEnableNotEmpty' => array(4)
1281 $extrafieldDesc = $this->getExtrafieldsInHtml($object->lines[$i], $outputlangs, $params);
1282 if (!empty($extrafieldDesc)) {
1298 global $hookmanager;
1300 if (empty($object->table_element)) {
1304 $extrafieldsKeyPrefix =
"options_";
1307 $pos = strpos($extrafieldKey, $extrafieldsKeyPrefix);
1309 $extrafieldKey = substr($extrafieldKey, strlen($extrafieldsKeyPrefix));
1312 $extrafieldOptionsKey = $extrafieldsKeyPrefix.$extrafieldKey;
1316 if (empty($this->extrafieldsCache)) {
1319 if (empty($this->extrafieldsCache->attributes[$object->table_element])) {
1320 $this->extrafieldsCache->fetch_name_optionals_label($object->table_element);
1322 $extrafields = $this->extrafieldsCache;
1324 $extrafieldOutputContent =
'';
1325 if (isset($object->array_options[$extrafieldOptionsKey])) $extrafieldOutputContent = $extrafields->showOutputField($extrafieldKey, $object->array_options[$extrafieldOptionsKey],
'', $object->table_element);
1328 if ($extrafields->attributes[$object->table_element][
'type'][$extrafieldKey] ==
'link') {
1333 $parameters = array(
1334 'object' => $object,
1335 'extrafields' => $extrafields,
1336 'extrafieldKey' => $extrafieldKey,
1337 'extrafieldOutputContent' =>& $extrafieldOutputContent
1339 $reshook = $hookmanager->executeHooks(
'getPDFExtrafieldContent', $parameters, $this);
1344 $extrafieldOutputContent = $hookmanager->resPrint;
1347 return $extrafieldOutputContent;
1359 public function getExtrafieldsInHtml($object, $outputlangs, $params = array())
1361 global $hookmanager;
1363 if (empty($object->table_element)) {
1368 if (empty($this->extrafieldsCache)) {
1371 if (empty($this->extrafieldsCache->attributes[$object->table_element])) {
1372 $this->extrafieldsCache->fetch_name_optionals_label($object->table_element);
1374 $extrafields = $this->extrafieldsCache;
1376 $defaultParams = array(
1378 'display' =>
'auto',
1379 'printableEnable' => array(1),
1380 'printableEnableNotEmpty' => array(2),
1383 'maxItemsInRow' => 2,
1387 'labelcolwidth' =>
'25%',
1388 'arrayOfLineBreakType' => array(
'text',
'html')
1392 'separator' =>
'<br>'
1401 $params = $params + $defaultParams;
1410 if (!empty($extrafields->attributes[$object->table_element][
'label']) && is_array($extrafields->attributes[$object->table_element][
'label'])) {
1411 foreach ($extrafields->attributes[$object->table_element][
'label'] as $key => $label) {
1414 $disableOnEmpty = 0;
1415 if (!empty($extrafields->attributes[$object->table_element][
'printable'][$key])) {
1416 $printable = intval($extrafields->attributes[$object->table_element][
'printable'][$key]);
1417 if (in_array($printable, $params[
'printableEnable']) || in_array($printable, $params[
'printableEnableNotEmpty'])) {
1421 if (in_array($printable, $params[
'printableEnableNotEmpty'])) {
1422 $disableOnEmpty = 1;
1426 if (empty($enabled)) {
1430 $field =
new stdClass();
1431 $field->rank = intval($extrafields->attributes[$object->table_element][
'pos'][$key]);
1433 $field->label = $outputlangs->transnoentities($label);
1434 $field->type = $extrafields->attributes[$object->table_element][
'type'][$key];
1437 if ($disableOnEmpty && empty($field->content)) {
1445 if (!empty($fields)) {
1447 uasort($fields,
function ($a, $b) {
1448 return ($a->rank > $b->rank) ? 1 : -1;
1452 $html .= !empty($params[
'style']) ?
'<style>'.$params[
'style'].
'</style>' :
'';
1455 if ($params[
'display'] ==
'auto') {
1456 $lastNnumbItems = 0;
1457 foreach ($params[
'auto'] as $display => $numbItems) {
1458 if ($lastNnumbItems <= $numbItems && count($fields) > $numbItems) {
1459 $lastNnumbItems = $numbItems;
1460 $params[
'display'] = $display;
1465 if ($params[
'display'] ==
'list') {
1468 foreach ($fields as $field) {
1469 $html .= !empty($i) ? $params[
'list'][
'separator'] :
'';
1470 $html .=
'<strong>'.$field->label.
' : </strong>';
1471 $html .= $field->content;
1474 } elseif ($params[
'display'] ==
'table') {
1476 $html .=
'<table class="extrafield-table" cellspacing="'.$params[
'table'][
'cellspacing'].
'" cellpadding="'.$params[
'table'][
'cellpadding'].
'" border="'.$params[
'table'][
'border'].
'">';
1480 $maxItemsInRow = $params[
'table'][
'maxItemsInRow'];
1481 foreach ($fields as $field) {
1483 if ($itemsInRow >= $maxItemsInRow) {
1485 $html .=
"</tr><tr>";
1490 if (in_array($field->type, $params[
'table'][
'arrayOfLineBreakType'])) {
1491 if ($itemsInRow > 0) {
1493 for ($i = $itemsInRow; $i <= $maxItemsInRow; $i++) {
1494 $html .=
"<td></td><td></td>";
1502 $itemsInRow = $maxItemsInRow;
1503 $html .=
'<td colspan="'.($maxItemsInRow * 2 - 1).
'">';
1504 $html .=
'<strong>'.$field->label.
' :</strong> ';
1505 $html .= $field->content;
1509 $html .=
'<td width="'.$params[
'table'][
'labelcolwidth'].
'" class="extrafield-label">';
1510 $html .=
'<strong>'.$field->label.
' :</strong>';
1514 $html .=
'<td class="extrafield-content">';
1515 $html .= $field->content;
1521 $html .=
'</table>';
1537 if (!empty($this->cols[$colKey][
'status'])) {
1554 public function pdfTabTitles(&$pdf, $tab_top, $tab_height, $outputlangs, $hidetop = 0)
1556 global $hookmanager, $conf;
1558 foreach ($this->cols as $colKey => $colDef) {
1559 $parameters = array(
1560 'colKey' => $colKey,
1562 'outputlangs' => $outputlangs,
1563 'tab_top' => $tab_top,
1564 'tab_height' => $tab_height,
1565 'hidetop' => $hidetop
1568 $reshook = $hookmanager->executeHooks(
'pdfTabTitles', $parameters, $this);
1571 } elseif (empty($reshook)) {
1577 $colDef[
'title'][
'label'] = !empty($colDef[
'title'][
'label']) ? $colDef[
'title'][
'label'] : $outputlangs->transnoentities($colDef[
'title'][
'textkey']);
1580 if (!empty($colDef[
'border-left'])) {
1581 $pdf->line($colDef[
'xStartPos'], $tab_top, $colDef[
'xStartPos'], $tab_top + $tab_height);
1584 if (empty($hidetop)) {
1586 $curentCellPaddinds = $pdf->getCellPaddings();
1589 global $outputlangsbis;
1590 if (is_object($outputlangsbis)) {
1592 $pdf->setCellPaddings($colDef[
'title'][
'padding'][3], $colDef[
'title'][
'padding'][0], $colDef[
'title'][
'padding'][1], 0.5);
1595 $pdf->setCellPaddings($colDef[
'title'][
'padding'][3], $colDef[
'title'][
'padding'][0], $colDef[
'title'][
'padding'][1], $colDef[
'title'][
'padding'][2]);
1598 $pdf->SetXY($colDef[
'xStartPos'], $tab_top);
1599 $textWidth = $colDef[
'width'];
1600 $pdf->MultiCell($textWidth, 2, $colDef[
'title'][
'label'],
'', $colDef[
'title'][
'align']);
1603 if (is_object($outputlangsbis) && trim($colDef[
'title'][
'label'])) {
1604 $pdf->setCellPaddings($colDef[
'title'][
'padding'][3], 0, $colDef[
'title'][
'padding'][1], $colDef[
'title'][
'padding'][2]);
1605 $pdf->SetXY($colDef[
'xStartPos'], $pdf->GetY());
1606 $textbis = $outputlangsbis->transnoentities($colDef[
'title'][
'textkey']);
1607 $pdf->MultiCell($textWidth, 2, $textbis,
'', $colDef[
'title'][
'align']);
1610 $this->tabTitleHeight = max($pdf->GetY() - $tab_top, $this->tabTitleHeight);
1613 $pdf->setCellPaddings($curentCellPaddinds[
'L'], $curentCellPaddinds[
'T'], $curentCellPaddinds[
'R'], $curentCellPaddinds[
'B']);
1618 return $this->tabTitleHeight;
1633 if (!empty($hidedetails)) {
1637 if (empty($object->table_element)) {
1642 if (empty($this->extrafieldsCache)) {
1645 if (empty($this->extrafieldsCache->attributes[$object->table_element])) {
1646 $this->extrafieldsCache->fetch_name_optionals_label($object->table_element);
1648 $extrafields = $this->extrafieldsCache;
1651 if (!empty($extrafields->attributes[$object->table_element]) && is_array($extrafields->attributes[$object->table_element]) && array_key_exists(
'label', $extrafields->attributes[$object->table_element]) && is_array($extrafields->attributes[$object->table_element][
'label'])) {
1652 foreach ($extrafields->attributes[$object->table_element][
'label'] as $key => $label) {
1654 if ($extrafields->attributes[$object->table_element][
'type'][$key] ==
'separate') {
1660 if (!empty($extrafields->attributes[$object->table_element][
'printable'][$key])) {
1661 $printable = intval($extrafields->attributes[$object->table_element][
'printable'][$key]);
1662 if ($printable === 1 || $printable === 2) {
1673 if (!empty($extrafields->attributes[$object->table_element][
'langfile'][$key])) {
1674 $outputlangs->load($extrafields->attributes[$object->table_element][
'langfile'][$key]);
1681 'rank' => intval($extrafields->attributes[$object->table_element][
'pos'][$key]),
1683 'status' => boolval($enabled),
1685 'label' => $outputlangs->transnoentities($label)
1690 'border-left' =>
true,
1693 $alignTypeRight = array(
'double',
'int',
'price');
1694 if (in_array($extrafields->attributes[$object->table_element][
'type'][$key], $alignTypeRight)) {
1695 $def[
'content'][
'align'] =
'R';
1698 $alignTypeLeft = array(
'text',
'html');
1699 if (in_array($extrafields->attributes[$object->table_element][
'type'][$key], $alignTypeLeft)) {
1700 $def[
'content'][
'align'] =
'L';