59 public $errors = array();
64 public $warnings = array();
74 public $extrafieldsCache;
79 public $update_main_doc_field;
104 public $page_hauteur;
109 public $page_largeur;
114 public $marge_gauche;
119 public $marge_droite;
134 public $corner_radius;
147 public $option_multilang;
151 public $option_freetext;
155 public $option_draft_watermark;
164 public $option_modereg;
168 public $option_condreg;
172 public $option_escompte;
176 public $option_credit_note;
203 public $tabTitleHeight;
208 public $defaultTitlesFieldsStyle;
213 public $defaultContentsFieldsStyle;
224 public $phpmin = array(7, 1);
234 public $afterColsLinePositions;
288 public $posxdiscount;
292 public $posxworkload;
296 public $posxtimespent;
300 public $posxprogress;
304 public $atleastonephoto;
308 public $atleastoneratenotnull;
312 public $atleastonediscount;
336 global $conf, $extrafields;
341 'myuser_lastname' => $user->lastname,
342 'myuser_firstname' => $user->firstname,
343 'myuser_fullname' => $user->getFullName($outputlangs, 1),
344 'myuser_login' => $user->login,
345 'myuser_phone' => $user->office_phone,
346 'myuser_address' => $user->address,
347 'myuser_zip' => $user->zip,
348 'myuser_town' => $user->town,
349 'myuser_country' => $user->country,
350 'myuser_country_code' => $user->country_code,
351 'myuser_state' => $user->state,
352 'myuser_state_code' => $user->state_code,
353 'myuser_fax' => $user->office_fax,
354 'myuser_mobile' => $user->user_mobile,
355 'myuser_email' => $user->email,
356 'myuser_logo' => $logotouse,
357 'myuser_job' => $user->job,
360 'myuser_dateemployment' =>
dol_print_date($user->dateemployment,
'day',
'tzuser'),
361 'myuser_dateemploymentend' =>
dol_print_date($user->dateemploymentend,
'day',
'tzuser'),
362 'myuser_gender' => $user->gender,
365 if (is_array($user->array_options) && count($user->array_options)) {
366 if (empty($extrafields->attributes[$user->table_element])) {
367 $extrafields->fetch_name_optionals_label($user->table_element);
384 global $conf, $extrafields;
386 if ($member->photo) {
387 $logotouse = $conf->member->dir_output.
'/'.
get_exdir(0, 0, 0, 1, $member,
'user').
'/photos/'.$member->photo;
389 $logotouse = DOL_DOCUMENT_ROOT.
'/public/theme/common/nophoto.png';
392 $array_member = array(
393 'mymember_lastname' => $member->lastname,
394 'mymember_firstname' => $member->firstname,
395 'mymember_fullname' => $member->getFullName($outputlangs, 1),
396 'mymember_login' => $member->login,
397 'mymember_address' => $member->address,
398 'mymember_zip' => $member->zip,
399 'mymember_town' => $member->town,
400 'mymember_country_code' => $member->country_code,
401 'mymember_country' => $member->country,
402 'mymember_state_code' => $member->state_code,
403 'mymember_state' => $member->state,
404 'mymember_phone_perso' => $member->phone_perso,
405 'mymember_phone_pro' => $member->phone,
406 'mymember_phone_mobile' => $member->phone_mobile,
407 'mymember_email' => $member->email,
408 'mymember_logo' => $logotouse,
409 'mymember_gender' => $member->gender,
410 'mymember_birth_locale' =>
dol_print_date($member->birth,
'day',
'tzuser', $outputlangs),
411 'mymember_birth' =>
dol_print_date($member->birth,
'day',
'tzuser'),
414 if (is_array($member->array_options) && count($member->array_options)) {
417 return $array_member;
434 if (empty(
$mysoc->forme_juridique) && !empty(
$mysoc->forme_juridique_code)) {
437 if (empty(
$mysoc->country) && !empty(
$mysoc->country_code)) {
438 $mysoc->country = $outputlangs->transnoentitiesnoconv(
"Country".
$mysoc->country_code);
440 if (empty(
$mysoc->state) && !empty(
$mysoc->state_code)) {
445 $logotouse = $conf->mycompany->dir_output.
'/logos/thumbs/'.
$mysoc->logo_small;
448 'mycompany_logo' => $logotouse,
449 'mycompany_name' =>
$mysoc->name,
450 'mycompany_email' =>
$mysoc->email,
451 'mycompany_phone' =>
$mysoc->phone,
452 'mycompany_fax' =>
$mysoc->fax,
453 'mycompany_address' =>
$mysoc->address,
454 'mycompany_zip' =>
$mysoc->zip,
455 'mycompany_town' =>
$mysoc->town,
456 'mycompany_country' =>
$mysoc->country,
457 'mycompany_country_code' =>
$mysoc->country_code,
458 'mycompany_state' =>
$mysoc->state,
459 'mycompany_state_code' =>
$mysoc->state_code,
460 'mycompany_web' =>
$mysoc->url,
461 'mycompany_juridicalstatus' =>
$mysoc->forme_juridique,
462 'mycompany_managers' =>
$mysoc->managers,
463 'mycompany_capital' =>
$mysoc->capital,
464 'mycompany_barcode' =>
$mysoc->barcode,
465 'mycompany_idprof1' =>
$mysoc->idprof1,
466 'mycompany_idprof2' =>
$mysoc->idprof2,
467 'mycompany_idprof3' =>
$mysoc->idprof3,
468 'mycompany_idprof4' =>
$mysoc->idprof4,
469 'mycompany_idprof5' =>
$mysoc->idprof5,
470 'mycompany_idprof6' =>
$mysoc->idprof6,
471 'mycompany_vatnumber' =>
$mysoc->tva_intra,
472 'mycompany_socialobject' =>
$mysoc->socialobject,
473 'mycompany_note_private' =>
$mysoc->note_private,
499 $object->country = $outputlangs->transnoentitiesnoconv(
"Country".
$object->country_code);
506 $array_thirdparty = array(
507 'company_name' =>
$object->name,
508 'company_name_alias' =>
$object->name_alias,
509 'company_email' =>
$object->email,
510 'company_phone' =>
$object->phone,
512 'company_address' =>
$object->address,
514 'company_town' =>
$object->town,
515 'company_country' =>
$object->country,
516 'company_country_code' =>
$object->country_code,
517 'company_state' =>
$object->state,
518 'company_state_code' =>
$object->state_code,
520 'company_barcode' =>
$object->barcode,
521 'company_vatnumber' =>
$object->tva_intra,
522 'company_customercode' =>
$object->code_client,
523 'company_suppliercode' =>
$object->code_fournisseur,
524 'company_customeraccountancycode' =>
$object->code_compta_client,
525 'company_supplieraccountancycode' =>
$object->code_compta_fournisseur,
526 'company_juridicalstatus' =>
$object->forme_juridique,
527 'company_outstanding_limit' =>
$object->outstanding_limit,
528 'company_capital' =>
$object->capital,
529 'company_capital_formated' =>
price(
$object->capital, 0,
'', 1, -1),
530 'company_idprof1' =>
$object->idprof1,
531 'company_idprof2' =>
$object->idprof2,
532 'company_idprof3' =>
$object->idprof3,
533 'company_idprof4' =>
$object->idprof4,
534 'company_idprof5' =>
$object->idprof5,
535 'company_idprof6' =>
$object->idprof6,
536 'company_note_public' =>
$object->note_public,
537 'company_note_private' =>
$object->note_private,
538 'company_default_bank_iban' => (is_object(
$object->bank_account) ?
$object->bank_account->iban :
''),
539 'company_default_bank_bic' => (is_object(
$object->bank_account) ?
$object->bank_account->bic :
'')
543 if (is_array(
$object->array_options) && count(
$object->array_options)) {
548 return $array_thirdparty;
563 global $conf, $extrafields;
566 $object->country = $outputlangs->transnoentitiesnoconv(
"Country".
$object->country_code);
573 $array_contact = array(
574 $array_key.
'_fullname' =>
$object->getFullName($outputlangs, 1),
575 $array_key.
'_lastname' =>
$object->lastname,
576 $array_key.
'_firstname' =>
$object->firstname,
577 $array_key.
'_address' =>
$object->address,
578 $array_key.
'_zip' =>
$object->zip,
579 $array_key.
'_town' =>
$object->town,
580 $array_key.
'_state_id' =>
$object->state_id,
581 $array_key.
'_state_code' =>
$object->state_code,
582 $array_key.
'_state' =>
$object->state,
583 $array_key.
'_country_id' =>
$object->country_id,
584 $array_key.
'_country_code' =>
$object->country_code,
585 $array_key.
'_country' =>
$object->country,
586 $array_key.
'_poste' =>
$object->poste,
587 $array_key.
'_socid' =>
$object->socid,
588 $array_key.
'_statut' =>
$object->statut,
589 $array_key.
'_code' =>
$object->code,
590 $array_key.
'_email' =>
$object->email,
591 $array_key.
'_phone_pro' =>
$object->phone_pro,
592 $array_key.
'_phone_perso' =>
$object->phone_perso,
593 $array_key.
'_phone_mobile' =>
$object->phone_mobile,
594 $array_key.
'_fax' =>
$object->fax,
595 $array_key.
'_birthday' =>
$object->birthday,
596 $array_key.
'_default_lang' =>
$object->default_lang,
597 $array_key.
'_note_public' =>
$object->note_public,
598 $array_key.
'_note_private' =>
$object->note_private,
599 $array_key.
'_civility' =>
$object->civility,
603 if (is_array(
$object->array_options) && count(
$object->array_options)) {
608 return $array_contact;
625 $array_other = array(
630 'current_server_datehour' =>
dol_print_date($now,
'dayhour',
'tzserver'),
632 'current_date_locale' =>
dol_print_date($now,
'day',
'tzuser', $outputlangs),
633 'current_datehour_locale' =>
dol_print_date($now,
'dayhour',
'tzuser', $outputlangs),
634 'current_server_date_locale' =>
dol_print_date($now,
'day',
'tzserver', $outputlangs),
635 'current_server_datehour_locale' =>
dol_print_date($now,
'dayhour',
'tzserver', $outputlangs),
639 foreach ($conf->global as $key => $val) {
641 $newval =
'*****forbidden*****';
645 $array_other[
'__['.$key.
']__'] = $newval;
662 public function get_substitutionarray_object(
$object, $outputlangs, $array_key =
'object')
667 $totalpaid = $totaldeposits = $totalcreditnotes =
'';
668 $already_payed_all = 0;
670 if (
$object->element ==
'facture') {
672 '@phan-var-force Facture $object';
673 $invoice_source =
new Facture($this->db);
674 if (
$object->fk_facture_source > 0) {
675 $invoice_source->fetch(
$object->fk_facture_source);
677 $totalpaid =
$object->getSommePaiement();
678 $totaldeposits =
$object->getSumDepositsUsed();
679 $totalcreditnotes =
$object->getSumCreditNotesUsed();
680 $already_payed_all = $totalpaid + $totaldeposits + $totalcreditnotes;
691 $array_key.
'_id' =>
$object->id,
692 $array_key.
'_ref' => (property_exists(
$object,
'ref') ?
$object->ref :
''),
693 $array_key.
'_label' => (property_exists(
$object,
'label') ?
$object->label :
''),
694 $array_key.
'_ref_ext' => (property_exists(
$object,
'ref_ext') ?
$object->ref_ext :
''),
695 $array_key.
'_ref_customer' => (!empty(
$object->ref_client) ?
$object->ref_client : (empty(
$object->ref_customer) ?
'' :
$object->ref_customer)),
696 $array_key.
'_ref_supplier' => (!empty(
$object->ref_fournisseur) ?
$object->ref_fournisseur : (empty(
$object->ref_supplier) ?
'' :
$object->ref_supplier)),
697 $array_key.
'_source_invoice_ref' => ((empty($invoice_source) || empty($invoice_source->
ref)) ?
'' : $invoice_source->
ref),
712 $array_key.
'_payment_mode_code' =>
$object->mode_reglement_code,
713 $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),
714 $array_key.
'_payment_term_code' =>
$object->cond_reglement_code,
715 $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),
719 $array_key.
'_total_ht_locale' =>
price(
$object->total_ht, 0, $outputlangs),
720 $array_key.
'_total_vat_locale' => (!empty(
$object->total_vat) ?
price(
$object->total_vat, 0, $outputlangs) :
price(
$object->total_tva, 0, $outputlangs)),
721 $array_key.
'_total_localtax1_locale' =>
price(
$object->total_localtax1, 0, $outputlangs),
722 $array_key.
'_total_localtax2_locale' =>
price(
$object->total_localtax2, 0, $outputlangs),
723 $array_key.
'_total_ttc_locale' =>
price(
$object->total_ttc, 0, $outputlangs),
731 $array_key.
'_multicurrency_code' =>
$object->multicurrency_code,
733 $array_key.
'_multicurrency_total_ht' =>
price2num(
$object->multicurrency_total_ht),
734 $array_key.
'_multicurrency_total_tva' =>
price2num(
$object->multicurrency_total_tva),
735 $array_key.
'_multicurrency_total_ttc' =>
price2num(
$object->multicurrency_total_ttc),
736 $array_key.
'_multicurrency_total_ht_locale' =>
price(
$object->multicurrency_total_ht, 0, $outputlangs),
737 $array_key.
'_multicurrency_total_tva_locale' =>
price(
$object->multicurrency_total_tva, 0, $outputlangs),
738 $array_key.
'_multicurrency_total_ttc_locale' =>
price(
$object->multicurrency_total_ttc, 0, $outputlangs),
740 $array_key.
'_note_private' =>
$object->note_private,
741 $array_key.
'_note_public' =>
$object->note_public,
742 $array_key.
'_note' =>
$object->note_public,
745 $array_key.
'_already_payed_locale' =>
price($totalpaid, 0, $outputlangs),
746 $array_key.
'_already_payed' =>
price2num($totalpaid),
747 $array_key.
'_already_deposit_locale' =>
price($totaldeposits, 0, $outputlangs),
748 $array_key.
'_already_deposit' =>
price2num($totaldeposits),
749 $array_key.
'_already_creditnote_locale' =>
price($totalcreditnotes, 0, $outputlangs),
750 $array_key.
'_already_creditnote' =>
price2num($totalcreditnotes),
752 $array_key.
'_already_payed_all_locale' =>
price(
price2num($already_payed_all,
'MT'), 0, $outputlangs),
753 $array_key.
'_already_payed_all' =>
price2num($already_payed_all,
'MT'),
756 $array_key.
'_remain_to_pay_locale' =>
price(
price2num(
$object->total_ttc - $already_payed_all,
'MT'), 0, $outputlangs),
757 $array_key.
'_remain_to_pay' =>
price2num(
$object->total_ttc - $already_payed_all,
'MT')
760 if (in_array(
$object->element, array(
'facture',
'invoice',
'supplier_invoice',
'facture_fournisseur'))) {
761 $bank_account =
null;
763 if (property_exists(
$object,
'fk_account') &&
$object->fk_account > 0) {
764 require_once DOL_DOCUMENT_ROOT.
'/compta/bank/class/account.class.php';
765 $bank_account =
new Account($this->db);
766 $bank_account->fetch((
int)
$object->fk_account);
769 $resarray[$array_key.
'_bank_iban'] = (empty($bank_account) ?
'' : $bank_account->iban);
770 $resarray[$array_key.
'_bank_bic'] = (empty($bank_account) ?
'' : $bank_account->bic);
771 $resarray[$array_key.
'_bank_label'] = (empty($bank_account) ?
'' : $bank_account->label);
772 $resarray[$array_key.
'_bank_number'] = (empty($bank_account) ?
'' : $bank_account->number);
773 $resarray[$array_key.
'_bank_proprio'] = (empty($bank_account) ?
'' : $bank_account->owner_name);
774 $resarray[$array_key.
'_bank_address'] = (empty($bank_account) ?
'' : $bank_account->address);
775 $resarray[$array_key.
'_bank_state'] = (empty($bank_account) ?
'' : $bank_account->state);
776 $resarray[$array_key.
'_bank_country'] = (empty($bank_account) ?
'' : $bank_account->country);
779 if (method_exists(
$object,
'getTotalDiscount') && in_array(get_class(
$object), array(
'Propal',
'Proposal',
'Commande',
'Facture',
'SupplierProposal',
'CommandeFournisseur',
'FactureFournisseur'))) {
780 $resarray[$array_key.
'_total_discount_ht_locale'] =
price(
$object->getTotalDiscount(), 0, $outputlangs);
781 $resarray[$array_key.
'_total_discount_ht'] =
price2num(
$object->getTotalDiscount());
783 $resarray[$array_key.
'_total_discount_ht_locale'] =
'';
784 $resarray[$array_key.
'_total_discount_ht'] =
'';
787 if (
$object->element ==
'facture' ||
$object->element ==
'invoice_supplier') {
789 $resarray[$array_key.
'_type_label'] = $outputlangs->transnoentities(
"PdfInvoiceTitle");
791 $resarray[$array_key.
'_type_label'] = (empty(
$object)) ?
'' :
$object->getLibType(0);
797 if (!is_object(
$object->project)) {
801 $resarray[$array_key.
'_project_ref'] =
$object->project->ref;
802 $resarray[$array_key.
'_project_title'] =
$object->project->title;
803 $resarray[$array_key.
'_project_description'] =
$object->project->description;
807 $resarray[$array_key.
'_project_ref'] =
'';
808 $resarray[$array_key.
'_project_title'] =
'';
809 $resarray[$array_key.
'_project_description'] =
'';
810 $resarray[$array_key.
'_project_date_start'] =
'';
811 $resarray[$array_key.
'_project_date_end'] =
'';
818 foreach (
$object->lines as $line) {
820 if (empty($resarray[$array_key.
'_total_vat_'.$line->tva_tx])) {
821 $resarray[$array_key.
'_total_vat_'.$line->tva_tx] = 0;
823 $resarray[$array_key.
'_total_vat_'.$line->tva_tx] += $line->total_tva;
824 $resarray[$array_key.
'_total_vat_locale_'.$line->tva_tx] =
price($resarray[$array_key.
'_total_vat_'.$line->tva_tx]);
826 $vatformated =
vatrate($line->tva_tx);
827 if (empty($resarray[$array_key.
'_total_vat_'.$vatformated])) {
828 $resarray[$array_key.
'_total_vat_'.$vatformated] = 0;
830 $resarray[$array_key.
'_total_vat_'.$vatformated] += $line->total_tva;
831 $resarray[$array_key.
'_total_vat_locale_'.$vatformated] =
price($resarray[$array_key.
'_total_vat_'.$vatformated]);
833 $totalUp += $line->subprice * $line->qty;
838 $resarray[
'object_total_up'] = $totalUp;
839 $resarray[
'object_total_up_locale'] =
price($resarray[
'object_total_up'], 0, $outputlangs);
840 if (method_exists(
$object,
'getTotalDiscount') && in_array(get_class(
$object), array(
'Propal',
'Proposal',
'Commande',
'Facture',
'SupplierProposal',
'CommandeFournisseur',
'FactureFournisseur'))) {
841 $totalDiscount =
$object->getTotalDiscount();
845 if (!empty($totalUp) && !empty($totalDiscount)) {
846 $resarray[
'object_total_discount'] = round(100 / $totalUp * $totalDiscount, 2);
847 $resarray[
'object_total_discount_locale'] =
price($resarray[
'object_total_discount'], 0, $outputlangs);
849 $resarray[
'object_total_discount'] =
'';
850 $resarray[
'object_total_discount_locale'] =
'';
855 if (is_array(
$object->array_options) && count(
$object->array_options)) {
878 'line_pos' => $linenumber,
881 'line_product_ref' => (empty($line->product_ref) ?
'' : $line->product_ref),
882 'line_product_label' => (empty($line->product_label) ?
'' : $line->product_label),
883 'line_product_type' => (empty($line->product_type) ?
'' : $line->product_type),
884 'line_product_barcode' => (empty($line->product_barcode) ?
'' : $line->product_barcode),
885 'line_product_desc' => (empty($line->product_desc) ?
'' : $line->product_desc),
887 'line_desc' => $line->desc,
888 'line_vatrate' =>
vatrate($line->tva_tx,
true, (
int) $line->info_bits),
890 'line_up_locale' =>
price($line->subprice, 0, $outputlangs),
891 'line_total_up' =>
price2num($line->subprice * (
float) $line->qty),
892 'line_total_up_locale' =>
price($line->subprice * (
float) $line->qty, 0, $outputlangs),
893 'line_qty' => $line->qty,
894 'line_qty_locale' =>
price($line->qty),
895 'line_discount_percent' => ($line->remise_percent ? $line->remise_percent.
'%' :
''),
896 'line_price_ht' =>
price2num($line->total_ht),
897 'line_price_ttc' =>
price2num($line->total_ttc),
898 'line_price_vat' =>
price2num($line->total_tva),
899 'line_price_ht_locale' =>
price($line->total_ht, 0, $outputlangs),
900 'line_price_ttc_locale' =>
price($line->total_ttc, 0, $outputlangs),
901 'line_price_vat_locale' =>
price($line->total_tva, 0, $outputlangs),
903 'line_multicurrency_code' =>
price2num($line->multicurrency_code),
904 'line_multicurrency_subprice' =>
price2num($line->multicurrency_subprice),
905 'line_multicurrency_total_ht' =>
price2num($line->multicurrency_total_ht),
906 'line_multicurrency_total_tva' =>
price2num($line->multicurrency_total_tva),
907 'line_multicurrency_total_ttc' =>
price2num($line->multicurrency_total_ttc),
908 'line_multicurrency_subprice_locale' =>
price($line->multicurrency_subprice, 0, $outputlangs),
909 'line_multicurrency_total_ht_locale' =>
price($line->multicurrency_total_ht, 0, $outputlangs),
910 'line_multicurrency_total_tva_locale' =>
price($line->multicurrency_total_tva, 0, $outputlangs),
911 'line_multicurrency_total_ttc_locale' =>
price($line->multicurrency_total_ttc, 0, $outputlangs),
914 if (property_exists($line,
'ref_fourn')) {
915 $resarray[
'line_product_ref_fourn'] = $line->ref_fourn;
917 $resarray[
'line_product_ref_fourn'] =
'';
920 'line_localtax1_rate' =>
'localtax1_tx',
921 'line_localtax2_rate' =>
'localtax2_tx',
923 foreach ($vat_specs as $vat_key => $vat_spec) {
924 if (property_exists($line, $vat_spec)) {
926 $resarray[$vat_key] =
vatrate($line->$vat_spec);
932 array(
'line_date_start',
'date_start',
'day',
'auto',
null),
933 array(
'line_date_start_locale',
'date_start',
'day',
'tzserver', $outputlangs),
934 array(
'line_date_start_rfc',
'date_start',
'dayrfc',
'auto',
null),
935 array(
'line_date_start_real',
'date_start_real',
'day',
'auto',
null),
936 array(
'line_date_start_real_locale',
'date_start_real',
'day',
'tzserver', $outputlangs),
937 array(
'line_date_start_real_rfc',
'date_start_real',
'dayrfc',
'auto',
null),
938 array(
'line_date_end',
'date_end',
'day',
'auto',
null),
939 array(
'line_date_end_locale',
'date_end',
'day',
'tzserver', $outputlangs),
940 array(
'line_date_end_rfc',
'date_end',
'dayrfc',
'auto',
null)
942 foreach ($date_specs as $date_spec) {
943 $propertyname = $date_spec[1];
944 if (property_exists($line, $propertyname)) {
946 $resarray[$date_spec[0]] =
dol_print_date($line->$propertyname, $date_spec[2], $date_spec[3], $date_spec[4]);
952 $resarray[
'line_unit'] = $line->getLabelOfUnit(
'long', $outputlangs);
953 $resarray[
'line_unit_short'] = $line->getLabelOfUnit(
'short', $outputlangs);
958 $extrafieldkey = $line->table_element;
960 require_once DOL_DOCUMENT_ROOT.
'/core/class/extrafields.class.php';
962 $extrafields->fetch_name_optionals_label($extrafieldkey,
true);
963 $line->fetch_optionals();
968 if (get_class($line) ==
'CommandeFournisseurLigne') {
970 $extrafields->fetch_name_optionals_label(
"product_fournisseur_price");
971 $extralabels = $extrafields->attributes[
"product_fournisseur_price"][
'label'];
973 if (!empty($extralabels) && is_array($extralabels)) {
976 foreach ($extralabels as $key => $label) {
977 $columns .=
"$key, ";
980 if ($columns !=
"") {
981 $columns = substr($columns, 0, strlen($columns) - 2);
982 $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).
"'");
984 if ($this->db->num_rows($resql) > 0) {
985 $resql = $this->db->fetch_object($resql);
987 foreach ($extralabels as $key => $label) {
988 $resarray[
'line_product_supplier_'.$key] = $resql->$key;
996 if (get_class($line) ==
'ExpeditionLigne') {
997 $resarray[
'line_qty_shipped'] = $line->qty_shipped;
998 $resarray[
'line_qty_asked'] = $line->qty_asked;
999 $resarray[
'line_weight'] = empty($line->weight) ?
'' : $line->weight * $line->qty_shipped.
' '.
measuringUnitString(0,
'weight', $line->weight_units);
1000 $resarray[
'line_length'] = empty($line->length) ?
'' : $line->length * $line->qty_shipped.
' '.
measuringUnitString(0,
'size', $line->length_units);
1001 $resarray[
'line_surface'] = empty($line->surface) ?
'' : $line->surface * $line->qty_shipped.
' '.
measuringUnitString(0,
'surface', $line->surface_units);
1002 $resarray[
'line_volume'] = empty($line->volume) ?
'' : $line->volume * $line->qty_shipped.
' '.
measuringUnitString(0,
'volume', $line->volume_units);
1006 if (isset($line->fk_product) && $line->fk_product > 0) {
1007 $tmpproduct =
new Product($this->db);
1008 $result = $tmpproduct->fetch($line->fk_product);
1009 if (!empty($tmpproduct->array_options) && is_array($tmpproduct->array_options)) {
1010 foreach ($tmpproduct->array_options as $key => $label) {
1011 $resarray[
"line_product_".$key] = $label;
1016 $extrafields->fetch_name_optionals_label(
"product");
1017 if ($extrafields->attributes[
"product"][
'count'] > 0) {
1018 $extralabels = $extrafields->attributes[
"product"][
'label'];
1020 foreach ($extralabels as $key => $label) {
1021 $resarray[
'line_product_options_'.$key] =
'';
1042 global $extrafields;
1044 include_once DOL_DOCUMENT_ROOT.
'/core/lib/product.lib.php';
1047 $calculatedVolume = ((float)
$object->trueWidth * (
float)
$object->trueHeight * (float)
$object->trueDepth);
1049 $array_shipment = array(
1050 $array_key.
'_id' =>
$object->id,
1051 $array_key.
'_ref' =>
$object->ref,
1052 $array_key.
'_ref_ext' =>
$object->ref_ext,
1053 $array_key.
'_ref_customer' =>
$object->ref_customer,
1060 $array_key.
'_total_discount_ht' =>
price(
$object->getTotalDiscount()),
1061 $array_key.
'_note_private' =>
$object->note_private,
1062 $array_key.
'_note' =>
$object->note_public,
1063 $array_key.
'_tracking_number' =>
$object->tracking_number,
1064 $array_key.
'_tracking_url' =>
$object->tracking_url,
1065 $array_key.
'_shipping_method' =>
$object->listmeths[0][
'libelle'],
1074 foreach (
$object->lines as $line) {
1075 if (empty($array_shipment[$array_key.
'_total_vat_'.$line->tva_tx])) {
1076 $array_shipment[$array_key.
'_total_vat_'.$line->tva_tx] = 0;
1078 $array_shipment[$array_key.
'_total_vat_'.$line->tva_tx] += $line->total_tva;
1082 if (is_array(
$object->array_options) && count(
$object->array_options)) {
1089 if (
$object->origin_type ==
'commande' && is_object(
$object->origin_object) && !empty(
$object->origin_object->ref)) {
1090 $originOrder =
$object->origin_object;
1091 '@phan-var-force Commande $originOrder';
1092 $array_shipment[
'order_ref'] = $originOrder->ref;
1093 $array_shipment[
'order_ref_customer'] = $originOrder->ref_customer;
1097 $tmparray =
$object->getTotalWeightVolume();
1098 $totalWeight = $tmparray[
'weight'];
1099 $totalVolume = $tmparray[
'volume'];
1100 $totalOrdered = $tmparray[
'ordered'];
1101 $totalToShip = $tmparray[
'toship'];
1109 $array_shipment[$array_key.
'_total_ordered'] = (string) $totalOrdered;
1110 $array_shipment[$array_key.
'_total_toship'] = (string) $totalToShip;
1114 } elseif (!empty($totalWeight)) {
1115 $array_shipment[$array_key.
'_total_weight'] =
showDimensionInBestUnit($totalWeight, 0,
"weight", $outputlangs, -1,
'no', 1);
1117 $array_shipment[$array_key.
'_total_weight'] =
"";
1120 if (!empty(
$object->trueVolume)) {
1121 if (
$object->volume_units < 50) {
1124 $array_shipment[$array_key.
'_total_volume'] = (empty($totalVolume)) ?
'' :
price(
$object->trueVolume, 0, $outputlangs, 0, 0).
' '.
measuringUnitString(0,
"volume",
$object->volume_units);
1126 } elseif (!empty($totalVolume)) {
1127 $array_shipment[$array_key.
'_total_volume'] =
showDimensionInBestUnit($totalVolume, 0,
"volume", $outputlangs, -1,
'no', 1);
1129 $array_shipment[$array_key.
'_total_volume'] =
"";
1132 return $array_shipment;
1150 $array_other = array();
1154 foreach (
$object as $key => $value) {
1155 if (in_array($key, array(
'db',
'fields',
'lines',
'modelpdf',
'model_pdf'))) {
1158 if (!empty($value)) {
1159 if (!is_array($value) && !is_object($value)) {
1160 $array_other[
'object_'.$key] = $value;
1161 } elseif (is_array($value) && $recursive) {
1163 if (!empty($tmparray) && is_array($tmparray)) {
1164 foreach ($tmparray as $key2 => $value2) {
1165 $array_other[
'object_'.$key.
'_'.preg_replace(
'/^object_/',
'', $key2)] = $value2;
1168 } elseif (is_object($value) && $recursive) {
1170 if (!empty($tmparray) && is_array($tmparray)) {
1171 foreach ($tmparray as $key2 => $value2) {
1172 $array_other[
'object_'.$key.
'_'.preg_replace(
'/^object_/',
'', $key2)] = $value2;
1180 return $array_other;
1201 if ($extrafields->attributes[
$object->table_element][
'count'] > 0) {
1202 foreach ($extrafields->attributes[
$object->table_element][
'label'] as $key => $label) {
1203 $formatedarrayoption =
$object->array_options;
1205 if ($extrafields->attributes[
$object->table_element][
'type'][$key] ==
'price') {
1206 $formatedarrayoption[
'options_'.$key] =
price2num($formatedarrayoption[
'options_'.$key]);
1207 $formatedarrayoption[
'options_'.$key.
'_currency'] =
price($formatedarrayoption[
'options_'.$key], 0, $outputlangs, 0, 0, -1, $conf->currency);
1209 $array_to_fill = array_merge($array_to_fill, array($array_key.
'_options_'.$key.
'_currency' => $formatedarrayoption[
'options_'.$key.
'_currency']));
1210 } elseif ($extrafields->attributes[
$object->table_element][
'type'][$key] ==
'select') {
1211 $valueofselectkey = $formatedarrayoption[
'options_'.$key];
1212 if (array_key_exists($valueofselectkey, $extrafields->attributes[
$object->table_element][
'param'][$key][
'options'])) {
1213 $formatedarrayoption[
'options_'.$key] = $extrafields->attributes[
$object->table_element][
'param'][$key][
'options'][$valueofselectkey];
1215 $formatedarrayoption[
'options_'.$key] =
'';
1217 } elseif ($extrafields->attributes[
$object->table_element][
'type'][$key] ==
'checkbox') {
1218 $valArray = explode(
',', $formatedarrayoption[
'options_'.$key]);
1220 foreach ($extrafields->attributes[
$object->table_element][
'param'][$key][
'options'] as $keyopt => $valopt) {
1221 if (in_array($keyopt, $valArray)) {
1222 $output[] = $valopt;
1225 $formatedarrayoption[
'options_'.$key] = implode(
', ', $output);
1226 } elseif ($extrafields->attributes[
$object->table_element][
'type'][$key] ==
'date') {
1227 if (strlen($formatedarrayoption[
'options_'.$key]) > 0) {
1228 $date = $formatedarrayoption[
'options_'.$key];
1229 $formatedarrayoption[
'options_'.$key] =
dol_print_date($date,
'day');
1230 $formatedarrayoption[
'options_'.$key.
'_locale'] =
dol_print_date($date,
'day',
'tzserver', $outputlangs);
1231 $formatedarrayoption[
'options_'.$key.
'_rfc'] =
dol_print_date($date,
'dayrfc');
1233 $formatedarrayoption[
'options_'.$key] =
'';
1234 $formatedarrayoption[
'options_'.$key.
'_locale'] =
'';
1235 $formatedarrayoption[
'options_'.$key.
'_rfc'] =
'';
1237 $array_to_fill = array_merge($array_to_fill, array($array_key.
'_options_'.$key.
'_locale' => $formatedarrayoption[
'options_'.$key.
'_locale']));
1238 $array_to_fill = array_merge($array_to_fill, array($array_key.
'_options_'.$key.
'_rfc' => $formatedarrayoption[
'options_'.$key.
'_rfc']));
1239 } elseif ($extrafields->attributes[
$object->table_element][
'type'][$key] ==
'datetime') {
1240 $datetime = $formatedarrayoption[
'options_'.$key];
1241 $formatedarrayoption[
'options_'.$key] = ($datetime !=
"0000-00-00 00:00:00" ?
dol_print_date($datetime,
'dayhour') :
'');
1242 $formatedarrayoption[
'options_'.$key.
'_locale'] = ($datetime !=
"0000-00-00 00:00:00" ?
dol_print_date($datetime,
'dayhour',
'tzserver', $outputlangs) :
'');
1243 $formatedarrayoption[
'options_'.$key.
'_rfc'] = ($datetime !=
"0000-00-00 00:00:00" ?
dol_print_date($datetime,
'dayhourrfc') :
'');
1244 $array_to_fill = array_merge($array_to_fill, array($array_key.
'_options_'.$key.
'_locale' => $formatedarrayoption[
'options_'.$key.
'_locale']));
1245 $array_to_fill = array_merge($array_to_fill, array($array_key.
'_options_'.$key.
'_rfc' => $formatedarrayoption[
'options_'.$key.
'_rfc']));
1246 } elseif ($extrafields->attributes[
$object->table_element][
'type'][$key] ==
'link') {
1247 $id = $formatedarrayoption[
'options_'.$key];
1249 $param = $extrafields->attributes[
$object->table_element][
'param'][$key];
1250 $param_list = array_keys($param[
'options']);
1251 $InfoFieldList = explode(
":", $param_list[0]);
1252 $classname = $InfoFieldList[0];
1253 $classpath = $InfoFieldList[1];
1254 if (!empty($classpath)) {
1256 if ($classname && class_exists($classname)) {
1257 $tmpobject =
new $classname($this->db);
1258 '@phan-var-force CommonObject $tmpobject';
1259 $tmpobject->fetch(
$id);
1261 $formatedarrayoption[
'options_'.$key] = $tmpobject->name;
1267 if (array_key_exists(
'options_'.$key, $formatedarrayoption)) {
1268 $array_to_fill = array_merge($array_to_fill, array($array_key.
'_options_'.$key => $formatedarrayoption[
'options_'.$key]));
1270 $array_to_fill = array_merge($array_to_fill, array($array_key.
'_options_'.$key =>
''));
1275 return $array_to_fill;
1291 public function printRect($pdf, $x, $y, $l, $h, $hidetop = 0, $hidebottom = 0)
1293 if (empty($hidetop) || $hidetop == -1) {
1294 $pdf->line($x, $y, $x + $l, $y);
1296 $pdf->line($x + $l, $y, $x + $l, $y + $h);
1297 if (empty($hidebottom)) {
1298 $pdf->line($x + $l, $y + $h, $x, $y + $h);
1300 $pdf->line($x, $y + $h, $x, $y);
1317 public function printRoundedRect($pdf, $x, $y, $w, $h, $r, $hidetop = 0, $hidebottom = 0, $style =
'D')
1320 if (empty($hidetop) || $hidetop == -1) {
1321 $pdf->RoundedRect($x, $y, $w, $h, $r,
'1111', $style);
1324 $pdf->RoundedRect($x, $y, $w, $h, $r,
'0111', $style);
1326 if (!empty($hidebottom)) {
1327 $pdf->RoundedRect($x, $y, $w, $h, $r,
'1101', $style);
1337 if (empty($this->afterColsLinePositions) || !is_array($this->afterColsLinePositions)) {
1342 $maxPage = $maxY = 0;
1343 foreach ($this->afterColsLinePositions as $colKey => $value) {
1344 if ($value[
'page'] > $maxPage) {
1346 $maxPage = $value[
'page'];
1347 $maxY = $value[
'y'];
1348 } elseif ($value[
'page'] == $maxPage) {
1349 $maxY = max($value[
'y'], $maxY);
1369 $this->afterColsLinePositions = [];
1382 $this->afterColsLinePositions[$colId] = [
1383 'page' => $pageNumb,
1398 if (empty($a[
'rank'])) {
1401 if (empty($b[
'rank'])) {
1404 if ($a[
'rank'] == $b[
'rank']) {
1407 return ($a[
'rank'] > $b[
'rank']) ? -1 : 1;
1426 uasort($this->cols, array($this,
'columnSort'));
1429 $curX = $this->page_largeur - $this->marge_droite;
1432 $arrayWidth = $this->page_largeur - $this->marge_droite - $this->marge_gauche;
1435 $totalDefinedColWidth = 0;
1437 foreach ($this->cols as $colKey => & $colDef) {
1442 if (!empty($colDef[
'scale'])) {
1444 $colDef[
'width'] = abs($arrayWidth * $colDef[
'scale'] / 100);
1447 if (empty($colDef[
'width'])) {
1450 $totalDefinedColWidth += $colDef[
'width'];
1454 foreach ($this->cols as $colKey => & $colDef) {
1456 if (!empty($colDef[
'title'])) {
1457 $colDef[
'title'] = array_replace($this->defaultTitlesFieldsStyle, $colDef[
'title']);
1459 $colDef[
'title'] = $this->defaultTitlesFieldsStyle;
1463 if (!empty($colDef[
'content'])) {
1464 $colDef[
'content'] = array_replace($this->defaultContentsFieldsStyle, $colDef[
'content']);
1466 $colDef[
'content'] = $this->defaultContentsFieldsStyle;
1471 if (empty($colDef[
'width'])) {
1472 $colDef[
'width'] = abs(($arrayWidth - $totalDefinedColWidth)) / $countFlexCol;
1477 $curX = $lastX - $colDef[
'width'];
1478 $colDef[
'xStartPos'] = $curX;
1479 $colDef[
'xEndPos'] = $lastX;
1492 $colDef = $this->cols[$colKey];
1493 return $colDef[
'width'] - $colDef[
'content'][
'padding'][3] - $colDef[
'content'][
'padding'][1];
1505 $colDef = (isset($this->cols[$colKey]) ? $this->cols[$colKey] :
null);
1506 return (is_array($colDef) ? ((isset($colDef[
'xStartPos']) ? $colDef[
'xStartPos'] : 0) + $colDef[
'content'][
'padding'][3]) : 0);
1517 if (!isset($this->cols[$colKey][
'rank'])) {
1520 return $this->cols[$colKey][
'rank'];
1538 if (!empty($targetCol)) {
1540 if ($rank >= 0 && $insertAfterTarget) {
1546 if ($rank < 0 && !empty($defArray[
'rank'])) {
1547 $rank = $defArray[
'rank'];
1555 foreach ($this->cols as $colKey => & $colDef) {
1556 if ($rank <= $colDef[
'rank']) {
1557 $colDef[
'rank'] += 1;
1561 $defArray[
'rank'] = $rank;
1562 $this->cols[$newColKey] = $defArray;
1579 global $hookmanager;
1581 $parameters = array(
1583 'columnText' => $columnText,
1584 'colKey' => $colKey,
1587 $reshook = $hookmanager->executeHooks(
'printStdColumnContent', $parameters, $this);
1592 if (empty($columnText)) {
1596 $colDef = $this->cols[$colKey];
1598 $curentCellPaddinds = $pdf->getCellPaddings();
1600 $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);
1601 $pdf->writeHTMLCell($colDef[
'width'], 2, isset($colDef[
'xStartPos']) ? $colDef[
'xStartPos'] : 0, $curY, $columnText, 0, 1,
false,
true, $colDef[
'content'][
'align']);
1605 $pdf->setCellPaddings($curentCellPaddinds[
'L'], $curentCellPaddinds[
'T'], $curentCellPaddinds[
'R'], $curentCellPaddinds[
'B']);
1628 global $hookmanager;
1631 $colDef = $this->cols[$colKey];
1633 $curentCellPaddinds = $pdf->getCellPaddings();
1635 $pdf->setCellPaddings($colDef[
'content'][
'padding'][3], $colDef[
'content'][
'padding'][0], $colDef[
'content'][
'padding'][1], $colDef[
'content'][
'padding'][2]);
1638 pdf_writelinedesc($pdf,
$object, $i, $outputlangs, $colDef[
'width'], 3, $colDef[
'xStartPos'], $curY, $hideref, $hidedesc, $issupplierline, empty($colDef[
'content'][
'align']) ?
'J' : $colDef[
'content'][
'align']);
1639 $posYAfterDescription = $pdf->GetY() - $colDef[
'content'][
'padding'][0];
1642 $pdf->setCellPaddings($curentCellPaddinds[
'L'], $curentCellPaddinds[
'T'], $curentCellPaddinds[
'R'], $curentCellPaddinds[
'B']);
1646 'display' =>
'list',
1647 'printableEnable' => array(3),
1648 'printableEnableNotEmpty' => array(4)
1650 $extrafieldDesc = $this->getExtrafieldsInHtml(
$object->lines[$i], $outputlangs, $params);
1651 if (!empty($extrafieldDesc)) {
1655 $parameters = array(
1657 'colKey' => $colKey,
1660 'outputlangs' => $outputlangs,
1663 $reshook = $hookmanager->executeHooks(
'printColDescContent', $parameters, $this);
1680 global $hookmanager;
1682 if (empty(
$object->table_element)) {
1686 $extrafieldsKeyPrefix =
"options_";
1689 $pos = strpos($extrafieldKey, $extrafieldsKeyPrefix);
1691 $extrafieldKey = substr($extrafieldKey, strlen($extrafieldsKeyPrefix));
1694 $extrafieldOptionsKey = $extrafieldsKeyPrefix.$extrafieldKey;
1698 if (is_null($this->extrafieldsCache)) {
1699 $this->extrafieldsCache =
new ExtraFields($this->db);
1701 if (empty($this->extrafieldsCache->attributes[
$object->table_element])) {
1702 $this->extrafieldsCache->fetch_name_optionals_label(
$object->table_element);
1704 $extrafields = $this->extrafieldsCache;
1706 $extrafieldOutputContent =
'';
1707 if (isset(
$object->array_options[$extrafieldOptionsKey])) {
1708 $extrafieldOutputContent = $extrafields->showOutputField($extrafieldKey,
$object->array_options[$extrafieldOptionsKey],
'',
$object->table_element, $outputlangs);
1712 if ($extrafields->attributes[
$object->table_element][
'type'][$extrafieldKey] ==
'link') {
1718 if ($extrafields->attributes[
$object->table_element][
'type'][$extrafieldKey] ==
'stars') {
1719 $extrafieldOutputContent =
'';
1720 for ($i = 0; $i <
$object->array_options[$extrafieldOptionsKey]; $i++) {
1721 $extrafieldOutputContent .=
' *';
1725 $parameters = array(
1727 'extrafields' => $extrafields,
1728 'extrafieldKey' => $extrafieldKey,
1729 'extrafieldOutputContent' => & $extrafieldOutputContent
1731 $reshook = $hookmanager->executeHooks(
'getPDFExtrafieldContent', $parameters, $this);
1736 $extrafieldOutputContent = $hookmanager->resPrint;
1739 return $extrafieldOutputContent;
1751 public function getExtrafieldsInHtml(
$object, $outputlangs, $params = array())
1753 global $hookmanager;
1755 if (empty(
$object->table_element)) {
1760 if (is_null($this->extrafieldsCache)) {
1761 $this->extrafieldsCache =
new ExtraFields($this->db);
1763 if (empty($this->extrafieldsCache->attributes[
$object->table_element])) {
1764 $this->extrafieldsCache->fetch_name_optionals_label(
$object->table_element);
1766 $extrafields = $this->extrafieldsCache;
1768 $defaultParams = array(
1770 'display' =>
'auto',
1771 'printableEnable' => array(1),
1772 'printableEnableNotEmpty' => array(2),
1775 'maxItemsInRow' => 2,
1779 'labelcolwidth' =>
'25%',
1780 'arrayOfLineBreakType' => array(
'text',
'html')
1784 'separator' =>
'<br>'
1793 $params += $defaultParams;
1802 if (!empty($extrafields->attributes[
$object->table_element][
'label']) && is_array($extrafields->attributes[
$object->table_element][
'label'])) {
1803 foreach ($extrafields->attributes[
$object->table_element][
'label'] as $key => $label) {
1806 if (!empty($extrafields->attributes[
$object->table_element][
'enabled'][$key])) {
1807 $enabled = (int)
dol_eval((
string) $extrafields->attributes[
$object->table_element][
'enabled'][$key], 1, 1,
'2');
1816 $disableOnEmpty = 0;
1818 if (!empty($extrafields->attributes[
$object->table_element][
'printable'][$key])) {
1819 $printable = (int) $extrafields->attributes[
$object->table_element][
'printable'][$key];
1820 if (in_array($printable, $params[
'printableEnable']) || in_array($printable, $params[
'printableEnableNotEmpty'])) {
1824 if (in_array($printable, $params[
'printableEnableNotEmpty'])) {
1825 $disableOnEmpty = 1;
1829 if (empty($enabled) || empty($printable)) {
1834 if (!empty($extrafields->attributes[
$object->table_element][
'langfile'][$key])) {
1835 $outputlangs->load($extrafields->attributes[
$object->table_element][
'langfile'][$key]);
1839 $field->rank = intval($extrafields->attributes[
$object->table_element][
'pos'][$key]);
1841 if (isset($extrafields->attributes[
$object->table_element][
'langfile'][$key])) {
1842 $outputlangs->load($extrafields->attributes[
$object->table_element][
'langfile'][$key]);
1844 $field->label = $outputlangs->transnoentities($label);
1845 $field->type = $extrafields->attributes[
$object->table_element][
'type'][$key];
1848 if ($disableOnEmpty && empty($field->content)) {
1856 if (!empty($fields)) {
1865 static function ($a, $b) {
1866 return ($a->rank > $b->rank) ? 1 : -1;
1871 $html .= !empty($params[
'style']) ?
'<style>'.$params[
'style'].
'</style>' :
'';
1874 if ($params[
'display'] ==
'auto') {
1875 $lastNnumbItems = 0;
1876 foreach ($params[
'auto'] as $display => $numbItems) {
1877 if ($lastNnumbItems <= $numbItems && count($fields) > $numbItems) {
1878 $lastNnumbItems = $numbItems;
1879 $params[
'display'] = $display;
1884 if ($params[
'display'] ==
'list') {
1887 foreach ($fields as $field) {
1888 $html .= !empty($i) ? $params[
'list'][
'separator'] :
'';
1889 $html .=
'<strong>'.$field->label.
' : </strong>';
1890 $html .= $field->content;
1893 } elseif ($params[
'display'] ==
'table') {
1895 $html .=
'<table class="extrafield-table" cellspacing="'.$params[
'table'][
'cellspacing'].
'" cellpadding="'.$params[
'table'][
'cellpadding'].
'" border="'.$params[
'table'][
'border'].
'">';
1899 $maxItemsInRow = $params[
'table'][
'maxItemsInRow'];
1900 foreach ($fields as $field) {
1902 if ($itemsInRow >= $maxItemsInRow) {
1904 $html .=
"</tr><tr>";
1909 if (in_array($field->type, $params[
'table'][
'arrayOfLineBreakType'])) {
1910 if ($itemsInRow > 0) {
1912 for ($i = $itemsInRow; $i <= $maxItemsInRow; $i++) {
1913 $html .=
"<td></td><td></td>";
1921 $itemsInRow = $maxItemsInRow;
1922 $html .=
'<td colspan="'.($maxItemsInRow * 2 - 1).
'">';
1923 $html .=
'<strong>'.$field->label.
' :</strong> ';
1924 $html .= $field->content;
1928 $html .=
'<td width="'.$params[
'table'][
'labelcolwidth'].
'" class="extrafield-label">';
1929 $html .=
'<strong>'.$field->label.
' :</strong>';
1933 $html .=
'<td class="extrafield-content">';
1934 $html .= $field->content;
1940 $html .=
'</table>';
1956 if (!empty($this->cols[$colKey][
'status'])) {
1973 public function pdfTabTitles(&$pdf, $tab_top, $tab_height, $outputlangs, $hidetop = 0)
1975 global $hookmanager, $conf;
1977 foreach ($this->cols as $colKey => $colDef) {
1978 $parameters = array(
1979 'colKey' => $colKey,
1981 'outputlangs' => $outputlangs,
1982 'tab_top' => $tab_top,
1983 'tab_height' => $tab_height,
1984 'hidetop' => $hidetop
1987 $reshook = $hookmanager->executeHooks(
'pdfTabTitles', $parameters, $this);
1990 } elseif (empty($reshook)) {
1996 $colDef[
'title'][
'label'] = !empty($colDef[
'title'][
'label']) ? $colDef[
'title'][
'label'] : $outputlangs->transnoentities($colDef[
'title'][
'textkey']);
1999 if (!empty($colDef[
'border-left']) && isset($colDef[
'xStartPos'])) {
2000 $pdf->line($colDef[
'xStartPos'], $tab_top, $colDef[
'xStartPos'], $tab_top + $tab_height);
2003 if (empty($hidetop)) {
2005 $curentCellPaddinds = $pdf->getCellPaddings();
2008 global $outputlangsbis;
2009 if (is_object($outputlangsbis)) {
2011 $pdf->setCellPaddings($colDef[
'title'][
'padding'][3], $colDef[
'title'][
'padding'][0], $colDef[
'title'][
'padding'][1], 0.5);
2014 $pdf->setCellPaddings($colDef[
'title'][
'padding'][3], $colDef[
'title'][
'padding'][0], $colDef[
'title'][
'padding'][1], $colDef[
'title'][
'padding'][2]);
2016 if (isset($colDef[
'title'][
'align'])) {
2017 $align = $colDef[
'title'][
'align'];
2021 $pdf->SetXY($colDef[
'xStartPos'], $tab_top);
2022 $textWidth = $colDef[
'width'];
2023 $pdf->MultiCell($textWidth, 2, $colDef[
'title'][
'label'],
'', $align);
2026 if (is_object($outputlangsbis) && trim($colDef[
'title'][
'label'])) {
2027 $pdf->setCellPaddings($colDef[
'title'][
'padding'][3], 0, $colDef[
'title'][
'padding'][1], $colDef[
'title'][
'padding'][2]);
2028 $pdf->SetXY($colDef[
'xStartPos'], $pdf->GetY());
2029 $textbis = $outputlangsbis->transnoentities($colDef[
'title'][
'textkey']);
2030 $pdf->MultiCell($textWidth, 2, $textbis,
'', $align);
2033 $this->tabTitleHeight = max($pdf->GetY() - $tab_top, $this->tabTitleHeight);
2036 $pdf->setCellPaddings($curentCellPaddinds[
'L'], $curentCellPaddinds[
'T'], $curentCellPaddinds[
'R'], $curentCellPaddinds[
'B']);
2041 return $this->tabTitleHeight;
2056 if (!empty($hidedetails)) {
2060 if (empty(
$object->table_element)) {
2065 if (is_null($this->extrafieldsCache)) {
2066 $this->extrafieldsCache =
new ExtraFields($this->db);
2068 if (empty($this->extrafieldsCache->attributes[
$object->table_element])) {
2069 $this->extrafieldsCache->fetch_name_optionals_label(
$object->table_element);
2071 $extrafields = $this->extrafieldsCache;
2074 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'])) {
2075 foreach ($extrafields->attributes[
$object->table_element][
'label'] as $key => $label) {
2077 if ($extrafields->attributes[
$object->table_element][
'type'][$key] ==
'separate') {
2083 if (!empty($extrafields->attributes[
$object->table_element][
'printable'][$key])) {
2084 $printable = intval($extrafields->attributes[
$object->table_element][
'printable'][$key]);
2085 if ($printable === 1 || $printable === 2) {
2096 if (!empty($extrafields->attributes[
$object->table_element][
'langfile'][$key])) {
2097 $outputlangs->load($extrafields->attributes[
$object->table_element][
'langfile'][$key]);
2104 'rank' => intval($extrafields->attributes[
$object->table_element][
'pos'][$key]),
2106 'status' => (
bool) $enabled,
2108 'label' => $outputlangs->transnoentities($label)
2113 'border-left' =>
true,
2116 $alignTypeRight = array(
'double',
'int',
'price');
2117 if (in_array($extrafields->attributes[
$object->table_element][
'type'][$key], $alignTypeRight)) {
2118 $def[
'content'][
'align'] =
'R';
2121 $alignTypeLeft = array(
'text',
'html');
2122 if (in_array($extrafields->attributes[
$object->table_element][
'type'][$key], $alignTypeLeft)) {
2123 $def[
'content'][
'align'] =
'L';
2149 $this->defaultContentsFieldsStyle = array(
2151 'padding' => array(1, 0.5, 1, 0.5),
2155 $this->defaultTitlesFieldsStyle = array(
2157 'padding' => array(0.5, 0, 0.5, 0),
$id
Support class for third parties, contacts, members, users or resources.
if(! $sortfield) if(! $sortorder) $object
Class to manage bank accounts.
Class to manage predefined suppliers products.
Parent class for documents (PDF, ODT, ...) generators.
get_substitutionarray_shipment($object, $outputlangs, $array_key='object')
Define array with couple substitution key => substitution value Note that vars into substitutions arr...
insertNewColumnDef($newColKey, $defArray, $targetCol='', $insertAfterTarget=false)
get column position rank from column key
getSubstitutionarrayMember($member, $outputlangs)
Define array with couple substitution key => substitution value.
get_substitutionarray_each_var_object(&$object, $outputlangs, $recursive=1)
Define array with couple substitution key => substitution value @phpstan-template T.
prepareArrayColumnField($object, $outputlangs, $hidedetails=0, $hidedesc=0, $hideref=0)
Prepare Array Column Field.
get_substitutionarray_mysoc($mysoc, $outputlangs)
Define array with couple substitution key => substitution value.
getColumnStatus($colKey)
get column status from column key
printStdColumnContent($pdf, &$curY, $colKey, $columnText='')
print standard column content
pdfTabTitles(&$pdf, $tab_top, $tab_height, $outputlangs, $hidetop=0)
Print standard column content.
printColDescContent($pdf, &$curY, $colKey, $object, $i, $outputlangs, $hideref=0, $hidedesc=0, $issupplierline=0)
print description column content
get_substitutionarray_contact($object, $outputlangs, $array_key='object')
Define array with couple substitution key => substitution value.
getMaxAfterColsLinePositionsData()
Get position in PDF after col display.
get_substitutionarray_other($outputlangs)
Define array with couple substitution key => substitution value.
columnSort($a, $b)
uasort callback function to Sort columns fields
fill_substitutionarray_with_extrafields($object, $array_to_fill, $extrafields, $array_key, $outputlangs)
Fill array with couple extrafield key => extrafield value Note that vars into substitutions array are...
getColumnContentXStart($colKey)
get column content X (abscissa) left position from column key
setAfterColsLinePositionsData(string $colId, float $y, int $pageNumb)
Used for to set afterColsLinePositions var in a pdf draw line loop.
__construct($db)
Constructor.
printRect($pdf, $x, $y, $l, $h, $hidetop=0, $hidebottom=0)
Rect pdf.
getColumnContentWidth($colKey)
get column content width from column key
getColumnRank($colKey)
get column position rank from column key
getExtrafieldContent($object, $extrafieldKey, $outputlangs=null)
get extrafield content for pdf writeHtmlCell compatibility usage for PDF line columns and object note...
printRoundedRect($pdf, $x, $y, $w, $h, $r, $hidetop=0, $hidebottom=0, $style='D')
Print a rounded rectangle on the PDF.
resetAfterColsLinePositionsData(float $y, int $pageNumb)
Used for reset afterColsLinePositions var in start of a new pdf draw line loop.
get_substitutionarray_lines($line, $outputlangs, $linenumber=0)
Define array with couple substitution key => substitution value Note that vars into substitutions arr...
defineColumnExtrafield($object, $outputlangs, $hidedetails=0)
Define Array Column Field for extrafields.
defineColumnField($object, $outputlangs, $hidedetails=0, $hidedesc=0, $hideref=0)
Define Array Column Field into $this->cols This method must be implemented by the module that generat...
get_substitutionarray_thirdparty($object, $outputlangs, $array_key='company')
Define array with couple substitution key => substitution value For example {company_name}...
get_substitutionarray_user($user, $outputlangs)
Define array with couple substitution key => substitution value.
Class to manage invoices.
Class to manage products or services.
display_incoterms()
Return incoterms information TODO Use a cache for label get.
getState($id, $withcode='0', $dbtouse=null, $withregion=0, $outputlangs=null, $entconv=1)
Return state translated from an id.
getFormeJuridiqueLabel($code)
Return the name translated of juridical status.
doc_getlinedesc($line, $outputlangs, $hideref=0, $hidedesc=0, $issupplierline=0)
Return line description translated in outputlangs and encoded into UTF8.
dol_now($mode='gmt')
Return date for now.
dol_getIdFromCode($db, $key, $tablename, $fieldkey='code', $fieldid='id', $entityfilter=0, $filters='', $useCache=true)
Return an id or code from a code or id.
setEventMessages($mesg, $mesgs, $style='mesgs', $messagekey='', $noduplicate=0, $attop=0)
Set event messages in dol_events session object.
vatrate($rate, $addpercent=false, $info_bits=0, $usestarfornpr=0, $html=0)
Return a string with VAT rate label formatted for view output Used into pdf and HTML pages.
isASecretKey($keyname)
Return if string has a name dedicated to store a secret.
dol_string_nohtmltag($stringtoclean, $removelinefeed=1, $pagecodeto='UTF-8', $strip_tags=0, $removedoublespaces=1)
Clean a string from all HTML tags and entities.
price2num($amount, $rounding='', $option=0)
Function that return a number with universal decimal format (decimal separator is '.
dol_eval($s, $returnvalue=1, $hideerrors=1, $onlysimplestring='1')
Replace eval function to add more security.
price($amount, $form=0, $outlangs='', $trunc=1, $rounding=-1, $forcerounding=-1, $currency_code='')
Function to format a value into an amount for visual output Function used into PDF and HTML pages.
getDolGlobalInt($key, $default=0)
Return a Dolibarr global constant int value.
if(!function_exists( 'dol_getprefix')) dol_include_once($relpath, $classname='')
Make an include_once using default root and alternate root if it fails.
showDimensionInBestUnit($dimension, $unit, $type, $outputlangs, $round=-1, $forceunitoutput='no', $use_short_label=0)
Output a dimension with best unit.
getImageFileNameForSize($file, $extName, $extImgTarget='')
Return the filename of file to get the thumbs.
dol_print_date($time, $format='', $tzoutput='auto', $outputlangs=null, $encodetooutput=false, $decorate=0)
Output date in a string format according to outputlangs (or langs if not defined).
get_exdir($num, $level, $alpha, $withoutslash, $object, $modulepart='')
Return a path to have a the directory according to object where files are stored.
pdf_writelinedesc(&$pdf, $object, $i, $outputlangs, $w, $h, $posx, $posy, $hideref=0, $hidedesc=0, $issupplierline=0, $align='J')
Output line description into PDF.
measuringUnitString($unitid, $measuring_style='', $unitscale=null, $use_short_label=0, $outputlangs=null)
Return translation label of a unit key.
if(getDolGlobalString( 'TAKEPOS_SHOW_CUSTOMER')) print $langs trans('Date')." left Label right Qty right Price right TotalHT right TotalTTC right right right right right right right right right centpercent right TotalHT right n right VAT right n right TotalVAT right n No sujeto a RE IRPF right TotalLT1 right n right TotalLT2 right n right TotalTTC right n takeposcustomercurrency takeposcustomercurrency takeposcustomercurrency takeposcustomercurrency right TotalTTC takeposcustomercurrency right takeposcustomercurrency n right PaymentTypeShortLIQ right SELECT p pos_change as p datep as date