51 public $errors = array();
61 public $extrafieldsCache;
66 public $update_main_doc_field;
82 public $option_multilang;
83 public $option_freetext;
84 public $option_draft_watermark;
86 public $option_modereg;
87 public $option_condreg;
88 public $option_escompte;
89 public $option_credit_note;
116 global $conf, $extrafields;
118 $logotouse = $conf->user->dir_output.
'/'.
get_exdir($user->id, 2, 0, 1, $user,
'user').
'/'.$user->photo;
121 'myuser_lastname'=>$user->lastname,
122 'myuser_firstname'=>$user->firstname,
123 'myuser_fullname'=>$user->getFullName($outputlangs, 1),
124 'myuser_login'=>$user->login,
125 'myuser_phone'=>$user->office_phone,
126 'myuser_address'=>$user->address,
127 'myuser_zip'=>$user->zip,
128 'myuser_town'=>$user->town,
129 'myuser_country'=>$user->country,
130 'myuser_country_code'=>$user->country_code,
131 'myuser_state'=>$user->state,
132 'myuser_state_code'=>$user->state_code,
133 'myuser_fax'=>$user->office_fax,
134 'myuser_mobile'=>$user->user_mobile,
135 'myuser_email'=>$user->email,
136 'myuser_logo'=>$logotouse,
137 'myuser_job'=>$user->job,
141 if (is_array($user->array_options) && count($user->array_options)) {
157 global $conf, $extrafields;
159 if ($member->photo) {
160 $logotouse = $conf->adherent->dir_output.
'/'.
get_exdir(0, 0, 0, 1, $member,
'user').
'/photos/'.$member->photo;
162 $logotouse = DOL_DOCUMENT_ROOT.
'/public/theme/common/nophoto.png';
165 $array_member = array(
166 'mymember_lastname' => $member->lastname,
167 'mymember_firstname' => $member->firstname,
168 'mymember_fullname' => $member->getFullName($outputlangs, 1),
169 'mymember_login' => $member->login,
170 'mymember_address' => $member->address,
171 'mymember_zip' => $member->zip,
172 'mymember_town' => $member->town,
173 'mymember_country_code' => $member->country_code,
174 'mymember_country' => $member->country,
175 'mymember_state_code' => $member->state_code,
176 'mymember_state' => $member->state,
177 'mymember_phone_perso' => $member->phone_perso,
178 'mymember_phone_pro' => $member->phone,
179 'mymember_phone_mobile' => $member->phone_mobile,
180 'mymember_email' => $member->email,
181 'mymember_logo' => $logotouse,
182 'mymember_gender' => $member->gender,
183 'mymember_birth_locale' =>
dol_print_date($member->birth,
'day',
'tzuser', $outputlangs),
184 'mymember_birth' =>
dol_print_date($member->birth,
'day',
'tzuser'),
187 if (is_array($member->array_options) && count($member->array_options)) {
190 return $array_member;
207 if (empty($mysoc->forme_juridique) && !empty($mysoc->forme_juridique_code)) {
210 if (empty($mysoc->country) && !empty($mysoc->country_code)) {
211 $mysoc->country = $outputlangs->transnoentitiesnoconv(
"Country".$mysoc->country_code);
213 if (empty($mysoc->state) && !empty($mysoc->state_code)) {
214 $mysoc->state =
getState($mysoc->state_code, 0);
217 $logotouse = $conf->mycompany->dir_output.
'/logos/thumbs/'.$mysoc->logo_small;
220 'mycompany_logo'=>$logotouse,
221 'mycompany_name'=>$mysoc->name,
222 'mycompany_email'=>$mysoc->email,
223 'mycompany_phone'=>$mysoc->phone,
224 'mycompany_fax'=>$mysoc->fax,
225 'mycompany_address'=>$mysoc->address,
226 'mycompany_zip'=>$mysoc->zip,
227 'mycompany_town'=>$mysoc->town,
228 'mycompany_country'=>$mysoc->country,
229 'mycompany_country_code'=>$mysoc->country_code,
230 'mycompany_state'=>$mysoc->state,
231 'mycompany_state_code'=>$mysoc->state_code,
232 'mycompany_web'=>$mysoc->url,
233 'mycompany_juridicalstatus'=>$mysoc->forme_juridique,
234 'mycompany_managers'=>$mysoc->managers,
235 'mycompany_capital'=>$mysoc->capital,
236 'mycompany_barcode'=>$mysoc->barcode,
237 'mycompany_idprof1'=>$mysoc->idprof1,
238 'mycompany_idprof2'=>$mysoc->idprof2,
239 'mycompany_idprof3'=>$mysoc->idprof3,
240 'mycompany_idprof4'=>$mysoc->idprof4,
241 'mycompany_idprof5'=>$mysoc->idprof5,
242 'mycompany_idprof6'=>$mysoc->idprof6,
243 'mycompany_vatnumber'=>$mysoc->tva_intra,
244 'mycompany_object'=>$mysoc->object,
245 'mycompany_note_private'=>$mysoc->note_private,
264 global $conf, $extrafields;
266 if (empty($object->country) && !empty($object->country_code)) {
267 $object->country = $outputlangs->transnoentitiesnoconv(
"Country".$object->country_code);
269 if (empty($object->state) && !empty($object->state_code)) {
270 $object->state =
getState($object->state_code, 0);
273 $array_thirdparty = array(
274 'company_name'=>$object->name,
275 'company_name_alias' => $object->name_alias,
276 'company_email'=>$object->email,
277 'company_phone'=>$object->phone,
278 'company_fax'=>$object->fax,
279 'company_address'=>$object->address,
280 'company_zip'=>$object->zip,
281 'company_town'=>$object->town,
282 'company_country'=>$object->country,
283 'company_country_code'=>$object->country_code,
284 'company_state'=>$object->state,
285 'company_state_code'=>$object->state_code,
286 'company_web'=>$object->url,
287 'company_barcode'=>$object->barcode,
288 'company_vatnumber'=>$object->tva_intra,
289 'company_customercode'=>$object->code_client,
290 'company_suppliercode'=>$object->code_fournisseur,
291 'company_customeraccountancycode'=>$object->code_compta,
292 'company_supplieraccountancycode'=>$object->code_compta_fournisseur,
293 'company_juridicalstatus'=>$object->forme_juridique,
294 'company_outstanding_limit'=>$object->outstanding_limit,
295 'company_capital'=>$object->capital,
296 'company_idprof1'=>$object->idprof1,
297 'company_idprof2'=>$object->idprof2,
298 'company_idprof3'=>$object->idprof3,
299 'company_idprof4'=>$object->idprof4,
300 'company_idprof5'=>$object->idprof5,
301 'company_idprof6'=>$object->idprof6,
302 'company_note_public'=>$object->note_public,
303 'company_note_private'=>$object->note_private,
304 'company_default_bank_iban'=>(is_object($object->bank_account) ? $object->bank_account->iban :
''),
305 'company_default_bank_bic'=>(is_object($object->bank_account) ? $object->bank_account->bic :
'')
309 if (is_array($object->array_options) && count($object->array_options)) {
310 $object->fetch_optionals();
314 return $array_thirdparty;
329 global $conf, $extrafields;
331 if (empty($object->country) && !empty($object->country_code)) {
332 $object->country = $outputlangs->transnoentitiesnoconv(
"Country".$object->country_code);
334 if (empty($object->state) && !empty($object->state_code)) {
335 $object->state =
getState($object->state_code, 0);
338 $array_contact = array(
339 $array_key.
'_fullname' => $object->getFullName($outputlangs, 1),
340 $array_key.
'_lastname' => $object->lastname,
341 $array_key.
'_firstname' => $object->firstname,
342 $array_key.
'_address' => $object->address,
343 $array_key.
'_zip' => $object->zip,
344 $array_key.
'_town' => $object->town,
345 $array_key.
'_state_id' => $object->state_id,
346 $array_key.
'_state_code' => $object->state_code,
347 $array_key.
'_state' => $object->state,
348 $array_key.
'_country_id' => $object->country_id,
349 $array_key.
'_country_code' => $object->country_code,
350 $array_key.
'_country' => $object->country,
351 $array_key.
'_poste' => $object->poste,
352 $array_key.
'_socid' => $object->socid,
353 $array_key.
'_statut' => $object->statut,
354 $array_key.
'_code' => $object->code,
355 $array_key.
'_email' => $object->email,
356 $array_key.
'_phone_pro' => $object->phone_pro,
357 $array_key.
'_phone_perso' => $object->phone_perso,
358 $array_key.
'_phone_mobile' => $object->phone_mobile,
359 $array_key.
'_fax' => $object->fax,
360 $array_key.
'_birthday' => $object->birthday,
361 $array_key.
'_default_lang' => $object->default_lang,
362 $array_key.
'_note_public' => $object->note_public,
363 $array_key.
'_note_private' => $object->note_private,
364 $array_key.
'_civility' => $object->civility,
368 if (is_array($object->array_options) && count($object->array_options)) {
369 $object->fetch_optionals();
373 return $array_contact;
390 $array_other = array(
395 'current_server_datehour'=>
dol_print_date($now,
'dayhour',
'tzserver'),
397 'current_date_locale'=>
dol_print_date($now,
'day',
'tzuser', $outputlangs),
398 'current_datehour_locale'=>
dol_print_date($now,
'dayhour',
'tzuser', $outputlangs),
399 'current_server_date_locale'=>
dol_print_date($now,
'day',
'tzserver', $outputlangs),
400 'current_server_datehour_locale'=>
dol_print_date($now,
'dayhour',
'tzserver', $outputlangs),
404 foreach ($conf->global as $key => $val) {
406 $newval =
'*****forbidden*****';
410 $array_other[
'__['.$key.
']__'] = $newval;
429 global $conf, $extrafields;
431 $sumpayed = $sumdeposit = $sumcreditnote =
'';
432 $already_payed_all = 0;
434 if ($object->element ==
'facture') {
435 $invoice_source =
new Facture($this->
db);
436 if ($object->fk_facture_source > 0) {
437 $invoice_source->fetch($object->fk_facture_source);
439 $sumpayed = $object->getSommePaiement();
440 $sumdeposit = $object->getSumDepositsUsed();
441 $sumcreditnote = $object->getSumCreditNotesUsed();
442 $already_payed_all = $sumpayed + $sumdeposit + $sumcreditnote;
444 if ($object->fk_account > 0) {
445 require_once DOL_DOCUMENT_ROOT.
'/compta/bank/class/account.class.php';
447 $bank_account->fetch($object->fk_account);
451 $date = (isset($object->element) && $object->element ==
'contrat' && isset($object->date_contrat)) ? $object->date_contrat : (isset($object->date) ? $object->date :
null);
454 $array_key.
'_id'=>$object->id,
455 $array_key.
'_ref' => (property_exists($object,
'ref') ? $object->ref :
''),
456 $array_key.
'_label' => (property_exists($object,
'label') ? $object->label :
''),
457 $array_key.
'_ref_ext' => (property_exists($object,
'ref_ext') ? $object->ref_ext :
''),
458 $array_key.
'_ref_customer'=>(!empty($object->ref_client) ? $object->ref_client : (empty($object->ref_customer) ?
'' : $object->ref_customer)),
459 $array_key.
'_ref_supplier'=>(!empty($object->ref_fournisseur) ? $object->ref_fournisseur : (empty($object->ref_supplier) ?
'' : $object->ref_supplier)),
460 $array_key.
'_source_invoice_ref'=>((empty($invoice_source) || empty($invoice_source->ref)) ?
'' : $invoice_source->ref),
465 $array_key.
'_date_limit'=>(!empty($object->date_lim_reglement) ?
dol_print_date($object->date_lim_reglement,
'day') :
''),
466 $array_key.
'_date_end'=>(!empty($object->fin_validite) ?
dol_print_date($object->fin_validite,
'day') :
''),
467 $array_key.
'_date_creation'=>
dol_print_date($object->date_creation,
'day'),
468 $array_key.
'_date_modification'=>(!empty($object->date_modification) ?
dol_print_date($object->date_modification,
'day') :
''),
469 $array_key.
'_date_validation'=>(!empty($object->date_validation) ?
dol_print_date($object->date_validation,
'dayhour') :
''),
470 $array_key.
'_date_delivery_planed'=>(!empty($object->date_livraison) ?
dol_print_date($object->date_livraison,
'day') :
''),
471 $array_key.
'_date_close'=>(!empty($object->date_cloture) ?
dol_print_date($object->date_cloture,
'dayhour') :
''),
473 $array_key.
'_payment_mode_code'=>$object->mode_reglement_code,
474 $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),
475 $array_key.
'_payment_term_code'=>$object->cond_reglement_code,
476 $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)),
478 $array_key.
'_incoterms' => (method_exists($object,
'display_incoterms') ? $object->display_incoterms() :
''),
480 $array_key.
'_bank_iban'=>$bank_account->iban,
481 $array_key.
'_bank_bic'=>$bank_account->bic,
482 $array_key.
'_bank_label'=>$bank_account->label,
483 $array_key.
'_bank_number'=>$bank_account->number,
484 $array_key.
'_bank_proprio'=>$bank_account->proprio,
486 $array_key.
'_total_ht_locale'=>
price($object->total_ht, 0, $outputlangs),
487 $array_key.
'_total_vat_locale'=>(!empty($object->total_vat) ?
price($object->total_vat, 0, $outputlangs) :
price($object->total_tva, 0, $outputlangs)),
488 $array_key.
'_total_localtax1_locale'=>
price($object->total_localtax1, 0, $outputlangs),
489 $array_key.
'_total_localtax2_locale'=>
price($object->total_localtax2, 0, $outputlangs),
490 $array_key.
'_total_ttc_locale'=>
price($object->total_ttc, 0, $outputlangs),
492 $array_key.
'_total_ht'=>
price2num($object->total_ht),
493 $array_key.
'_total_vat'=>(!empty($object->total_vat) ?
price2num($object->total_vat) :
price2num($object->total_tva)),
494 $array_key.
'_total_localtax1'=>
price2num($object->total_localtax1),
495 $array_key.
'_total_localtax2'=>
price2num($object->total_localtax2),
496 $array_key.
'_total_ttc'=>
price2num($object->total_ttc),
498 $array_key.
'_multicurrency_code' => $object->multicurrency_code,
499 $array_key.
'_multicurrency_tx' =>
price2num($object->multicurrency_tx),
500 $array_key.
'_multicurrency_total_ht' =>
price2num($object->multicurrency_total_ht),
501 $array_key.
'_multicurrency_total_tva' =>
price2num($object->multicurrency_total_tva),
502 $array_key.
'_multicurrency_total_ttc' =>
price2num($object->multicurrency_total_ttc),
503 $array_key.
'_multicurrency_total_ht_locale' =>
price($object->multicurrency_total_ht, 0, $outputlangs),
504 $array_key.
'_multicurrency_total_tva_locale' =>
price($object->multicurrency_total_tva, 0, $outputlangs),
505 $array_key.
'_multicurrency_total_ttc_locale' =>
price($object->multicurrency_total_ttc, 0, $outputlangs),
507 $array_key.
'_note_private'=>$object->note,
508 $array_key.
'_note_public'=>$object->note_public,
509 $array_key.
'_note'=>$object->note_public,
512 $array_key.
'_already_payed_locale'=>
price($sumpayed, 0, $outputlangs),
513 $array_key.
'_already_payed'=>
price2num($sumpayed),
514 $array_key.
'_already_deposit_locale'=>
price($sumdeposit, 0, $outputlangs),
515 $array_key.
'_already_deposit'=>
price2num($sumdeposit),
516 $array_key.
'_already_creditnote_locale'=>
price($sumcreditnote, 0, $outputlangs),
517 $array_key.
'_already_creditnote'=>
price2num($sumcreditnote),
519 $array_key.
'_already_payed_all_locale'=>
price(
price2num($already_payed_all,
'MT'), 0, $outputlangs),
520 $array_key.
'_already_payed_all'=>
price2num($already_payed_all,
'MT'),
523 $array_key.
'_remain_to_pay_locale'=>
price(
price2num($object->total_ttc - $already_payed_all,
'MT'), 0, $outputlangs),
524 $array_key.
'_remain_to_pay'=>
price2num($object->total_ttc - $already_payed_all,
'MT')
527 if (method_exists($object,
'getTotalDiscount') && in_array(get_class($object), array(
'Propal',
'Proposal',
'Commande',
'Facture',
'SupplierProposal',
'CommandeFournisseur',
'FactureFournisseur'))) {
528 $resarray[$array_key.
'_total_discount_ht_locale'] =
price($object->getTotalDiscount(), 0, $outputlangs);
529 $resarray[$array_key.
'_total_discount_ht'] =
price2num($object->getTotalDiscount());
531 $resarray[$array_key.
'_total_discount_ht_locale'] =
'';
532 $resarray[$array_key.
'_total_discount_ht'] =
'';
536 if ($object->element !=
"project" && !empty($object->fk_project) && $object->fk_project > 0) {
537 if (!is_object($object->project)) {
538 $object->fetch_projet();
541 $resarray[$array_key.
'_project_ref'] = $object->project->ref;
542 $resarray[$array_key.
'_project_title'] = $object->project->title;
543 $resarray[$array_key.
'_project_description'] = $object->project->description;
544 $resarray[$array_key.
'_project_date_start'] =
dol_print_date($object->project->date_start,
'day');
545 $resarray[$array_key.
'_project_date_end'] =
dol_print_date($object->project->date_end,
'day');
549 if (is_array($object->lines) && count($object->lines) > 0) {
552 foreach ($object->lines as $line) {
554 if (empty($resarray[$array_key.
'_total_vat_'.$line->tva_tx])) {
555 $resarray[$array_key.
'_total_vat_'.$line->tva_tx] = 0;
557 $resarray[$array_key.
'_total_vat_'.$line->tva_tx] += $line->total_tva;
558 $resarray[$array_key.
'_total_vat_locale_'.$line->tva_tx] =
price($resarray[$array_key.
'_total_vat_'.$line->tva_tx]);
560 $vatformated =
vatrate($line->tva_tx);
561 if (empty($resarray[$array_key.
'_total_vat_'.$vatformated])) {
562 $resarray[$array_key.
'_total_vat_'.$vatformated] = 0;
564 $resarray[$array_key.
'_total_vat_'.$vatformated] += $line->total_tva;
565 $resarray[$array_key.
'_total_vat_locale_'.$vatformated] =
price($resarray[$array_key.
'_total_vat_'.$vatformated]);
567 $totalUp += $line->subprice * $line->qty;
572 $resarray[
'object_total_up'] = $totalUp;
573 $resarray[
'object_total_up_locale'] =
price($resarray[
'object_total_up'], 0, $outputlangs);
574 if (method_exists($object,
'getTotalDiscount') && in_array(get_class($object), array(
'Propal',
'Proposal',
'Commande',
'Facture',
'SupplierProposal',
'CommandeFournisseur',
'FactureFournisseur'))) {
575 $totalDiscount = $object->getTotalDiscount();
579 if (!empty($totalUp) && !empty($totalDiscount)) {
580 $resarray[
'object_total_discount'] = round(100 / $totalUp * $totalDiscount, 2);
581 $resarray[
'object_total_discount_locale'] =
price($resarray[
'object_total_discount'], 0, $outputlangs);
583 $resarray[
'object_total_discount'] =
'';
584 $resarray[
'object_total_discount_locale'] =
'';
589 if (is_array($object->array_options) && count($object->array_options)) {
590 $object->fetch_optionals();
613 'line_pos' => $linenumber,
616 'line_product_ref'=>(empty($line->product_ref) ?
'' : $line->product_ref),
617 'line_product_ref_fourn'=>(empty($line->ref_fourn) ?
'' : $line->ref_fourn),
618 'line_product_label'=>(empty($line->product_label) ?
'' : $line->product_label),
619 'line_product_type'=>(empty($line->product_type) ?
'' : $line->product_type),
620 'line_product_barcode'=>(empty($line->product_barcode) ?
'' : $line->product_barcode),
621 'line_product_desc'=>(empty($line->product_desc) ?
'' : $line->product_desc),
623 'line_desc'=>$line->desc,
624 'line_vatrate'=>
vatrate($line->tva_tx,
true, $line->info_bits),
625 'line_localtax1_rate'=>
vatrate($line->localtax1_tx),
626 'line_localtax2_rate'=>
vatrate($line->localtax1_tx),
628 'line_up_locale'=>
price($line->subprice, 0, $outputlangs),
629 'line_total_up'=>
price2num($line->subprice * $line->qty),
630 'line_total_up_locale'=>
price($line->subprice * $line->qty, 0, $outputlangs),
631 'line_qty'=>$line->qty,
632 'line_discount_percent'=>($line->remise_percent ? $line->remise_percent.
'%' :
''),
633 'line_price_ht'=>
price2num($line->total_ht),
634 'line_price_ttc'=>
price2num($line->total_ttc),
635 'line_price_vat'=>
price2num($line->total_tva),
636 'line_price_ht_locale'=>
price($line->total_ht, 0, $outputlangs),
637 'line_price_ttc_locale'=>
price($line->total_ttc, 0, $outputlangs),
638 'line_price_vat_locale'=>
price($line->total_tva, 0, $outputlangs),
641 'line_date_start_locale'=>
dol_print_date($line->date_start,
'day',
'tzserver', $outputlangs),
642 'line_date_start_rfc'=>
dol_print_date($line->date_start,
'dayrfc'),
644 'line_date_end_locale'=>
dol_print_date($line->date_end,
'day',
'tzserver', $outputlangs),
647 'line_multicurrency_code' =>
price2num($line->multicurrency_code),
648 'line_multicurrency_subprice' =>
price2num($line->multicurrency_subprice),
649 'line_multicurrency_total_ht' =>
price2num($line->multicurrency_total_ht),
650 'line_multicurrency_total_tva' =>
price2num($line->multicurrency_total_tva),
651 'line_multicurrency_total_ttc' =>
price2num($line->multicurrency_total_ttc),
652 'line_multicurrency_subprice_locale' =>
price($line->multicurrency_subprice, 0, $outputlangs),
653 'line_multicurrency_total_ht_locale' =>
price($line->multicurrency_total_ht, 0, $outputlangs),
654 'line_multicurrency_total_tva_locale' =>
price($line->multicurrency_total_tva, 0, $outputlangs),
655 'line_multicurrency_total_ttc_locale' =>
price($line->multicurrency_total_ttc, 0, $outputlangs),
659 if (!empty($conf->global->PRODUCT_USE_UNITS)) {
660 $resarray[
'line_unit'] = $outputlangs->trans($line->getLabelOfUnit(
'long'));
661 $resarray[
'line_unit_short'] = $outputlangs->trans($line->getLabelOfUnit(
'short'));
665 $extrafieldkey = $line->table_element;
667 require_once DOL_DOCUMENT_ROOT.
'/core/class/extrafields.class.php';
669 $extrafields->fetch_name_optionals_label($extrafieldkey,
true);
670 $line->fetch_optionals();
675 if (get_class($line) ==
'CommandeFournisseurLigne') {
677 $extrafields->fetch_name_optionals_label(
"product_fournisseur_price");
678 $extralabels = $extrafields->attributes[
"product_fournisseur_price"][
'label'];
680 if (!empty($extralabels) && is_array($extralabels)) {
683 foreach ($extralabels as $key => $label) {
684 $columns .=
"$key, ";
687 if ($columns !=
"") {
688 $columns = substr($columns, 0, strlen($columns) - 2);
689 $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).
"'");
691 if ($this->
db->num_rows(
$resql) > 0) {
694 foreach ($extralabels as $key => $label) {
695 $resarray[
'line_product_supplier_'.$key] =
$resql->{$key};
703 if (isset($line->fk_product) && $line->fk_product > 0) {
705 $result = $tmpproduct->fetch($line->fk_product);
706 foreach ($tmpproduct->array_options as $key => $label) {
707 $resarray[
"line_product_".$key] = $label;
726 global $conf, $extrafields;
728 $object->list_delivery_methods($object->shipping_method_id);
729 $calculatedVolume = ($object->trueWidth * $object->trueHeight * $object->trueDepth);
731 $array_shipment = array(
732 $array_key.
'_id'=>$object->id,
733 $array_key.
'_ref'=>$object->ref,
734 $array_key.
'_ref_ext'=>$object->ref_ext,
735 $array_key.
'_ref_customer'=>$object->ref_customer,
736 $array_key.
'_date_delivery'=>
dol_print_date($object->date_delivery,
'day'),
737 $array_key.
'_hour_delivery'=>
dol_print_date($object->date_delivery,
'hour'),
738 $array_key.
'_date_creation'=>
dol_print_date($object->date_creation,
'day'),
739 $array_key.
'_total_ht'=>
price($object->total_ht),
740 $array_key.
'_total_vat'=>
price($object->total_tva),
741 $array_key.
'_total_ttc'=>
price($object->total_ttc),
742 $array_key.
'_total_discount_ht' =>
price($object->getTotalDiscount()),
743 $array_key.
'_note_private'=>$object->note_private,
744 $array_key.
'_note'=>$object->note_public,
745 $array_key.
'_tracking_number'=>$object->tracking_number,
746 $array_key.
'_tracking_url'=>$object->tracking_url,
747 $array_key.
'_shipping_method'=>$object->listmeths[0][
'libelle'],
748 $array_key.
'_weight'=>$object->trueWeight.
' '.
measuringUnitString(0,
'weight', $object->weight_units),
749 $array_key.
'_width'=>$object->trueWidth.
' '.
measuringUnitString(0,
'size', $object->width_units),
750 $array_key.
'_height'=>$object->trueHeight.
' '.
measuringUnitString(0,
'size', $object->height_units),
751 $array_key.
'_depth'=>$object->trueDepth.
' '.
measuringUnitString(0,
'size', $object->depth_units),
756 foreach ($object->lines as $line) {
757 if (empty($array_shipment[$array_key.
'_total_vat_'.$line->tva_tx])) {
758 $array_shipment[$array_key.
'_total_vat_'.$line->tva_tx] = 0;
760 $array_shipment[$array_key.
'_total_vat_'.$line->tva_tx] += $line->total_tva;
764 if (is_array($object->array_options) && count($object->array_options)) {
765 $object->fetch_optionals();
767 $array_shipment = $this->fill_substitutionarray_with_extrafields($object, $array_shipment, $extrafields, $array_key, $outputlangs);
771 if (!empty($object->commande) && is_object($object->commande)) {
772 $array_shipment[
'order_ref'] = $object->commande->ref;
773 $array_shipment[
'order_ref_customer'] = $object->commande->ref_customer;
776 return $array_shipment;
796 'line_product_ref'=>$line->product_ref,
797 'line_product_label'=>$line->product_label,
798 'line_desc'=>$line->desc,
799 'line_vatrate'=>
vatrate($line->tva_tx,
true, $line->info_bits),
800 'line_up'=>
price($line->subprice),
801 'line_total_up'=>
price($line->subprice * $line->qty),
802 'line_qty'=>$line->qty,
803 'line_qty_shipped'=>$line->qty_shipped,
804 'line_qty_asked'=>$line->qty_asked,
805 'line_discount_percent'=>($line->remise_percent ? $line->remise_percent.
'%' :
''),
806 'line_price_ht'=>
price($line->total_ht),
807 'line_price_ttc'=>
price($line->total_ttc),
808 'line_price_vat'=>
price($line->total_tva),
809 'line_weight'=>empty($line->weight) ?
'' : $line->weight * $line->qty_shipped.
' '.
measuringUnitString(0,
'weight', $line->weight_units),
810 'line_length'=>empty($line->length) ?
'' : $line->length * $line->qty_shipped.
' '.
measuringUnitString(0,
'size', $line->length_units),
811 'line_surface'=>empty($line->surface) ?
'' : $line->surface * $line->qty_shipped.
' '.
measuringUnitString(0,
'surface', $line->surface_units),
812 'line_volume'=>empty($line->volume) ?
'' : $line->volume * $line->qty_shipped.
' '.
measuringUnitString(0,
'volume', $line->volume_units),
816 $extrafieldkey = $line->element;
818 require_once DOL_DOCUMENT_ROOT.
'/core/class/extrafields.class.php';
820 $extrafields->fetch_name_optionals_label($extrafieldkey,
true);
821 $line->fetch_optionals();
823 $resarray = $this->fill_substitutionarray_with_extrafields($line, $resarray, $extrafields, $array_key, $outputlangs);
826 if (isset($line->fk_product) && $line->fk_product > 0) {
828 $tmpproduct->fetch($line->fk_product);
829 foreach ($tmpproduct->array_options as $key=>$label)
830 $resarray[
"line_product_".$key] = $label;
849 $array_other = array();
850 if (!empty($object)) {
851 foreach ($object as $key => $value) {
852 if (in_array($key, array(
'db',
'fields',
'lines',
'modelpdf',
'model_pdf'))) {
855 if (!empty($value)) {
856 if (!is_array($value) && !is_object($value)) {
857 $array_other[
'object_'.$key] = $value;
858 } elseif (is_array($value) && $recursive) {
859 $tmparray = $this->get_substitutionarray_each_var_object($value, $outputlangs, 0);
860 foreach ($tmparray as $key2 => $value2) {
861 $array_other[
'object_'.$key.
'_'.preg_replace(
'/^object_/',
'', $key2)] = $value2;
863 } elseif (is_object($value) && $recursive) {
864 $tmparray = $this->get_substitutionarray_each_var_object($value, $outputlangs, 0);
865 foreach ($tmparray as $key2 => $value2) {
866 $array_other[
'object_'.$key.
'_'.preg_replace(
'/^object_/',
'', $key2)] = $value2;
895 if (is_array($extrafields->attributes[$object->table_element][
'label'])) {
896 foreach ($extrafields->attributes[$object->table_element][
'label'] as $key => $label) {
897 if ($extrafields->attributes[$object->table_element][
'type'][$key] ==
'price') {
898 $object->array_options[
'options_'.$key] =
price2num($object->array_options[
'options_'.$key]);
899 $object->array_options[
'options_'.$key.
'_currency'] =
price($object->array_options[
'options_'.$key], 0, $outputlangs, 0, 0, -1, $conf->currency);
901 $array_to_fill = array_merge($array_to_fill, array($array_key.
'_options_'.$key.
'_currency' => $object->array_options[
'options_'.$key.
'_currency']));
902 } elseif ($extrafields->attributes[$object->table_element][
'type'][$key] ==
'select') {
903 $valueofselectkey = $object->array_options[
'options_'.$key];
904 if (array_key_exists($valueofselectkey, $extrafields->attributes[$object->table_element][
'param'][$key][
'options'])) {
905 $object->array_options[
'options_'.$key] = $extrafields->attributes[$object->table_element][
'param'][$key][
'options'][$valueofselectkey];
907 $object->array_options[
'options_'.$key] =
'';
909 } elseif ($extrafields->attributes[$object->table_element][
'type'][$key] ==
'checkbox') {
910 $valArray = explode(
',', $object->array_options[
'options_'.$key]);
912 foreach ($extrafields->attributes[$object->table_element][
'param'][$key][
'options'] as $keyopt => $valopt) {
913 if (in_array($keyopt, $valArray)) {
917 $object->array_options[
'options_'.$key] = implode(
', ', $output);
918 } elseif ($extrafields->attributes[$object->table_element][
'type'][$key] ==
'date') {
919 if (strlen($object->array_options[
'options_'.$key]) > 0) {
920 $date = $object->array_options[
'options_'.$key];
921 $object->array_options[
'options_'.$key] =
dol_print_date($date,
'day');
922 $object->array_options[
'options_'.$key.
'_locale'] =
dol_print_date($date,
'day',
'tzserver', $outputlangs);
923 $object->array_options[
'options_'.$key.
'_rfc'] =
dol_print_date($date,
'dayrfc');
925 $object->array_options[
'options_'.$key] =
'';
926 $object->array_options[
'options_'.$key.
'_locale'] =
'';
927 $object->array_options[
'options_'.$key.
'_rfc'] =
'';
929 $array_to_fill = array_merge($array_to_fill, array($array_key.
'_options_'.$key.
'_locale' => $object->array_options[
'options_'.$key.
'_locale']));
930 $array_to_fill = array_merge($array_to_fill, array($array_key.
'_options_'.$key.
'_rfc' => $object->array_options[
'options_'.$key.
'_rfc']));
931 } elseif ($extrafields->attributes[$object->table_element][
'label'][$key] ==
'datetime') {
932 $datetime = $object->array_options[
'options_'.$key];
933 $object->array_options[
'options_'.$key] = ($datetime !=
"0000-00-00 00:00:00" ?
dol_print_date($object->array_options[
'options_'.$key],
'dayhour') :
'');
934 $object->array_options[
'options_'.$key.
'_locale'] = ($datetime !=
"0000-00-00 00:00:00" ?
dol_print_date($object->array_options[
'options_'.$key],
'dayhour',
'tzserver', $outputlangs) :
'');
935 $object->array_options[
'options_'.$key.
'_rfc'] = ($datetime !=
"0000-00-00 00:00:00" ?
dol_print_date($object->array_options[
'options_'.$key],
'dayhourrfc') :
'');
936 $array_to_fill = array_merge($array_to_fill, array($array_key.
'_options_'.$key.
'_locale' => $object->array_options[
'options_'.$key.
'_locale']));
937 $array_to_fill = array_merge($array_to_fill, array($array_key.
'_options_'.$key.
'_rfc' => $object->array_options[
'options_'.$key.
'_rfc']));
938 } elseif ($extrafields->attributes[$object->table_element][
'type'][$key] ==
'link') {
939 $id = $object->array_options[
'options_'.$key];
941 $param = $extrafields->attributes[$object->table_element][
'param'][$key];
942 $param_list = array_keys($param[
'options']);
943 $InfoFieldList = explode(
":", $param_list[0]);
944 $classname = $InfoFieldList[0];
945 $classpath = $InfoFieldList[1];
946 if (!empty($classpath)) {
948 if ($classname && class_exists($classname)) {
949 $tmpobject =
new $classname($this->
db);
950 $tmpobject->fetch($id);
952 $object->array_options[
'options_'.$key] = $tmpobject->name;
958 if (array_key_exists(
'options_'.$key, $object->array_options)) {
959 $array_to_fill = array_merge($array_to_fill, array($array_key.
'_options_'.$key => $object->array_options[
'options_'.$key]));
961 $array_to_fill = array_merge($array_to_fill, array($array_key.
'_options_'.$key =>
''));
966 return $array_to_fill;
982 public function printRect($pdf, $x, $y, $l, $h, $hidetop = 0, $hidebottom = 0)
984 if (empty($hidetop) || $hidetop == -1) {
985 $pdf->line($x, $y, $x + $l, $y);
987 $pdf->line($x + $l, $y, $x + $l, $y + $h);
988 if (empty($hidebottom)) {
989 $pdf->line($x + $l, $y + $h, $x, $y + $h);
991 $pdf->line($x, $y + $h, $x, $y);
1004 if (empty($a[
'rank'])) {
1007 if (empty($b[
'rank'])) {
1010 if ($a[
'rank'] == $b[
'rank']) {
1013 return ($a[
'rank'] > $b[
'rank']) ? -1 : 1;
1030 $this->defineColumnField($object, $outputlangs, $hidedetails, $hidedesc, $hideref);
1034 uasort($this->cols, array($this,
'columnSort'));
1037 $curX = $this->page_largeur - $this->marge_droite;
1040 $arrayWidth = $this->page_largeur - $this->marge_droite - $this->marge_gauche;
1043 $totalDefinedColWidth = 0;
1045 foreach ($this->cols as $colKey => & $colDef) {
1046 if (!$this->getColumnStatus($colKey)) {
1050 if (!empty($colDef[
'scale'])) {
1052 $colDef[
'width'] = abs($arrayWidth * $colDef[
'scale'] / 100);
1055 if (empty($colDef[
'width'])) {
1058 $totalDefinedColWidth += $colDef[
'width'];
1062 foreach ($this->cols as $colKey => & $colDef) {
1064 if (!empty($colDef[
'title'])) {
1065 $colDef[
'title'] = array_replace($this->defaultTitlesFieldsStyle, $colDef[
'title']);
1067 $colDef[
'title'] = $this->defaultTitlesFieldsStyle;
1071 if (!empty($colDef[
'content'])) {
1072 $colDef[
'content'] = array_replace($this->defaultContentsFieldsStyle, $colDef[
'content']);
1074 $colDef[
'content'] = $this->defaultContentsFieldsStyle;
1077 if ($this->getColumnStatus($colKey)) {
1079 if (empty($colDef[
'width'])) {
1080 $colDef[
'width'] = abs(($arrayWidth - $totalDefinedColWidth)) / $countFlexCol;
1085 $curX = $lastX - $colDef[
'width'];
1086 $colDef[
'xStartPos'] = $curX;
1087 $colDef[
'xEndPos'] = $lastX;
1100 $colDef = $this->cols[$colKey];
1101 return $colDef[
'width'] - $colDef[
'content'][
'padding'][3] - $colDef[
'content'][
'padding'][1];
1113 $colDef = $this->cols[$colKey];
1114 return isset($colDef[
'xStartPos']) ? $colDef[
'xStartPos'] + $colDef[
'content'][
'padding'][3] :
null;
1125 if (!isset($this->cols[$colKey][
'rank'])) {
1128 return $this->cols[$colKey][
'rank'];
1140 public function insertNewColumnDef($newColKey, $defArray, $targetCol =
false, $insertAfterTarget =
false)
1146 if (!empty($targetCol)) {
1147 $rank = $this->getColumnRank($targetCol);
1148 if ($rank >= 0 && $insertAfterTarget) {
1154 if ($rank < 0 && !empty($defArray[
'rank'])) {
1155 $rank = $defArray[
'rank'];
1163 foreach ($this->cols as $colKey => & $colDef) {
1164 if ($rank <= $colDef[
'rank']) {
1165 $colDef[
'rank'] = $colDef[
'rank'] + 1;
1169 $defArray[
'rank'] = $rank;
1170 $this->cols[$newColKey] = $defArray;
1187 global $hookmanager;
1189 $parameters = array(
1191 'columnText' => $columnText,
1192 'colKey' => $colKey,
1195 $reshook = $hookmanager->executeHooks(
'printStdColumnContent', $parameters, $this);
1200 if (empty($columnText)) {
1203 $pdf->SetXY($this->getColumnContentXStart($colKey), $curY);
1204 $colDef = $this->cols[$colKey];
1206 $curentCellPaddinds = $pdf->getCellPaddings();
1208 $pdf->setCellPaddings($colDef[
'content'][
'padding'][3], $colDef[
'content'][
'padding'][0], $colDef[
'content'][
'padding'][1], $colDef[
'content'][
'padding'][2]);
1209 $pdf->writeHTMLCell($colDef[
'width'], 2, $colDef[
'xStartPos'], $curY, $columnText, 0, 1, 0,
true, $colDef[
'content'][
'align']);
1212 $pdf->setCellPaddings($curentCellPaddinds[
'L'], $curentCellPaddinds[
'T'], $curentCellPaddinds[
'R'], $curentCellPaddinds[
'B']);
1231 public function printColDescContent($pdf, &$curY, $colKey, $object, $i, $outputlangs, $hideref = 0, $hidedesc = 0, $issupplierline = 0)
1234 $colDef = $this->cols[$colKey];
1236 $curentCellPaddinds = $pdf->getCellPaddings();
1238 $pdf->setCellPaddings($colDef[
'content'][
'padding'][3], $colDef[
'content'][
'padding'][0], $colDef[
'content'][
'padding'][1], $colDef[
'content'][
'padding'][2]);
1241 pdf_writelinedesc($pdf, $object, $i, $outputlangs, $colDef[
'width'], 3, $colDef[
'xStartPos'], $curY, $hideref, $hidedesc, $issupplierline);
1242 $posYAfterDescription = $pdf->GetY() - $colDef[
'content'][
'padding'][0];
1245 $pdf->setCellPaddings($curentCellPaddinds[
'L'], $curentCellPaddinds[
'T'], $curentCellPaddinds[
'R'], $curentCellPaddinds[
'B']);
1249 'display' =>
'list',
1250 'printableEnable' => array(3),
1251 'printableEnableNotEmpty' => array(4)
1253 $extrafieldDesc = $this->getExtrafieldsInHtml($object->lines[$i], $outputlangs, $params);
1254 if (!empty($extrafieldDesc)) {
1255 $this->printStdColumnContent($pdf, $posYAfterDescription, $colKey, $extrafieldDesc);
1270 global $hookmanager;
1272 if (empty($object->table_element)) {
1276 $extrafieldsKeyPrefix =
"options_";
1279 $pos = strpos($extrafieldKey, $extrafieldsKeyPrefix);
1281 $extrafieldKey = substr($extrafieldKey, strlen($extrafieldsKeyPrefix));
1284 $extrafieldOptionsKey = $extrafieldsKeyPrefix.$extrafieldKey;
1288 if (empty($this->extrafieldsCache)) {
1291 if (empty($this->extrafieldsCache->attributes[$object->table_element])) {
1292 $this->extrafieldsCache->fetch_name_optionals_label($object->table_element);
1294 $extrafields = $this->extrafieldsCache;
1296 $extrafieldOutputContent =
'';
1297 if (isset($object->array_options[$extrafieldOptionsKey])) $extrafieldOutputContent = $extrafields->showOutputField($extrafieldKey, $object->array_options[$extrafieldOptionsKey],
'', $object->table_element);
1300 if ($extrafields->attributes[$object->table_element][
'type'][$extrafieldKey] ==
'link') {
1305 $parameters = array(
1306 'object' => $object,
1307 'extrafields' => $extrafields,
1308 'extrafieldKey' => $extrafieldKey,
1309 'extrafieldOutputContent' =>& $extrafieldOutputContent
1311 $reshook = $hookmanager->executeHooks(
'getPDFExtrafieldContent', $parameters, $this);
1316 $extrafieldOutputContent = $hookmanager->resPrint;
1319 return $extrafieldOutputContent;
1331 public function getExtrafieldsInHtml($object, $outputlangs, $params = array())
1333 global $hookmanager;
1335 if (empty($object->table_element)) {
1340 if (empty($this->extrafieldsCache)) {
1343 if (empty($this->extrafieldsCache->attributes[$object->table_element])) {
1344 $this->extrafieldsCache->fetch_name_optionals_label($object->table_element);
1346 $extrafields = $this->extrafieldsCache;
1348 $defaultParams = array(
1350 'display' =>
'auto',
1351 'printableEnable' => array(1),
1352 'printableEnableNotEmpty' => array(2),
1355 'maxItemsInRow' => 2,
1359 'labelcolwidth' =>
'25%',
1360 'arrayOfLineBreakType' => array(
'text',
'html')
1364 'separator' =>
'<br>'
1373 $params = $params + $defaultParams;
1383 if (!empty($extrafields->attributes[$object->table_element][
'label']) && is_array($extrafields->attributes[$object->table_element][
'label'])) {
1384 foreach ($extrafields->attributes[$object->table_element][
'label'] as $key => $label) {
1387 $disableOnEmpty = 0;
1388 if (!empty($extrafields->attributes[$object->table_element][
'printable'][$key])) {
1389 $printable = intval($extrafields->attributes[$object->table_element][
'printable'][$key]);
1390 if (in_array($printable, $params[
'printableEnable']) || in_array($printable, $params[
'printableEnableNotEmpty'])) {
1394 if (in_array($printable, $params[
'printableEnableNotEmpty'])) {
1395 $disableOnEmpty = 1;
1399 if (empty($enabled)) {
1403 $field =
new stdClass();
1404 $field->rank = intval($extrafields->attributes[$object->table_element][
'pos'][$key]);
1405 $field->content = $this->getExtrafieldContent($object, $key, $outputlangs);
1406 $field->label = $outputlangs->transnoentities($label);
1407 $field->type = $extrafields->attributes[$object->table_element][
'type'][$key];
1410 if ($disableOnEmpty && empty($field->content)) {
1418 if (!empty($fields)) {
1420 uasort($fields,
function ($a, $b) {
1421 return ($a->rank > $b->rank) ? 1 : -1;
1425 $html .= !empty($params[
'style']) ?
'<style>'.$params[
'style'].
'</style>' :
'';
1428 if ($params[
'display'] ==
'auto') {
1429 $lastNnumbItems = 0;
1430 foreach ($params[
'auto'] as $display => $numbItems) {
1431 if ($lastNnumbItems <= $numbItems && count($fields) > $numbItems) {
1432 $lastNnumbItems = $numbItems;
1433 $params[
'display'] = $display;
1438 if ($params[
'display'] ==
'list') {
1441 foreach ($fields as $field) {
1442 $html .= !empty($i) ? $params[
'list'][
'separator'] :
'';
1443 $html .=
'<strong>'.$field->label.
' : </strong>';
1444 $html .= $field->content;
1447 } elseif ($params[
'display'] ==
'table') {
1449 $html .=
'<table class="extrafield-table" cellspacing="'.$params[
'table'][
'cellspacing'].
'" cellpadding="'.$params[
'table'][
'cellpadding'].
'" border="'.$params[
'table'][
'border'].
'">';
1453 $maxItemsInRow = $params[
'table'][
'maxItemsInRow'];
1454 foreach ($fields as $field) {
1456 if ($itemsInRow >= $maxItemsInRow) {
1458 $html .=
"</tr><tr>";
1463 if (in_array($field->type, $params[
'table'][
'arrayOfLineBreakType'])) {
1464 if ($itemsInRow > 0) {
1466 for ($i = $itemsInRow; $i <= $maxItemsInRow; $i++) {
1467 $html .=
"<td></td><td></td>";
1475 $itemsInRow = $maxItemsInRow;
1476 $html .=
'<td colspan="'.($maxItemsInRow * 2 - 1).
'">';
1477 $html .=
'<strong>'.$field->label.
' :</strong> ';
1478 $html .= $field->content;
1482 $html .=
'<td width="'.$params[
'table'][
'labelcolwidth'].
'" class="extrafield-label">';
1483 $html .=
'<strong>'.$field->label.
' :</strong>';
1487 $html .=
'<td class="extrafield-content">';
1488 $html .= $field->content;
1494 $html .=
'</table>';
1510 if (!empty($this->cols[$colKey][
'status'])) {
1527 public function pdfTabTitles(&$pdf, $tab_top, $tab_height, $outputlangs, $hidetop = 0)
1529 global $hookmanager, $conf;
1531 foreach ($this->cols as $colKey => $colDef) {
1532 $parameters = array(
1533 'colKey' => $colKey,
1535 'outputlangs' => $outputlangs,
1536 'tab_top' => $tab_top,
1537 'tab_height' => $tab_height,
1538 'hidetop' => $hidetop
1541 $reshook = $hookmanager->executeHooks(
'pdfTabTitles', $parameters, $this);
1544 } elseif (empty($reshook)) {
1545 if (!$this->getColumnStatus($colKey)) {
1550 $colDef[
'title'][
'label'] = !empty($colDef[
'title'][
'label']) ? $colDef[
'title'][
'label'] : $outputlangs->transnoentities($colDef[
'title'][
'textkey']);
1553 if (!empty($colDef[
'border-left'])) {
1554 $pdf->line($colDef[
'xStartPos'], $tab_top, $colDef[
'xStartPos'], $tab_top + $tab_height);
1557 if (empty($hidetop)) {
1559 $curentCellPaddinds = $pdf->getCellPaddings();
1562 global $outputlangsbis;
1563 if (is_object($outputlangsbis)) {
1565 $pdf->setCellPaddings($colDef[
'title'][
'padding'][3], $colDef[
'title'][
'padding'][0], $colDef[
'title'][
'padding'][1], 0.5);
1568 $pdf->setCellPaddings($colDef[
'title'][
'padding'][3], $colDef[
'title'][
'padding'][0], $colDef[
'title'][
'padding'][1], $colDef[
'title'][
'padding'][2]);
1570 if (isset($colDef[
'title'][
'align'])) {
1571 $align = $colDef[
'title'][
'align'];
1575 $pdf->SetXY($colDef[
'xStartPos'], $tab_top);
1576 $textWidth = $colDef[
'width'];
1577 $pdf->MultiCell($textWidth, 2, $colDef[
'title'][
'label'],
'', $align);
1580 if (is_object($outputlangsbis) && trim($colDef[
'title'][
'label'])) {
1581 $pdf->setCellPaddings($colDef[
'title'][
'padding'][3], 0, $colDef[
'title'][
'padding'][1], $colDef[
'title'][
'padding'][2]);
1582 $pdf->SetXY($colDef[
'xStartPos'], $pdf->GetY());
1583 $textbis = $outputlangsbis->transnoentities($colDef[
'title'][
'textkey']);
1584 $pdf->MultiCell($textWidth, 2, $textbis,
'', $align);
1587 $this->tabTitleHeight = max($pdf->GetY() - $tab_top, $this->tabTitleHeight);
1590 $pdf->setCellPaddings($curentCellPaddinds[
'L'], $curentCellPaddinds[
'T'], $curentCellPaddinds[
'R'], $curentCellPaddinds[
'B']);
1595 return $this->tabTitleHeight;
1612 if (!empty($hidedetails)) {
1616 if (empty($object->table_element)) {
1621 if (empty($this->extrafieldsCache)) {
1624 if (empty($this->extrafieldsCache->attributes[$object->table_element])) {
1625 $this->extrafieldsCache->fetch_name_optionals_label($object->table_element);
1627 $extrafields = $this->extrafieldsCache;
1630 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'])) {
1631 foreach ($extrafields->attributes[$object->table_element][
'label'] as $key => $label) {
1633 if ($extrafields->attributes[$object->table_element][
'type'][$key] ==
'separate') {
1639 if (!empty($extrafields->attributes[$object->table_element][
'printable'][$key])) {
1640 $printable = intval($extrafields->attributes[$object->table_element][
'printable'][$key]);
1641 if ($printable === 1 || $printable === 2) {
1652 if (!empty($extrafields->attributes[$object->table_element][
'langfile'][$key])) {
1653 $outputlangs->load($extrafields->attributes[$object->table_element][
'langfile'][$key]);
1660 'rank' => intval($extrafields->attributes[$object->table_element][
'pos'][$key]),
1662 'status' => boolval($enabled),
1664 'label' => $outputlangs->transnoentities($label)
1669 'border-left' =>
true,
1672 $alignTypeRight = array(
'double',
'int',
'price');
1673 if (in_array($extrafields->attributes[$object->table_element][
'type'][$key], $alignTypeRight)) {
1674 $def[
'content'][
'align'] =
'R';
1677 $alignTypeLeft = array(
'text',
'html');
1678 if (in_array($extrafields->attributes[$object->table_element][
'type'][$key], $alignTypeLeft)) {
1679 $def[
'content'][
'align'] =
'L';
1684 $this->insertNewColumnDef(
"options_".$key, $def);