51 public $errors = array();
61 public $extrafieldsCache;
66 public $update_main_doc_field;
97 public $option_multilang;
98 public $option_freetext;
99 public $option_draft_watermark;
102 public $option_modereg;
103 public $option_condreg;
104 public $option_escompte;
105 public $option_credit_note;
113 public $phpmin = array(7, 1);
143 global $conf, $extrafields;
145 $logotouse = $conf->user->dir_output.
'/'.
get_exdir($user->id, 2, 0, 1, $user,
'user').
'/'.$user->photo;
148 'myuser_lastname'=>$user->lastname,
149 'myuser_firstname'=>$user->firstname,
150 'myuser_fullname'=>$user->getFullName($outputlangs, 1),
151 'myuser_login'=>$user->login,
152 'myuser_phone'=>$user->office_phone,
153 'myuser_address'=>$user->address,
154 'myuser_zip'=>$user->zip,
155 'myuser_town'=>$user->town,
156 'myuser_country'=>$user->country,
157 'myuser_country_code'=>$user->country_code,
158 'myuser_state'=>$user->state,
159 'myuser_state_code'=>$user->state_code,
160 'myuser_fax'=>$user->office_fax,
161 'myuser_mobile'=>$user->user_mobile,
162 'myuser_email'=>$user->email,
163 'myuser_logo'=>$logotouse,
164 'myuser_job'=>$user->job,
167 'myuser_dateemployment'=>
dol_print_date($user->dateemployment,
'day',
'tzuser'),
168 'myuser_dateemploymentend'=>
dol_print_date($user->dateemploymentend,
'day',
'tzuser'),
169 'myuser_gender'=>$user->gender,
172 if (is_array($user->array_options) && count($user->array_options)) {
188 global $conf, $extrafields;
190 if ($member->photo) {
191 $logotouse = $conf->adherent->dir_output.
'/'.
get_exdir(0, 0, 0, 1, $member,
'user').
'/photos/'.$member->photo;
193 $logotouse = DOL_DOCUMENT_ROOT.
'/public/theme/common/nophoto.png';
196 $array_member = array(
197 'mymember_lastname' => $member->lastname,
198 'mymember_firstname' => $member->firstname,
199 'mymember_fullname' => $member->getFullName($outputlangs, 1),
200 'mymember_login' => $member->login,
201 'mymember_address' => $member->address,
202 'mymember_zip' => $member->zip,
203 'mymember_town' => $member->town,
204 'mymember_country_code' => $member->country_code,
205 'mymember_country' => $member->country,
206 'mymember_state_code' => $member->state_code,
207 'mymember_state' => $member->state,
208 'mymember_phone_perso' => $member->phone_perso,
209 'mymember_phone_pro' => $member->phone,
210 'mymember_phone_mobile' => $member->phone_mobile,
211 'mymember_email' => $member->email,
212 'mymember_logo' => $logotouse,
213 'mymember_gender' => $member->gender,
214 'mymember_birth_locale' =>
dol_print_date($member->birth,
'day',
'tzuser', $outputlangs),
215 'mymember_birth' =>
dol_print_date($member->birth,
'day',
'tzuser'),
218 if (is_array($member->array_options) && count($member->array_options)) {
221 return $array_member;
238 if (empty($mysoc->forme_juridique) && !empty($mysoc->forme_juridique_code)) {
241 if (empty($mysoc->country) && !empty($mysoc->country_code)) {
242 $mysoc->country = $outputlangs->transnoentitiesnoconv(
"Country".$mysoc->country_code);
244 if (empty($mysoc->state) && !empty($mysoc->state_code)) {
245 $mysoc->state =
getState($mysoc->state_code, 0);
248 $logotouse = $conf->mycompany->dir_output.
'/logos/thumbs/'.$mysoc->logo_small;
251 'mycompany_logo'=>$logotouse,
252 'mycompany_name'=>$mysoc->name,
253 'mycompany_email'=>$mysoc->email,
254 'mycompany_phone'=>$mysoc->phone,
255 'mycompany_fax'=>$mysoc->fax,
256 'mycompany_address'=>$mysoc->address,
257 'mycompany_zip'=>$mysoc->zip,
258 'mycompany_town'=>$mysoc->town,
259 'mycompany_country'=>$mysoc->country,
260 'mycompany_country_code'=>$mysoc->country_code,
261 'mycompany_state'=>$mysoc->state,
262 'mycompany_state_code'=>$mysoc->state_code,
263 'mycompany_web'=>$mysoc->url,
264 'mycompany_juridicalstatus'=>$mysoc->forme_juridique,
265 'mycompany_managers'=>$mysoc->managers,
266 'mycompany_capital'=>$mysoc->capital,
267 'mycompany_barcode'=>$mysoc->barcode,
268 'mycompany_idprof1'=>$mysoc->idprof1,
269 'mycompany_idprof2'=>$mysoc->idprof2,
270 'mycompany_idprof3'=>$mysoc->idprof3,
271 'mycompany_idprof4'=>$mysoc->idprof4,
272 'mycompany_idprof5'=>$mysoc->idprof5,
273 'mycompany_idprof6'=>$mysoc->idprof6,
274 'mycompany_vatnumber'=>$mysoc->tva_intra,
275 'mycompany_socialobject'=>$mysoc->socialobject,
276 'mycompany_note_private'=>$mysoc->note_private,
295 global $conf, $extrafields;
297 if (empty($object->country) && !empty($object->country_code)) {
298 $object->country = $outputlangs->transnoentitiesnoconv(
"Country".$object->country_code);
300 if (empty($object->state) && !empty($object->state_code)) {
301 $object->state =
getState($object->state_code, 0);
304 $array_thirdparty = array(
305 'company_name'=>$object->name,
306 'company_name_alias' => $object->name_alias,
307 'company_email'=>$object->email,
308 'company_phone'=>$object->phone,
309 'company_fax'=>$object->fax,
310 'company_address'=>$object->address,
311 'company_zip'=>$object->zip,
312 'company_town'=>$object->town,
313 'company_country'=>$object->country,
314 'company_country_code'=>$object->country_code,
315 'company_state'=>$object->state,
316 'company_state_code'=>$object->state_code,
317 'company_web'=>$object->url,
318 'company_barcode'=>$object->barcode,
319 'company_vatnumber'=>$object->tva_intra,
320 'company_customercode'=>$object->code_client,
321 'company_suppliercode'=>$object->code_fournisseur,
322 'company_customeraccountancycode'=>$object->code_compta,
323 'company_supplieraccountancycode'=>$object->code_compta_fournisseur,
324 'company_juridicalstatus'=>$object->forme_juridique,
325 'company_outstanding_limit'=>$object->outstanding_limit,
326 'company_capital'=>$object->capital,
327 'company_idprof1'=>$object->idprof1,
328 'company_idprof2'=>$object->idprof2,
329 'company_idprof3'=>$object->idprof3,
330 'company_idprof4'=>$object->idprof4,
331 'company_idprof5'=>$object->idprof5,
332 'company_idprof6'=>$object->idprof6,
333 'company_note_public'=>$object->note_public,
334 'company_note_private'=>$object->note_private,
335 'company_default_bank_iban'=>(is_object($object->bank_account) ? $object->bank_account->iban :
''),
336 'company_default_bank_bic'=>(is_object($object->bank_account) ? $object->bank_account->bic :
'')
340 if (is_array($object->array_options) && count($object->array_options)) {
341 $object->fetch_optionals();
345 return $array_thirdparty;
360 global $conf, $extrafields;
362 if (empty($object->country) && !empty($object->country_code)) {
363 $object->country = $outputlangs->transnoentitiesnoconv(
"Country".$object->country_code);
365 if (empty($object->state) && !empty($object->state_code)) {
366 $object->state =
getState($object->state_code, 0);
369 $array_contact = array(
370 $array_key.
'_fullname' => $object->getFullName($outputlangs, 1),
371 $array_key.
'_lastname' => $object->lastname,
372 $array_key.
'_firstname' => $object->firstname,
373 $array_key.
'_address' => $object->address,
374 $array_key.
'_zip' => $object->zip,
375 $array_key.
'_town' => $object->town,
376 $array_key.
'_state_id' => $object->state_id,
377 $array_key.
'_state_code' => $object->state_code,
378 $array_key.
'_state' => $object->state,
379 $array_key.
'_country_id' => $object->country_id,
380 $array_key.
'_country_code' => $object->country_code,
381 $array_key.
'_country' => $object->country,
382 $array_key.
'_poste' => $object->poste,
383 $array_key.
'_socid' => $object->socid,
384 $array_key.
'_statut' => $object->statut,
385 $array_key.
'_code' => $object->code,
386 $array_key.
'_email' => $object->email,
387 $array_key.
'_phone_pro' => $object->phone_pro,
388 $array_key.
'_phone_perso' => $object->phone_perso,
389 $array_key.
'_phone_mobile' => $object->phone_mobile,
390 $array_key.
'_fax' => $object->fax,
391 $array_key.
'_birthday' => $object->birthday,
392 $array_key.
'_default_lang' => $object->default_lang,
393 $array_key.
'_note_public' => $object->note_public,
394 $array_key.
'_note_private' => $object->note_private,
395 $array_key.
'_civility' => $object->civility,
399 if (is_array($object->array_options) && count($object->array_options)) {
400 $object->fetch_optionals();
404 return $array_contact;
421 $array_other = array(
426 'current_server_datehour'=>
dol_print_date($now,
'dayhour',
'tzserver'),
428 'current_date_locale'=>
dol_print_date($now,
'day',
'tzuser', $outputlangs),
429 'current_datehour_locale'=>
dol_print_date($now,
'dayhour',
'tzuser', $outputlangs),
430 'current_server_date_locale'=>
dol_print_date($now,
'day',
'tzserver', $outputlangs),
431 'current_server_datehour_locale'=>
dol_print_date($now,
'dayhour',
'tzserver', $outputlangs),
435 foreach ($conf->global as $key => $val) {
437 $newval =
'*****forbidden*****';
441 $array_other[
'__['.$key.
']__'] = $newval;
461 global $conf, $extrafields;
463 $sumpayed = $sumdeposit = $sumcreditnote =
'';
464 $already_payed_all = 0;
466 if ($object->element ==
'facture') {
467 $invoice_source =
new Facture($this->db);
468 if ($object->fk_facture_source > 0) {
469 $invoice_source->fetch($object->fk_facture_source);
471 $sumpayed = $object->getSommePaiement();
472 $sumdeposit = $object->getSumDepositsUsed();
473 $sumcreditnote = $object->getSumCreditNotesUsed();
474 $already_payed_all = $sumpayed + $sumdeposit + $sumcreditnote;
476 if ($object->fk_account > 0) {
477 require_once DOL_DOCUMENT_ROOT.
'/compta/bank/class/account.class.php';
478 $bank_account =
new Account($this->db);
479 $bank_account->fetch($object->fk_account);
483 $date = (isset($object->element) && $object->element ==
'contrat' && isset($object->date_contrat)) ? $object->date_contrat : (isset($object->date) ? $object->date :
null);
485 if (get_class($object) ==
'CommandeFournisseur') {
487 $object->date_validation = $object->date_valid;
488 $object->date_commande = $object->date;
491 $array_key.
'_id'=>$object->id,
492 $array_key.
'_ref' => (property_exists($object,
'ref') ? $object->ref :
''),
493 $array_key.
'_label' => (property_exists($object,
'label') ? $object->label :
''),
494 $array_key.
'_ref_ext' => (property_exists($object,
'ref_ext') ? $object->ref_ext :
''),
495 $array_key.
'_ref_customer'=>(!empty($object->ref_client) ? $object->ref_client : (empty($object->ref_customer) ?
'' : $object->ref_customer)),
496 $array_key.
'_ref_supplier'=>(!empty($object->ref_fournisseur) ? $object->ref_fournisseur : (empty($object->ref_supplier) ?
'' : $object->ref_supplier)),
497 $array_key.
'_source_invoice_ref'=>((empty($invoice_source) || empty($invoice_source->ref)) ?
'' : $invoice_source->ref),
502 $array_key.
'_date_limit'=>(!empty($object->date_lim_reglement) ?
dol_print_date($object->date_lim_reglement,
'day') :
''),
503 $array_key.
'_date_limit_rfc'=>(!empty($object->date_lim_reglement) ?
dol_print_date($object->date_lim_reglement,
'dayrfc') :
''),
504 $array_key.
'_date_end'=>(!empty($object->fin_validite) ?
dol_print_date($object->fin_validite,
'day') :
''),
505 $array_key.
'_date_creation'=>
dol_print_date($object->date_creation,
'day'),
506 $array_key.
'_date_modification'=>(!empty($object->date_modification) ?
dol_print_date($object->date_modification,
'day') :
''),
507 $array_key.
'_date_validation'=>(!empty($object->date_validation) ?
dol_print_date($object->date_validation,
'dayhour') :
''),
508 $array_key.
'_date_approve'=>(!empty($object->date_approve) ?
dol_print_date($object->date_approve,
'day') :
''),
509 $array_key.
'_date_delivery_planed'=>(!empty($object->delivery_date) ?
dol_print_date($object->delivery_date,
'day') :
''),
510 $array_key.
'_date_close'=>(!empty($object->date_cloture) ?
dol_print_date($object->date_cloture,
'dayhour') :
''),
512 $array_key.
'_payment_mode_code'=>$object->mode_reglement_code,
513 $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),
514 $array_key.
'_payment_term_code'=>$object->cond_reglement_code,
515 $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)),
517 $array_key.
'_incoterms' => (method_exists($object,
'display_incoterms') ? $object->display_incoterms() :
''),
519 $array_key.
'_bank_iban' => (!empty($bank_account) ? $bank_account->iban :
''),
520 $array_key.
'_bank_bic' => (!empty($bank_account) ? $bank_account->bic :
''),
521 $array_key.
'_bank_label' => (!empty($bank_account) ? $bank_account->label :
''),
522 $array_key.
'_bank_number' => (!empty($bank_account) ? $bank_account->number :
''),
523 $array_key.
'_bank_proprio' => (!empty($bank_account) ? $bank_account->proprio :
''),
525 $array_key.
'_total_ht_locale'=>
price($object->total_ht, 0, $outputlangs),
526 $array_key.
'_total_vat_locale'=>(!empty($object->total_vat) ?
price($object->total_vat, 0, $outputlangs) :
price($object->total_tva, 0, $outputlangs)),
527 $array_key.
'_total_localtax1_locale'=>
price($object->total_localtax1, 0, $outputlangs),
528 $array_key.
'_total_localtax2_locale'=>
price($object->total_localtax2, 0, $outputlangs),
529 $array_key.
'_total_ttc_locale'=>
price($object->total_ttc, 0, $outputlangs),
531 $array_key.
'_total_ht'=>
price2num($object->total_ht),
532 $array_key.
'_total_vat'=>(!empty($object->total_vat) ?
price2num($object->total_vat) :
price2num($object->total_tva)),
533 $array_key.
'_total_localtax1'=>
price2num($object->total_localtax1),
534 $array_key.
'_total_localtax2'=>
price2num($object->total_localtax2),
535 $array_key.
'_total_ttc'=>
price2num($object->total_ttc),
537 $array_key.
'_multicurrency_code' => $object->multicurrency_code,
538 $array_key.
'_multicurrency_tx' =>
price2num($object->multicurrency_tx),
539 $array_key.
'_multicurrency_total_ht' =>
price2num($object->multicurrency_total_ht),
540 $array_key.
'_multicurrency_total_tva' =>
price2num($object->multicurrency_total_tva),
541 $array_key.
'_multicurrency_total_ttc' =>
price2num($object->multicurrency_total_ttc),
542 $array_key.
'_multicurrency_total_ht_locale' =>
price($object->multicurrency_total_ht, 0, $outputlangs),
543 $array_key.
'_multicurrency_total_tva_locale' =>
price($object->multicurrency_total_tva, 0, $outputlangs),
544 $array_key.
'_multicurrency_total_ttc_locale' =>
price($object->multicurrency_total_ttc, 0, $outputlangs),
546 $array_key.
'_note_private'=>$object->note,
547 $array_key.
'_note_public'=>$object->note_public,
548 $array_key.
'_note'=>$object->note_public,
551 $array_key.
'_already_payed_locale'=>
price($sumpayed, 0, $outputlangs),
552 $array_key.
'_already_payed'=>
price2num($sumpayed),
553 $array_key.
'_already_deposit_locale'=>
price($sumdeposit, 0, $outputlangs),
554 $array_key.
'_already_deposit'=>
price2num($sumdeposit),
555 $array_key.
'_already_creditnote_locale'=>
price($sumcreditnote, 0, $outputlangs),
556 $array_key.
'_already_creditnote'=>
price2num($sumcreditnote),
558 $array_key.
'_already_payed_all_locale'=>
price(
price2num($already_payed_all,
'MT'), 0, $outputlangs),
559 $array_key.
'_already_payed_all'=>
price2num($already_payed_all,
'MT'),
562 $array_key.
'_remain_to_pay_locale'=>
price(
price2num($object->total_ttc - $already_payed_all,
'MT'), 0, $outputlangs),
563 $array_key.
'_remain_to_pay'=>
price2num($object->total_ttc - $already_payed_all,
'MT')
566 if (method_exists($object,
'getTotalDiscount') && in_array(get_class($object), array(
'Propal',
'Proposal',
'Commande',
'Facture',
'SupplierProposal',
'CommandeFournisseur',
'FactureFournisseur'))) {
567 $resarray[$array_key.
'_total_discount_ht_locale'] =
price($object->getTotalDiscount(), 0, $outputlangs);
568 $resarray[$array_key.
'_total_discount_ht'] =
price2num($object->getTotalDiscount());
570 $resarray[$array_key.
'_total_discount_ht_locale'] =
'';
571 $resarray[$array_key.
'_total_discount_ht'] =
'';
575 if ($object->element !=
"project" && !empty($object->fk_project) && $object->fk_project > 0) {
576 if (!is_object($object->project)) {
577 $object->fetch_projet();
580 $resarray[$array_key.
'_project_ref'] = $object->project->ref;
581 $resarray[$array_key.
'_project_title'] = $object->project->title;
582 $resarray[$array_key.
'_project_description'] = $object->project->description;
583 $resarray[$array_key.
'_project_date_start'] =
dol_print_date($object->project->date_start,
'day');
584 $resarray[$array_key.
'_project_date_end'] =
dol_print_date($object->project->date_end,
'day');
586 $resarray[$array_key.
'_project_ref'] =
'';
587 $resarray[$array_key.
'_project_title'] =
'';
588 $resarray[$array_key.
'_project_description'] =
'';
589 $resarray[$array_key.
'_project_date_start'] =
'';
590 $resarray[$array_key.
'_project_date_end'] =
'';
594 if (is_array($object->lines) && count($object->lines) > 0) {
597 foreach ($object->lines as $line) {
599 if (empty($resarray[$array_key.
'_total_vat_'.$line->tva_tx])) {
600 $resarray[$array_key.
'_total_vat_'.$line->tva_tx] = 0;
602 $resarray[$array_key.
'_total_vat_'.$line->tva_tx] += $line->total_tva;
603 $resarray[$array_key.
'_total_vat_locale_'.$line->tva_tx] =
price($resarray[$array_key.
'_total_vat_'.$line->tva_tx]);
605 $vatformated =
vatrate($line->tva_tx);
606 if (empty($resarray[$array_key.
'_total_vat_'.$vatformated])) {
607 $resarray[$array_key.
'_total_vat_'.$vatformated] = 0;
609 $resarray[$array_key.
'_total_vat_'.$vatformated] += $line->total_tva;
610 $resarray[$array_key.
'_total_vat_locale_'.$vatformated] =
price($resarray[$array_key.
'_total_vat_'.$vatformated]);
612 $totalUp += $line->subprice * $line->qty;
617 $resarray[
'object_total_up'] = $totalUp;
618 $resarray[
'object_total_up_locale'] =
price($resarray[
'object_total_up'], 0, $outputlangs);
619 if (method_exists($object,
'getTotalDiscount') && in_array(get_class($object), array(
'Propal',
'Proposal',
'Commande',
'Facture',
'SupplierProposal',
'CommandeFournisseur',
'FactureFournisseur'))) {
620 $totalDiscount = $object->getTotalDiscount();
624 if (!empty($totalUp) && !empty($totalDiscount)) {
625 $resarray[
'object_total_discount'] = round(100 / $totalUp * $totalDiscount, 2);
626 $resarray[
'object_total_discount_locale'] =
price($resarray[
'object_total_discount'], 0, $outputlangs);
628 $resarray[
'object_total_discount'] =
'';
629 $resarray[
'object_total_discount_locale'] =
'';
634 if (is_array($object->array_options) && count($object->array_options)) {
635 $object->fetch_optionals();
657 'line_pos' => $linenumber,
660 'line_product_ref'=>(empty($line->product_ref) ?
'' : $line->product_ref),
661 'line_product_ref_fourn'=>(empty($line->ref_fourn) ?
'' : $line->ref_fourn),
662 'line_product_label'=>(empty($line->product_label) ?
'' : $line->product_label),
663 'line_product_type'=>(empty($line->product_type) ?
'' : $line->product_type),
664 'line_product_barcode'=>(empty($line->product_barcode) ?
'' : $line->product_barcode),
665 'line_product_desc'=>(empty($line->product_desc) ?
'' : $line->product_desc),
667 'line_desc'=>$line->desc,
668 'line_vatrate'=>
vatrate($line->tva_tx,
true, $line->info_bits),
669 'line_localtax1_rate'=>
vatrate($line->localtax1_tx),
670 'line_localtax2_rate'=>
vatrate($line->localtax1_tx),
672 'line_up_locale'=>
price($line->subprice, 0, $outputlangs),
673 'line_total_up'=>
price2num($line->subprice * $line->qty),
674 'line_total_up_locale'=>
price($line->subprice * $line->qty, 0, $outputlangs),
675 'line_qty'=>$line->qty,
676 'line_discount_percent'=>($line->remise_percent ? $line->remise_percent.
'%' :
''),
677 'line_price_ht'=>
price2num($line->total_ht),
678 'line_price_ttc'=>
price2num($line->total_ttc),
679 'line_price_vat'=>
price2num($line->total_tva),
680 'line_price_ht_locale'=>
price($line->total_ht, 0, $outputlangs),
681 'line_price_ttc_locale'=>
price($line->total_ttc, 0, $outputlangs),
682 'line_price_vat_locale'=>
price($line->total_tva, 0, $outputlangs),
685 'line_date_start_locale'=>
dol_print_date($line->date_start,
'day',
'tzserver', $outputlangs),
686 'line_date_start_rfc'=>
dol_print_date($line->date_start,
'dayrfc'),
688 'line_date_end_locale'=>
dol_print_date($line->date_end,
'day',
'tzserver', $outputlangs),
691 'line_multicurrency_code' =>
price2num($line->multicurrency_code),
692 'line_multicurrency_subprice' =>
price2num($line->multicurrency_subprice),
693 'line_multicurrency_total_ht' =>
price2num($line->multicurrency_total_ht),
694 'line_multicurrency_total_tva' =>
price2num($line->multicurrency_total_tva),
695 'line_multicurrency_total_ttc' =>
price2num($line->multicurrency_total_ttc),
696 'line_multicurrency_subprice_locale' =>
price($line->multicurrency_subprice, 0, $outputlangs),
697 'line_multicurrency_total_ht_locale' =>
price($line->multicurrency_total_ht, 0, $outputlangs),
698 'line_multicurrency_total_tva_locale' =>
price($line->multicurrency_total_tva, 0, $outputlangs),
699 'line_multicurrency_total_ttc_locale' =>
price($line->multicurrency_total_ttc, 0, $outputlangs),
704 $resarray[
'line_unit'] = $outputlangs->trans($line->getLabelOfUnit(
'long'));
705 $resarray[
'line_unit_short'] = $outputlangs->trans($line->getLabelOfUnit(
'short'));
709 $extrafieldkey = $line->table_element;
711 require_once DOL_DOCUMENT_ROOT.
'/core/class/extrafields.class.php';
713 $extrafields->fetch_name_optionals_label($extrafieldkey,
true);
714 $line->fetch_optionals();
719 if (get_class($line) ==
'CommandeFournisseurLigne') {
721 $extrafields->fetch_name_optionals_label(
"product_fournisseur_price");
722 $extralabels = $extrafields->attributes[
"product_fournisseur_price"][
'label'];
724 if (!empty($extralabels) && is_array($extralabels)) {
727 foreach ($extralabels as $key => $label) {
728 $columns .=
"$key, ";
731 if ($columns !=
"") {
732 $columns = substr($columns, 0, strlen($columns) - 2);
733 $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).
"'");
735 if ($this->db->num_rows($resql) > 0) {
736 $resql = $this->db->fetch_object($resql);
738 foreach ($extralabels as $key => $label) {
739 $resarray[
'line_product_supplier_'.$key] = $resql->$key;
747 if (isset($line->fk_product) && $line->fk_product > 0) {
748 $tmpproduct =
new Product($this->db);
749 $result = $tmpproduct->fetch($line->fk_product);
750 foreach ($tmpproduct->array_options as $key => $label) {
751 $resarray[
"line_product_".$key] = $label;
755 $extrafields->fetch_name_optionals_label(
"product");
756 $extralabels = $extrafields->attributes[
"product"][
'label'];
758 foreach ($extralabels as $key => $label) {
759 $resarray[
'line_product_options_'.$key] =
'';
779 global $conf, $extrafields;
781 $object->list_delivery_methods($object->shipping_method_id);
782 $calculatedVolume = ($object->trueWidth * $object->trueHeight * $object->trueDepth);
784 $array_shipment = array(
785 $array_key.
'_id'=>$object->id,
786 $array_key.
'_ref'=>$object->ref,
787 $array_key.
'_ref_ext'=>$object->ref_ext,
788 $array_key.
'_ref_customer'=>$object->ref_customer,
789 $array_key.
'_date_delivery'=>
dol_print_date($object->date_delivery,
'day'),
790 $array_key.
'_hour_delivery'=>
dol_print_date($object->date_delivery,
'hour'),
791 $array_key.
'_date_creation'=>
dol_print_date($object->date_creation,
'day'),
792 $array_key.
'_total_ht'=>
price($object->total_ht),
793 $array_key.
'_total_vat'=>
price($object->total_tva),
794 $array_key.
'_total_ttc'=>
price($object->total_ttc),
795 $array_key.
'_total_discount_ht' =>
price($object->getTotalDiscount()),
796 $array_key.
'_note_private'=>$object->note_private,
797 $array_key.
'_note'=>$object->note_public,
798 $array_key.
'_tracking_number'=>$object->tracking_number,
799 $array_key.
'_tracking_url'=>$object->tracking_url,
800 $array_key.
'_shipping_method'=>$object->listmeths[0][
'libelle'],
801 $array_key.
'_weight'=>$object->trueWeight.
' '.
measuringUnitString(0,
'weight', $object->weight_units),
802 $array_key.
'_width'=>$object->trueWidth.
' '.
measuringUnitString(0,
'size', $object->width_units),
803 $array_key.
'_height'=>$object->trueHeight.
' '.
measuringUnitString(0,
'size', $object->height_units),
804 $array_key.
'_depth'=>$object->trueDepth.
' '.
measuringUnitString(0,
'size', $object->depth_units),
809 foreach ($object->lines as $line) {
810 if (empty($array_shipment[$array_key.
'_total_vat_'.$line->tva_tx])) {
811 $array_shipment[$array_key.
'_total_vat_'.$line->tva_tx] = 0;
813 $array_shipment[$array_key.
'_total_vat_'.$line->tva_tx] += $line->total_tva;
817 if (is_array($object->array_options) && count($object->array_options)) {
818 $object->fetch_optionals();
824 if (!empty($object->commande) && is_object($object->commande)) {
825 $array_shipment[
'order_ref'] = $object->commande->ref;
826 $array_shipment[
'order_ref_customer'] = $object->commande->ref_customer;
829 return $array_shipment;
849 'line_product_ref'=>$line->product_ref,
850 'line_product_label'=>$line->product_label,
851 'line_desc'=>$line->desc,
852 'line_vatrate'=>
vatrate($line->tva_tx,
true, $line->info_bits),
853 'line_up'=>
price($line->subprice),
854 'line_total_up'=>
price($line->subprice * $line->qty),
855 'line_qty'=>$line->qty,
856 'line_qty_shipped'=>$line->qty_shipped,
857 'line_qty_asked'=>$line->qty_asked,
858 'line_discount_percent'=>($line->remise_percent ? $line->remise_percent.
'%' :
''),
859 'line_price_ht'=>
price($line->total_ht),
860 'line_price_ttc'=>
price($line->total_ttc),
861 'line_price_vat'=>
price($line->total_tva),
862 'line_weight'=>empty($line->weight) ?
'' : $line->weight * $line->qty_shipped.
' '.
measuringUnitString(0,
'weight', $line->weight_units),
863 'line_length'=>empty($line->length) ?
'' : $line->length * $line->qty_shipped.
' '.
measuringUnitString(0,
'size', $line->length_units),
864 'line_surface'=>empty($line->surface) ?
'' : $line->surface * $line->qty_shipped.
' '.
measuringUnitString(0,
'surface', $line->surface_units),
865 'line_volume'=>empty($line->volume) ?
'' : $line->volume * $line->qty_shipped.
' '.
measuringUnitString(0,
'volume', $line->volume_units),
869 $extrafieldkey = $line->element;
871 require_once DOL_DOCUMENT_ROOT.
'/core/class/extrafields.class.php';
873 $extrafields->fetch_name_optionals_label($extrafieldkey,
true);
874 $line->fetch_optionals();
879 if (isset($line->fk_product) && $line->fk_product > 0) {
880 $tmpproduct =
new Product($this->db);
881 $tmpproduct->fetch($line->fk_product);
882 foreach ($tmpproduct->array_options as $key=>$label)
883 $resarray[
"line_product_".$key] = $label;
902 $array_other = array();
903 if (!empty($object)) {
904 foreach ($object as $key => $value) {
905 if (in_array($key, array(
'db',
'fields',
'lines',
'modelpdf',
'model_pdf'))) {
908 if (!empty($value)) {
909 if (!is_array($value) && !is_object($value)) {
910 $array_other[
'object_'.$key] = $value;
911 } elseif (is_array($value) && $recursive) {
913 foreach ($tmparray as $key2 => $value2) {
914 $array_other[
'object_'.$key.
'_'.preg_replace(
'/^object_/',
'', $key2)] = $value2;
916 } elseif (is_object($value) && $recursive) {
918 foreach ($tmparray as $key2 => $value2) {
919 $array_other[
'object_'.$key.
'_'.preg_replace(
'/^object_/',
'', $key2)] = $value2;
949 if (is_array($extrafields->attributes[$object->table_element][
'label'])) {
950 foreach ($extrafields->attributes[$object->table_element][
'label'] as $key => $label) {
951 $formatedarrayoption = $object->array_options;
953 if ($extrafields->attributes[$object->table_element][
'type'][$key] ==
'price') {
954 $formatedarrayoption[
'options_'.$key] =
price2num($formatedarrayoption[
'options_'.$key]);
955 $formatedarrayoption[
'options_'.$key.
'_currency'] =
price($formatedarrayoption[
'options_'.$key], 0, $outputlangs, 0, 0, -1, $conf->currency);
957 $array_to_fill = array_merge($array_to_fill, array($array_key.
'_options_'.$key.
'_currency' => $formatedarrayoption[
'options_'.$key.
'_currency']));
958 } elseif ($extrafields->attributes[$object->table_element][
'type'][$key] ==
'select') {
959 $valueofselectkey = $formatedarrayoption[
'options_'.$key];
960 if (array_key_exists($valueofselectkey, $extrafields->attributes[$object->table_element][
'param'][$key][
'options'])) {
961 $formatedarrayoption[
'options_'.$key] = $extrafields->attributes[$object->table_element][
'param'][$key][
'options'][$valueofselectkey];
963 $formatedarrayoption[
'options_'.$key] =
'';
965 } elseif ($extrafields->attributes[$object->table_element][
'type'][$key] ==
'checkbox') {
966 $valArray = explode(
',', $formatedarrayoption[
'options_'.$key]);
968 foreach ($extrafields->attributes[$object->table_element][
'param'][$key][
'options'] as $keyopt => $valopt) {
969 if (in_array($keyopt, $valArray)) {
973 $formatedarrayoption[
'options_'.$key] = implode(
', ', $output);
974 } elseif ($extrafields->attributes[$object->table_element][
'type'][$key] ==
'date') {
975 if (strlen($formatedarrayoption[
'options_'.$key]) > 0) {
976 $date = $formatedarrayoption[
'options_'.$key];
977 $formatedarrayoption[
'options_'.$key] =
dol_print_date($date,
'day');
978 $formatedarrayoption[
'options_'.$key.
'_locale'] =
dol_print_date($date,
'day',
'tzserver', $outputlangs);
979 $formatedarrayoption[
'options_'.$key.
'_rfc'] =
dol_print_date($date,
'dayrfc');
981 $formatedarrayoption[
'options_'.$key] =
'';
982 $formatedarrayoption[
'options_'.$key.
'_locale'] =
'';
983 $formatedarrayoption[
'options_'.$key.
'_rfc'] =
'';
985 $array_to_fill = array_merge($array_to_fill, array($array_key.
'_options_'.$key.
'_locale' => $formatedarrayoption[
'options_'.$key.
'_locale']));
986 $array_to_fill = array_merge($array_to_fill, array($array_key.
'_options_'.$key.
'_rfc' => $formatedarrayoption[
'options_'.$key.
'_rfc']));
987 } elseif ($extrafields->attributes[$object->table_element][
'type'][$key] ==
'datetime') {
988 $datetime = $formatedarrayoption[
'options_'.$key];
989 $formatedarrayoption[
'options_'.$key] = ($datetime !=
"0000-00-00 00:00:00" ?
dol_print_date($datetime,
'dayhour') :
'');
990 $formatedarrayoption[
'options_'.$key.
'_locale'] = ($datetime !=
"0000-00-00 00:00:00" ?
dol_print_date($datetime,
'dayhour',
'tzserver', $outputlangs) :
'');
991 $formatedarrayoption[
'options_'.$key.
'_rfc'] = ($datetime !=
"0000-00-00 00:00:00" ?
dol_print_date($datetime,
'dayhourrfc') :
'');
992 $array_to_fill = array_merge($array_to_fill, array($array_key.
'_options_'.$key.
'_locale' => $formatedarrayoption[
'options_'.$key.
'_locale']));
993 $array_to_fill = array_merge($array_to_fill, array($array_key.
'_options_'.$key.
'_rfc' => $formatedarrayoption[
'options_'.$key.
'_rfc']));
994 } elseif ($extrafields->attributes[$object->table_element][
'type'][$key] ==
'link') {
995 $id = $formatedarrayoption[
'options_'.$key];
997 $param = $extrafields->attributes[$object->table_element][
'param'][$key];
998 $param_list = array_keys($param[
'options']);
999 $InfoFieldList = explode(
":", $param_list[0]);
1000 $classname = $InfoFieldList[0];
1001 $classpath = $InfoFieldList[1];
1002 if (!empty($classpath)) {
1004 if ($classname && class_exists($classname)) {
1005 $tmpobject =
new $classname($this->db);
1006 $tmpobject->fetch($id);
1008 $formatedarrayoption[
'options_'.$key] = $tmpobject->name;
1014 if (array_key_exists(
'options_'.$key, $formatedarrayoption)) {
1015 $array_to_fill = array_merge($array_to_fill, array($array_key.
'_options_'.$key => $formatedarrayoption[
'options_'.$key]));
1017 $array_to_fill = array_merge($array_to_fill, array($array_key.
'_options_'.$key =>
''));
1022 return $array_to_fill;
1038 public function printRect($pdf, $x, $y, $l, $h, $hidetop = 0, $hidebottom = 0)
1040 if (empty($hidetop) || $hidetop == -1) {
1041 $pdf->line($x, $y, $x + $l, $y);
1043 $pdf->line($x + $l, $y, $x + $l, $y + $h);
1044 if (empty($hidebottom)) {
1045 $pdf->line($x + $l, $y + $h, $x, $y + $h);
1047 $pdf->line($x, $y + $h, $x, $y);
1060 if (empty($a[
'rank'])) {
1063 if (empty($b[
'rank'])) {
1066 if ($a[
'rank'] == $b[
'rank']) {
1069 return ($a[
'rank'] > $b[
'rank']) ? -1 : 1;
1084 $this->defineColumnField($object, $outputlangs, $hidedetails, $hidedesc, $hideref);
1088 uasort($this->cols, array($this,
'columnSort'));
1091 $curX = $this->page_largeur - $this->marge_droite;
1094 $arrayWidth = $this->page_largeur - $this->marge_droite - $this->marge_gauche;
1097 $totalDefinedColWidth = 0;
1099 foreach ($this->cols as $colKey => & $colDef) {
1104 if (!empty($colDef[
'scale'])) {
1106 $colDef[
'width'] = abs($arrayWidth * $colDef[
'scale'] / 100);
1109 if (empty($colDef[
'width'])) {
1112 $totalDefinedColWidth += $colDef[
'width'];
1116 foreach ($this->cols as $colKey => & $colDef) {
1118 if (!empty($colDef[
'title'])) {
1119 $colDef[
'title'] = array_replace($this->defaultTitlesFieldsStyle, $colDef[
'title']);
1121 $colDef[
'title'] = $this->defaultTitlesFieldsStyle;
1125 if (!empty($colDef[
'content'])) {
1126 $colDef[
'content'] = array_replace($this->defaultContentsFieldsStyle, $colDef[
'content']);
1128 $colDef[
'content'] = $this->defaultContentsFieldsStyle;
1133 if (empty($colDef[
'width'])) {
1134 $colDef[
'width'] = abs(($arrayWidth - $totalDefinedColWidth)) / $countFlexCol;
1139 $curX = $lastX - $colDef[
'width'];
1140 $colDef[
'xStartPos'] = $curX;
1141 $colDef[
'xEndPos'] = $lastX;
1154 $colDef = $this->cols[$colKey];
1155 return $colDef[
'width'] - $colDef[
'content'][
'padding'][3] - $colDef[
'content'][
'padding'][1];
1167 $colDef = $this->cols[$colKey];
1168 return (isset($colDef[
'xStartPos']) ? $colDef[
'xStartPos'] : 0) + $colDef[
'content'][
'padding'][3];
1179 if (!isset($this->cols[$colKey][
'rank'])) {
1182 return $this->cols[$colKey][
'rank'];
1194 public function insertNewColumnDef($newColKey, $defArray, $targetCol =
false, $insertAfterTarget =
false)
1200 if (!empty($targetCol)) {
1202 if ($rank >= 0 && $insertAfterTarget) {
1208 if ($rank < 0 && !empty($defArray[
'rank'])) {
1209 $rank = $defArray[
'rank'];
1217 foreach ($this->cols as $colKey => & $colDef) {
1218 if ($rank <= $colDef[
'rank']) {
1219 $colDef[
'rank'] = $colDef[
'rank'] + 1;
1223 $defArray[
'rank'] = $rank;
1224 $this->cols[$newColKey] = $defArray;
1241 global $hookmanager;
1243 $parameters = array(
1245 'columnText' => $columnText,
1246 'colKey' => $colKey,
1249 $reshook = $hookmanager->executeHooks(
'printStdColumnContent', $parameters, $this);
1254 if (empty($columnText)) {
1258 $colDef = $this->cols[$colKey];
1260 $curentCellPaddinds = $pdf->getCellPaddings();
1262 $pdf->setCellPaddings(isset($colDef[
'content'][
'padding'][3]) ? $colDef[
'content'][
'padding'][3] : 0, isset($colDef[
'content'][
'padding'][0]) ? $colDef[
'content'][
'padding'][0] : 0, isset($colDef[
'content'][
'padding'][1]) ? $colDef[
'content'][
'padding'][1] : 0, isset($colDef[
'content'][
'padding'][2]) ? $colDef[
'content'][
'padding'][2] : 0);
1263 $pdf->writeHTMLCell($colDef[
'width'], 2, isset($colDef[
'xStartPos']) ? $colDef[
'xStartPos'] : 0, $curY, $columnText, 0, 1, 0,
true, $colDef[
'content'][
'align']);
1266 $pdf->setCellPaddings($curentCellPaddinds[
'L'], $curentCellPaddinds[
'T'], $curentCellPaddinds[
'R'], $curentCellPaddinds[
'B']);
1287 public function printColDescContent($pdf, &$curY, $colKey, $object, $i, $outputlangs, $hideref = 0, $hidedesc = 0, $issupplierline = 0)
1290 $colDef = $this->cols[$colKey];
1292 $curentCellPaddinds = $pdf->getCellPaddings();
1294 $pdf->setCellPaddings($colDef[
'content'][
'padding'][3], $colDef[
'content'][
'padding'][0], $colDef[
'content'][
'padding'][1], $colDef[
'content'][
'padding'][2]);
1297 pdf_writelinedesc($pdf, $object, $i, $outputlangs, $colDef[
'width'], 3, $colDef[
'xStartPos'], $curY, $hideref, $hidedesc, $issupplierline);
1298 $posYAfterDescription = $pdf->GetY() - $colDef[
'content'][
'padding'][0];
1301 $pdf->setCellPaddings($curentCellPaddinds[
'L'], $curentCellPaddinds[
'T'], $curentCellPaddinds[
'R'], $curentCellPaddinds[
'B']);
1305 'display' =>
'list',
1306 'printableEnable' => array(3),
1307 'printableEnableNotEmpty' => array(4)
1309 $extrafieldDesc = $this->getExtrafieldsInHtml($object->lines[$i], $outputlangs, $params);
1310 if (!empty($extrafieldDesc)) {
1326 global $hookmanager;
1328 if (empty($object->table_element)) {
1332 $extrafieldsKeyPrefix =
"options_";
1335 $pos = strpos($extrafieldKey, $extrafieldsKeyPrefix);
1337 $extrafieldKey = substr($extrafieldKey, strlen($extrafieldsKeyPrefix));
1340 $extrafieldOptionsKey = $extrafieldsKeyPrefix.$extrafieldKey;
1344 if (empty($this->extrafieldsCache)) {
1345 $this->extrafieldsCache =
new ExtraFields($this->db);
1347 if (empty($this->extrafieldsCache->attributes[$object->table_element])) {
1348 $this->extrafieldsCache->fetch_name_optionals_label($object->table_element);
1350 $extrafields = $this->extrafieldsCache;
1352 $extrafieldOutputContent =
'';
1353 if (isset($object->array_options[$extrafieldOptionsKey])) $extrafieldOutputContent = $extrafields->showOutputField($extrafieldKey, $object->array_options[$extrafieldOptionsKey],
'', $object->table_element);
1356 if ($extrafields->attributes[$object->table_element][
'type'][$extrafieldKey] ==
'link') {
1361 $parameters = array(
1362 'object' => $object,
1363 'extrafields' => $extrafields,
1364 'extrafieldKey' => $extrafieldKey,
1365 'extrafieldOutputContent' =>& $extrafieldOutputContent
1367 $reshook = $hookmanager->executeHooks(
'getPDFExtrafieldContent', $parameters, $this);
1372 $extrafieldOutputContent = $hookmanager->resPrint;
1375 return $extrafieldOutputContent;
1387 public function getExtrafieldsInHtml($object, $outputlangs, $params = array())
1389 global $hookmanager;
1391 if (empty($object->table_element)) {
1396 if (empty($this->extrafieldsCache)) {
1397 $this->extrafieldsCache =
new ExtraFields($this->db);
1399 if (empty($this->extrafieldsCache->attributes[$object->table_element])) {
1400 $this->extrafieldsCache->fetch_name_optionals_label($object->table_element);
1402 $extrafields = $this->extrafieldsCache;
1404 $defaultParams = array(
1406 'display' =>
'auto',
1407 'printableEnable' => array(1),
1408 'printableEnableNotEmpty' => array(2),
1411 'maxItemsInRow' => 2,
1415 'labelcolwidth' =>
'25%',
1416 'arrayOfLineBreakType' => array(
'text',
'html')
1420 'separator' =>
'<br>'
1429 $params = $params + $defaultParams;
1438 if (!empty($extrafields->attributes[$object->table_element][
'label']) && is_array($extrafields->attributes[$object->table_element][
'label'])) {
1439 foreach ($extrafields->attributes[$object->table_element][
'label'] as $key => $label) {
1442 $disableOnEmpty = 0;
1443 if (!empty($extrafields->attributes[$object->table_element][
'printable'][$key])) {
1444 $printable = intval($extrafields->attributes[$object->table_element][
'printable'][$key]);
1445 if (in_array($printable, $params[
'printableEnable']) || in_array($printable, $params[
'printableEnableNotEmpty'])) {
1449 if (in_array($printable, $params[
'printableEnableNotEmpty'])) {
1450 $disableOnEmpty = 1;
1454 if (empty($enabled)) {
1458 $field =
new stdClass();
1459 $field->rank = intval($extrafields->attributes[$object->table_element][
'pos'][$key]);
1461 $field->label = $outputlangs->transnoentities($label);
1462 $field->type = $extrafields->attributes[$object->table_element][
'type'][$key];
1465 if ($disableOnEmpty && empty($field->content)) {
1473 if (!empty($fields)) {
1475 uasort($fields,
function ($a, $b) {
1476 return ($a->rank > $b->rank) ? 1 : -1;
1480 $html .= !empty($params[
'style']) ?
'<style>'.$params[
'style'].
'</style>' :
'';
1483 if ($params[
'display'] ==
'auto') {
1484 $lastNnumbItems = 0;
1485 foreach ($params[
'auto'] as $display => $numbItems) {
1486 if ($lastNnumbItems <= $numbItems && count($fields) > $numbItems) {
1487 $lastNnumbItems = $numbItems;
1488 $params[
'display'] = $display;
1493 if ($params[
'display'] ==
'list') {
1496 foreach ($fields as $field) {
1497 $html .= !empty($i) ? $params[
'list'][
'separator'] :
'';
1498 $html .=
'<strong>'.$field->label.
' : </strong>';
1499 $html .= $field->content;
1502 } elseif ($params[
'display'] ==
'table') {
1504 $html .=
'<table class="extrafield-table" cellspacing="'.$params[
'table'][
'cellspacing'].
'" cellpadding="'.$params[
'table'][
'cellpadding'].
'" border="'.$params[
'table'][
'border'].
'">';
1508 $maxItemsInRow = $params[
'table'][
'maxItemsInRow'];
1509 foreach ($fields as $field) {
1511 if ($itemsInRow >= $maxItemsInRow) {
1513 $html .=
"</tr><tr>";
1518 if (in_array($field->type, $params[
'table'][
'arrayOfLineBreakType'])) {
1519 if ($itemsInRow > 0) {
1521 for ($i = $itemsInRow; $i <= $maxItemsInRow; $i++) {
1522 $html .=
"<td></td><td></td>";
1530 $itemsInRow = $maxItemsInRow;
1531 $html .=
'<td colspan="'.($maxItemsInRow * 2 - 1).
'">';
1532 $html .=
'<strong>'.$field->label.
' :</strong> ';
1533 $html .= $field->content;
1537 $html .=
'<td width="'.$params[
'table'][
'labelcolwidth'].
'" class="extrafield-label">';
1538 $html .=
'<strong>'.$field->label.
' :</strong>';
1542 $html .=
'<td class="extrafield-content">';
1543 $html .= $field->content;
1549 $html .=
'</table>';
1565 if (!empty($this->cols[$colKey][
'status'])) {
1582 public function pdfTabTitles(&$pdf, $tab_top, $tab_height, $outputlangs, $hidetop = 0)
1584 global $hookmanager, $conf;
1586 foreach ($this->cols as $colKey => $colDef) {
1587 $parameters = array(
1588 'colKey' => $colKey,
1590 'outputlangs' => $outputlangs,
1591 'tab_top' => $tab_top,
1592 'tab_height' => $tab_height,
1593 'hidetop' => $hidetop
1596 $reshook = $hookmanager->executeHooks(
'pdfTabTitles', $parameters, $this);
1599 } elseif (empty($reshook)) {
1605 $colDef[
'title'][
'label'] = !empty($colDef[
'title'][
'label']) ? $colDef[
'title'][
'label'] : $outputlangs->transnoentities($colDef[
'title'][
'textkey']);
1608 if (!empty($colDef[
'border-left']) && isset($colDef[
'xStartPos'])) {
1609 $pdf->line($colDef[
'xStartPos'], $tab_top, $colDef[
'xStartPos'], $tab_top + $tab_height);
1612 if (empty($hidetop)) {
1614 $curentCellPaddinds = $pdf->getCellPaddings();
1617 global $outputlangsbis;
1618 if (is_object($outputlangsbis)) {
1620 $pdf->setCellPaddings($colDef[
'title'][
'padding'][3], $colDef[
'title'][
'padding'][0], $colDef[
'title'][
'padding'][1], 0.5);
1623 $pdf->setCellPaddings($colDef[
'title'][
'padding'][3], $colDef[
'title'][
'padding'][0], $colDef[
'title'][
'padding'][1], $colDef[
'title'][
'padding'][2]);
1625 if (isset($colDef[
'title'][
'align'])) {
1626 $align = $colDef[
'title'][
'align'];
1630 $pdf->SetXY($colDef[
'xStartPos'], $tab_top);
1631 $textWidth = $colDef[
'width'];
1632 $pdf->MultiCell($textWidth, 2, $colDef[
'title'][
'label'],
'', $align);
1635 if (is_object($outputlangsbis) && trim($colDef[
'title'][
'label'])) {
1636 $pdf->setCellPaddings($colDef[
'title'][
'padding'][3], 0, $colDef[
'title'][
'padding'][1], $colDef[
'title'][
'padding'][2]);
1637 $pdf->SetXY($colDef[
'xStartPos'], $pdf->GetY());
1638 $textbis = $outputlangsbis->transnoentities($colDef[
'title'][
'textkey']);
1639 $pdf->MultiCell($textWidth, 2, $textbis,
'', $align);
1642 $this->tabTitleHeight = max($pdf->GetY() - $tab_top, $this->tabTitleHeight);
1645 $pdf->setCellPaddings($curentCellPaddinds[
'L'], $curentCellPaddinds[
'T'], $curentCellPaddinds[
'R'], $curentCellPaddinds[
'B']);
1650 return $this->tabTitleHeight;
1665 if (!empty($hidedetails)) {
1669 if (empty($object->table_element)) {
1674 if (empty($this->extrafieldsCache)) {
1675 $this->extrafieldsCache =
new ExtraFields($this->db);
1677 if (empty($this->extrafieldsCache->attributes[$object->table_element])) {
1678 $this->extrafieldsCache->fetch_name_optionals_label($object->table_element);
1680 $extrafields = $this->extrafieldsCache;
1683 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'])) {
1684 foreach ($extrafields->attributes[$object->table_element][
'label'] as $key => $label) {
1686 if ($extrafields->attributes[$object->table_element][
'type'][$key] ==
'separate') {
1692 if (!empty($extrafields->attributes[$object->table_element][
'printable'][$key])) {
1693 $printable = intval($extrafields->attributes[$object->table_element][
'printable'][$key]);
1694 if ($printable === 1 || $printable === 2) {
1705 if (!empty($extrafields->attributes[$object->table_element][
'langfile'][$key])) {
1706 $outputlangs->load($extrafields->attributes[$object->table_element][
'langfile'][$key]);
1713 'rank' => intval($extrafields->attributes[$object->table_element][
'pos'][$key]),
1715 'status' => boolval($enabled),
1717 'label' => $outputlangs->transnoentities($label)
1722 'border-left' =>
true,
1725 $alignTypeRight = array(
'double',
'int',
'price');
1726 if (in_array($extrafields->attributes[$object->table_element][
'type'][$key], $alignTypeRight)) {
1727 $def[
'content'][
'align'] =
'R';
1730 $alignTypeLeft = array(
'text',
'html');
1731 if (in_array($extrafields->attributes[$object->table_element][
'type'][$key], $alignTypeLeft)) {
1732 $def[
'content'][
'align'] =
'L';