59 public $errors = array();
69 public $extrafieldsCache;
74 public $update_main_doc_field;
104 public $page_largeur;
109 public $marge_gauche;
114 public $marge_droite;
129 public $corner_radius;
142 public $option_multilang;
146 public $option_freetext;
150 public $option_draft_watermark;
159 public $option_modereg;
163 public $option_condreg;
167 public $option_escompte;
171 public $option_credit_note;
198 public $tabTitleHeight;
203 public $defaultTitlesFieldsStyle;
208 public $defaultContentsFieldsStyle;
219 public $phpmin = array(7, 1);
278 public $posxdiscount;
282 public $posxworkload;
286 public $posxtimespent;
290 public $posxprogress;
294 public $atleastonephoto;
298 public $atleastoneratenotnull;
302 public $atleastonediscount;
326 global
$conf, $extrafields;
331 'myuser_lastname' => $user->lastname,
332 'myuser_firstname' => $user->firstname,
333 'myuser_fullname' => $user->getFullName($outputlangs, 1),
334 'myuser_login' => $user->login,
335 'myuser_phone' => $user->office_phone,
336 'myuser_address' => $user->address,
337 'myuser_zip' => $user->zip,
338 'myuser_town' => $user->town,
339 'myuser_country' => $user->country,
340 'myuser_country_code' => $user->country_code,
341 'myuser_state' => $user->state,
342 'myuser_state_code' => $user->state_code,
343 'myuser_fax' => $user->office_fax,
344 'myuser_mobile' => $user->user_mobile,
345 'myuser_email' => $user->email,
346 'myuser_logo' => $logotouse,
347 'myuser_job' => $user->job,
350 'myuser_dateemployment' =>
dol_print_date($user->dateemployment,
'day',
'tzuser'),
351 'myuser_dateemploymentend' =>
dol_print_date($user->dateemploymentend,
'day',
'tzuser'),
352 'myuser_gender' => $user->gender,
355 if (is_array($user->array_options) && count($user->array_options)) {
356 if (empty($extrafields->attributes[$user->table_element])) {
357 $extrafields->fetch_name_optionals_label($user->table_element);
374 global
$conf, $extrafields;
376 if ($member->photo) {
377 $logotouse =
$conf->member->dir_output.
'/'.
get_exdir(0, 0, 0, 1, $member,
'user').
'/photos/'.$member->photo;
379 $logotouse = DOL_DOCUMENT_ROOT.
'/public/theme/common/nophoto.png';
382 $array_member = array(
383 'mymember_lastname' => $member->lastname,
384 'mymember_firstname' => $member->firstname,
385 'mymember_fullname' => $member->getFullName($outputlangs, 1),
386 'mymember_login' => $member->login,
387 'mymember_address' => $member->address,
388 'mymember_zip' => $member->zip,
389 'mymember_town' => $member->town,
390 'mymember_country_code' => $member->country_code,
391 'mymember_country' => $member->country,
392 'mymember_state_code' => $member->state_code,
393 'mymember_state' => $member->state,
394 'mymember_phone_perso' => $member->phone_perso,
395 'mymember_phone_pro' => $member->phone,
396 'mymember_phone_mobile' => $member->phone_mobile,
397 'mymember_email' => $member->email,
398 'mymember_logo' => $logotouse,
399 'mymember_gender' => $member->gender,
400 'mymember_birth_locale' =>
dol_print_date($member->birth,
'day',
'tzuser', $outputlangs),
401 'mymember_birth' =>
dol_print_date($member->birth,
'day',
'tzuser'),
404 if (is_array($member->array_options) && count($member->array_options)) {
407 return $array_member;
424 if (empty($mysoc->forme_juridique) && !empty($mysoc->forme_juridique_code)) {
427 if (empty($mysoc->country) && !empty($mysoc->country_code)) {
428 $mysoc->country = $outputlangs->transnoentitiesnoconv(
"Country".$mysoc->country_code);
430 if (empty($mysoc->state) && !empty($mysoc->state_code)) {
431 $state_id =
dol_getIdFromCode($this->db, $mysoc->state_code,
'c_departements',
'code_departement',
'rowid');
432 $mysoc->state =
getState($state_id,
'0');
435 $logotouse =
$conf->mycompany->dir_output.
'/logos/thumbs/'.$mysoc->logo_small;
438 'mycompany_logo' => $logotouse,
439 'mycompany_name' => $mysoc->name,
440 'mycompany_email' => $mysoc->email,
441 'mycompany_phone' => $mysoc->phone,
442 'mycompany_fax' => $mysoc->fax,
443 'mycompany_address' => $mysoc->address,
444 'mycompany_zip' => $mysoc->zip,
445 'mycompany_town' => $mysoc->town,
446 'mycompany_country' => $mysoc->country,
447 'mycompany_country_code' => $mysoc->country_code,
448 'mycompany_state' => $mysoc->state,
449 'mycompany_state_code' => $mysoc->state_code,
450 'mycompany_web' => $mysoc->url,
451 'mycompany_juridicalstatus' => $mysoc->forme_juridique,
452 'mycompany_managers' => $mysoc->managers,
453 'mycompany_capital' => $mysoc->capital,
454 'mycompany_barcode' => $mysoc->barcode,
455 'mycompany_idprof1' => $mysoc->idprof1,
456 'mycompany_idprof2' => $mysoc->idprof2,
457 'mycompany_idprof3' => $mysoc->idprof3,
458 'mycompany_idprof4' => $mysoc->idprof4,
459 'mycompany_idprof5' => $mysoc->idprof5,
460 'mycompany_idprof6' => $mysoc->idprof6,
461 'mycompany_vatnumber' => $mysoc->tva_intra,
462 'mycompany_socialobject' => $mysoc->socialobject,
463 'mycompany_note_private' => $mysoc->note_private,
489 $object->country = $outputlangs->transnoentitiesnoconv(
"Country".
$object->country_code);
496 $array_thirdparty = array(
497 'company_name' =>
$object->name,
498 'company_name_alias' =>
$object->name_alias,
499 'company_email' =>
$object->email,
500 'company_phone' =>
$object->phone,
502 'company_address' =>
$object->address,
504 'company_town' =>
$object->town,
505 'company_country' =>
$object->country,
506 'company_country_code' =>
$object->country_code,
507 'company_state' =>
$object->state,
508 'company_state_code' =>
$object->state_code,
510 'company_barcode' =>
$object->barcode,
511 'company_vatnumber' =>
$object->tva_intra,
512 'company_customercode' =>
$object->code_client,
513 'company_suppliercode' =>
$object->code_fournisseur,
514 'company_customeraccountancycode' =>
$object->code_compta_client,
515 'company_supplieraccountancycode' =>
$object->code_compta_fournisseur,
516 'company_juridicalstatus' =>
$object->forme_juridique,
517 'company_outstanding_limit' =>
$object->outstanding_limit,
518 'company_capital' =>
$object->capital,
519 'company_capital_formated' =>
price(
$object->capital, 0,
'', 1, -1),
520 'company_idprof1' =>
$object->idprof1,
521 'company_idprof2' =>
$object->idprof2,
522 'company_idprof3' =>
$object->idprof3,
523 'company_idprof4' =>
$object->idprof4,
524 'company_idprof5' =>
$object->idprof5,
525 'company_idprof6' =>
$object->idprof6,
526 'company_note_public' =>
$object->note_public,
527 'company_note_private' =>
$object->note_private,
528 'company_default_bank_iban' => (is_object(
$object->bank_account) ?
$object->bank_account->iban :
''),
529 'company_default_bank_bic' => (is_object(
$object->bank_account) ?
$object->bank_account->bic :
'')
533 if (is_array(
$object->array_options) && count(
$object->array_options)) {
538 return $array_thirdparty;
553 global
$conf, $extrafields;
556 $object->country = $outputlangs->transnoentitiesnoconv(
"Country".
$object->country_code);
563 $array_contact = array(
564 $array_key.
'_fullname' =>
$object->getFullName($outputlangs, 1),
565 $array_key.
'_lastname' =>
$object->lastname,
566 $array_key.
'_firstname' =>
$object->firstname,
567 $array_key.
'_address' =>
$object->address,
568 $array_key.
'_zip' =>
$object->zip,
569 $array_key.
'_town' =>
$object->town,
570 $array_key.
'_state_id' =>
$object->state_id,
571 $array_key.
'_state_code' =>
$object->state_code,
572 $array_key.
'_state' =>
$object->state,
573 $array_key.
'_country_id' =>
$object->country_id,
574 $array_key.
'_country_code' =>
$object->country_code,
575 $array_key.
'_country' =>
$object->country,
576 $array_key.
'_poste' =>
$object->poste,
577 $array_key.
'_socid' =>
$object->socid,
578 $array_key.
'_statut' =>
$object->statut,
579 $array_key.
'_code' =>
$object->code,
580 $array_key.
'_email' =>
$object->email,
581 $array_key.
'_phone_pro' =>
$object->phone_pro,
582 $array_key.
'_phone_perso' =>
$object->phone_perso,
583 $array_key.
'_phone_mobile' =>
$object->phone_mobile,
584 $array_key.
'_fax' =>
$object->fax,
585 $array_key.
'_birthday' =>
$object->birthday,
586 $array_key.
'_default_lang' =>
$object->default_lang,
587 $array_key.
'_note_public' =>
$object->note_public,
588 $array_key.
'_note_private' =>
$object->note_private,
589 $array_key.
'_civility' =>
$object->civility,
593 if (is_array(
$object->array_options) && count(
$object->array_options)) {
598 return $array_contact;
615 $array_other = array(
620 'current_server_datehour' =>
dol_print_date($now,
'dayhour',
'tzserver'),
622 'current_date_locale' =>
dol_print_date($now,
'day',
'tzuser', $outputlangs),
623 'current_datehour_locale' =>
dol_print_date($now,
'dayhour',
'tzuser', $outputlangs),
624 'current_server_date_locale' =>
dol_print_date($now,
'day',
'tzserver', $outputlangs),
625 'current_server_datehour_locale' =>
dol_print_date($now,
'dayhour',
'tzserver', $outputlangs),
629 foreach (
$conf->global as $key => $val) {
631 $newval =
'*****forbidden*****';
635 $array_other[
'__['.$key.
']__'] = $newval;
652 public function get_substitutionarray_object(
$object, $outputlangs, $array_key =
'object')
657 $sumpayed = $sumdeposit = $sumcreditnote =
'';
658 $already_payed_all = 0;
660 if (
$object->element ==
'facture') {
662 '@phan-var-force Facture $object';
663 $invoice_source =
new Facture($this->db);
664 if (
$object->fk_facture_source > 0) {
665 $invoice_source->fetch(
$object->fk_facture_source);
667 $sumpayed =
$object->getSommePaiement();
668 $sumdeposit =
$object->getSumDepositsUsed();
669 $sumcreditnote =
$object->getSumCreditNotesUsed();
670 $already_payed_all = $sumpayed + $sumdeposit + $sumcreditnote;
681 $array_key.
'_id' =>
$object->id,
682 $array_key.
'_ref' => (property_exists(
$object,
'ref') ?
$object->ref :
''),
683 $array_key.
'_label' => (property_exists(
$object,
'label') ?
$object->label :
''),
684 $array_key.
'_ref_ext' => (property_exists(
$object,
'ref_ext') ?
$object->ref_ext :
''),
685 $array_key.
'_ref_customer' => (!empty(
$object->ref_client) ?
$object->ref_client : (empty(
$object->ref_customer) ?
'' :
$object->ref_customer)),
686 $array_key.
'_ref_supplier' => (!empty(
$object->ref_fournisseur) ?
$object->ref_fournisseur : (empty(
$object->ref_supplier) ?
'' :
$object->ref_supplier)),
687 $array_key.
'_source_invoice_ref' => ((empty($invoice_source) || empty($invoice_source->
ref)) ?
'' : $invoice_source->
ref),
702 $array_key.
'_payment_mode_code' =>
$object->mode_reglement_code,
703 $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),
704 $array_key.
'_payment_term_code' =>
$object->cond_reglement_code,
705 $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)),
709 $array_key.
'_total_ht_locale' =>
price(
$object->total_ht, 0, $outputlangs),
710 $array_key.
'_total_vat_locale' => (!empty(
$object->total_vat) ?
price(
$object->total_vat, 0, $outputlangs) :
price(
$object->total_tva, 0, $outputlangs)),
711 $array_key.
'_total_localtax1_locale' =>
price(
$object->total_localtax1, 0, $outputlangs),
712 $array_key.
'_total_localtax2_locale' =>
price(
$object->total_localtax2, 0, $outputlangs),
713 $array_key.
'_total_ttc_locale' =>
price(
$object->total_ttc, 0, $outputlangs),
721 $array_key.
'_multicurrency_code' =>
$object->multicurrency_code,
723 $array_key.
'_multicurrency_total_ht' =>
price2num(
$object->multicurrency_total_ht),
724 $array_key.
'_multicurrency_total_tva' =>
price2num(
$object->multicurrency_total_tva),
725 $array_key.
'_multicurrency_total_ttc' =>
price2num(
$object->multicurrency_total_ttc),
726 $array_key.
'_multicurrency_total_ht_locale' =>
price(
$object->multicurrency_total_ht, 0, $outputlangs),
727 $array_key.
'_multicurrency_total_tva_locale' =>
price(
$object->multicurrency_total_tva, 0, $outputlangs),
728 $array_key.
'_multicurrency_total_ttc_locale' =>
price(
$object->multicurrency_total_ttc, 0, $outputlangs),
730 $array_key.
'_note_private' =>
$object->note_private,
731 $array_key.
'_note_public' =>
$object->note_public,
732 $array_key.
'_note' =>
$object->note_public,
735 $array_key.
'_already_payed_locale' =>
price($sumpayed, 0, $outputlangs),
736 $array_key.
'_already_payed' =>
price2num($sumpayed),
737 $array_key.
'_already_deposit_locale' =>
price($sumdeposit, 0, $outputlangs),
738 $array_key.
'_already_deposit' =>
price2num($sumdeposit),
739 $array_key.
'_already_creditnote_locale' =>
price($sumcreditnote, 0, $outputlangs),
740 $array_key.
'_already_creditnote' =>
price2num($sumcreditnote),
742 $array_key.
'_already_payed_all_locale' =>
price(
price2num($already_payed_all,
'MT'), 0, $outputlangs),
743 $array_key.
'_already_payed_all' =>
price2num($already_payed_all,
'MT'),
746 $array_key.
'_remain_to_pay_locale' =>
price(
price2num(
$object->total_ttc - $already_payed_all,
'MT'), 0, $outputlangs),
747 $array_key.
'_remain_to_pay' =>
price2num(
$object->total_ttc - $already_payed_all,
'MT')
750 if (in_array(
$object->element, array(
'facture',
'invoice',
'supplier_invoice',
'facture_fournisseur'))) {
751 $bank_account =
null;
753 if (property_exists(
$object,
'fk_account') &&
$object->fk_account > 0) {
754 require_once DOL_DOCUMENT_ROOT.
'/compta/bank/class/account.class.php';
755 $bank_account =
new Account($this->db);
756 $bank_account->fetch(
$object->fk_account);
759 $resarray[$array_key.
'_bank_iban'] = (empty($bank_account) ?
'' : $bank_account->iban);
760 $resarray[$array_key.
'_bank_bic'] = (empty($bank_account) ?
'' : $bank_account->bic);
761 $resarray[$array_key.
'_bank_label'] = (empty($bank_account) ?
'' : $bank_account->label);
762 $resarray[$array_key.
'_bank_number'] = (empty($bank_account) ?
'' : $bank_account->number);
763 $resarray[$array_key.
'_bank_proprio'] = (empty($bank_account) ?
'' : $bank_account->owner_name);
764 $resarray[$array_key.
'_bank_address'] = (empty($bank_account) ?
'' : $bank_account->address);
765 $resarray[$array_key.
'_bank_state'] = (empty($bank_account) ?
'' : $bank_account->state);
766 $resarray[$array_key.
'_bank_country'] = (empty($bank_account) ?
'' : $bank_account->country);
769 if (method_exists(
$object,
'getTotalDiscount') && in_array(get_class(
$object), array(
'Propal',
'Proposal',
'Commande',
'Facture',
'SupplierProposal',
'CommandeFournisseur',
'FactureFournisseur'))) {
770 $resarray[$array_key.
'_total_discount_ht_locale'] =
price(
$object->getTotalDiscount(), 0, $outputlangs);
771 $resarray[$array_key.
'_total_discount_ht'] =
price2num(
$object->getTotalDiscount());
773 $resarray[$array_key.
'_total_discount_ht_locale'] =
'';
774 $resarray[$array_key.
'_total_discount_ht'] =
'';
779 if (!is_object(
$object->project)) {
783 $resarray[$array_key.
'_project_ref'] =
$object->project->ref;
784 $resarray[$array_key.
'_project_title'] =
$object->project->title;
785 $resarray[$array_key.
'_project_description'] =
$object->project->description;
789 $resarray[$array_key.
'_project_ref'] =
'';
790 $resarray[$array_key.
'_project_title'] =
'';
791 $resarray[$array_key.
'_project_description'] =
'';
792 $resarray[$array_key.
'_project_date_start'] =
'';
793 $resarray[$array_key.
'_project_date_end'] =
'';
800 foreach (
$object->lines as $line) {
802 if (empty($resarray[$array_key.
'_total_vat_'.$line->tva_tx])) {
803 $resarray[$array_key.
'_total_vat_'.$line->tva_tx] = 0;
805 $resarray[$array_key.
'_total_vat_'.$line->tva_tx] += $line->total_tva;
806 $resarray[$array_key.
'_total_vat_locale_'.$line->tva_tx] =
price($resarray[$array_key.
'_total_vat_'.$line->tva_tx]);
808 $vatformated =
vatrate($line->tva_tx);
809 if (empty($resarray[$array_key.
'_total_vat_'.$vatformated])) {
810 $resarray[$array_key.
'_total_vat_'.$vatformated] = 0;
812 $resarray[$array_key.
'_total_vat_'.$vatformated] += $line->total_tva;
813 $resarray[$array_key.
'_total_vat_locale_'.$vatformated] =
price($resarray[$array_key.
'_total_vat_'.$vatformated]);
815 $totalUp += $line->subprice * $line->qty;
820 $resarray[
'object_total_up'] = $totalUp;
821 $resarray[
'object_total_up_locale'] =
price($resarray[
'object_total_up'], 0, $outputlangs);
822 if (method_exists(
$object,
'getTotalDiscount') && in_array(get_class(
$object), array(
'Propal',
'Proposal',
'Commande',
'Facture',
'SupplierProposal',
'CommandeFournisseur',
'FactureFournisseur'))) {
823 $totalDiscount =
$object->getTotalDiscount();
827 if (!empty($totalUp) && !empty($totalDiscount)) {
828 $resarray[
'object_total_discount'] = round(100 / $totalUp * $totalDiscount, 2);
829 $resarray[
'object_total_discount_locale'] =
price($resarray[
'object_total_discount'], 0, $outputlangs);
831 $resarray[
'object_total_discount'] =
'';
832 $resarray[
'object_total_discount_locale'] =
'';
837 if (is_array(
$object->array_options) && count(
$object->array_options)) {
860 'line_pos' => $linenumber,
863 'line_product_ref' => (empty($line->product_ref) ?
'' : $line->product_ref),
864 'line_product_label' => (empty($line->product_label) ?
'' : $line->product_label),
865 'line_product_type' => (empty($line->product_type) ?
'' : $line->product_type),
866 'line_product_barcode' => (empty($line->product_barcode) ?
'' : $line->product_barcode),
867 'line_product_desc' => (empty($line->product_desc) ?
'' : $line->product_desc),
869 'line_desc' => $line->desc,
870 'line_vatrate' =>
vatrate($line->tva_tx,
true, $line->info_bits),
872 'line_up_locale' =>
price($line->subprice, 0, $outputlangs),
873 'line_total_up' =>
price2num($line->subprice * (
float) $line->qty),
874 'line_total_up_locale' =>
price($line->subprice * (
float) $line->qty, 0, $outputlangs),
875 'line_qty' => $line->qty,
876 'line_discount_percent' => ($line->remise_percent ? $line->remise_percent.
'%' :
''),
877 'line_price_ht' =>
price2num($line->total_ht),
878 'line_price_ttc' =>
price2num($line->total_ttc),
879 'line_price_vat' =>
price2num($line->total_tva),
880 'line_price_ht_locale' =>
price($line->total_ht, 0, $outputlangs),
881 'line_price_ttc_locale' =>
price($line->total_ttc, 0, $outputlangs),
882 'line_price_vat_locale' =>
price($line->total_tva, 0, $outputlangs),
884 'line_multicurrency_code' =>
price2num($line->multicurrency_code),
885 'line_multicurrency_subprice' =>
price2num($line->multicurrency_subprice),
886 'line_multicurrency_total_ht' =>
price2num($line->multicurrency_total_ht),
887 'line_multicurrency_total_tva' =>
price2num($line->multicurrency_total_tva),
888 'line_multicurrency_total_ttc' =>
price2num($line->multicurrency_total_ttc),
889 'line_multicurrency_subprice_locale' =>
price($line->multicurrency_subprice, 0, $outputlangs),
890 'line_multicurrency_total_ht_locale' =>
price($line->multicurrency_total_ht, 0, $outputlangs),
891 'line_multicurrency_total_tva_locale' =>
price($line->multicurrency_total_tva, 0, $outputlangs),
892 'line_multicurrency_total_ttc_locale' =>
price($line->multicurrency_total_ttc, 0, $outputlangs),
895 if (property_exists($line,
'ref_fourn')) {
896 $resarray[
'line_product_ref_fourn'] = $line->ref_fourn;
898 $resarray[
'line_product_ref_fourn'] =
'';
901 'line_localtax1_rate' =>
'localtax1_tx',
902 'line_localtax2_rate' =>
'localtax2_tx',
904 foreach ($vat_specs as $vat_spec) {
905 if (property_exists($line, $vat_spec[1])) {
906 $resarray[$vat_spec[0]] =
vatrate($line->${$vat_spec[1]});
912 array(
'line_date_start',
'date_start',
'day',
'auto',
null),
913 array(
'line_date_start_locale',
'date_start',
'day',
'tzserver', $outputlangs),
914 array(
'line_date_start_rfc',
'date_start',
'dayrfc',
'auto',
null),
915 array(
'line_date_start_real',
'date_start_real',
'day',
'auto',
null),
916 array(
'line_date_start_real_locale',
'date_start_real',
'day',
'tzserver', $outputlangs),
917 array(
'line_date_start_real_rfc',
'date_start_real',
'dayrfc',
'auto',
null),
918 array(
'line_date_end',
'date_end',
'day',
'auto',
null),
919 array(
'line_date_end_locale',
'date_end',
'day',
'tzserver', $outputlangs),
920 array(
'line_date_end_rfc',
'date_end',
'dayrfc',
'auto',
null)
922 foreach ($date_specs as $date_spec) {
923 if (property_exists($line, $date_spec[1])) {
924 $resarray[$date_spec[0]] =
dol_print_date($line->${$date_spec[1]}, $date_spec[2], $date_spec[3], $date_spec[4]);
930 $resarray[
'line_unit'] = $outputlangs->trans($line->getLabelOfUnit(
'long'));
931 $resarray[
'line_unit_short'] = $outputlangs->trans($line->getLabelOfUnit(
'short'));
935 $extrafieldkey = $line->table_element;
937 require_once DOL_DOCUMENT_ROOT.
'/core/class/extrafields.class.php';
939 $extrafields->fetch_name_optionals_label($extrafieldkey,
true);
940 $line->fetch_optionals();
945 if (get_class($line) ==
'CommandeFournisseurLigne') {
947 $extrafields->fetch_name_optionals_label(
"product_fournisseur_price");
948 $extralabels = $extrafields->attributes[
"product_fournisseur_price"][
'label'];
950 if (!empty($extralabels) && is_array($extralabels)) {
953 foreach ($extralabels as $key => $label) {
954 $columns .=
"$key, ";
957 if ($columns !=
"") {
958 $columns = substr($columns, 0, strlen($columns) - 2);
959 $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).
"'");
961 if ($this->db->num_rows($resql) > 0) {
962 $resql = $this->db->fetch_object($resql);
964 foreach ($extralabels as $key => $label) {
965 $resarray[
'line_product_supplier_'.$key] = $resql->$key;
973 if (isset($line->fk_product) && $line->fk_product > 0) {
974 $tmpproduct =
new Product($this->db);
975 $result = $tmpproduct->fetch($line->fk_product);
976 if (!empty($tmpproduct->array_options) && is_array($tmpproduct->array_options)) {
977 foreach ($tmpproduct->array_options as $key => $label) {
978 $resarray[
"line_product_".$key] = $label;
983 $extrafields->fetch_name_optionals_label(
"product");
984 if ($extrafields->attributes[
"product"][
'count'] > 0) {
985 $extralabels = $extrafields->attributes[
"product"][
'label'];
987 foreach ($extralabels as $key => $label) {
988 $resarray[
'line_product_options_'.$key] =
'';
1009 global $extrafields;
1011 include_once DOL_DOCUMENT_ROOT.
'/core/lib/product.lib.php';
1014 $calculatedVolume = ((float)
$object->trueWidth * (
float)
$object->trueHeight * (float)
$object->trueDepth);
1016 $array_shipment = array(
1017 $array_key.
'_id' =>
$object->id,
1018 $array_key.
'_ref' =>
$object->ref,
1019 $array_key.
'_ref_ext' =>
$object->ref_ext,
1020 $array_key.
'_ref_customer' =>
$object->ref_customer,
1027 $array_key.
'_total_discount_ht' =>
price(
$object->getTotalDiscount()),
1028 $array_key.
'_note_private' =>
$object->note_private,
1029 $array_key.
'_note' =>
$object->note_public,
1030 $array_key.
'_tracking_number' =>
$object->tracking_number,
1031 $array_key.
'_tracking_url' =>
$object->tracking_url,
1032 $array_key.
'_shipping_method' =>
$object->listmeths[0][
'libelle'],
1041 foreach (
$object->lines as $line) {
1042 if (empty($array_shipment[$array_key.
'_total_vat_'.$line->tva_tx])) {
1043 $array_shipment[$array_key.
'_total_vat_'.$line->tva_tx] = 0;
1045 $array_shipment[$array_key.
'_total_vat_'.$line->tva_tx] += $line->total_tva;
1049 if (is_array(
$object->array_options) && count(
$object->array_options)) {
1056 if (is_object(
$object->commande) && !empty(
$object->commande->ref)) {
1057 $array_shipment[
'order_ref'] =
$object->commande->ref;
1058 $array_shipment[
'order_ref_customer'] =
$object->commande->ref_customer;
1061 return $array_shipment;
1077 $array_other = array();
1079 foreach (
$object as $key => $value) {
1080 if (in_array($key, array(
'db',
'fields',
'lines',
'modelpdf',
'model_pdf'))) {
1083 if (!empty($value)) {
1084 if (!is_array($value) && !is_object($value)) {
1085 $array_other[
'object_'.$key] = $value;
1086 } elseif (is_array($value) && $recursive) {
1088 if (!empty($tmparray) && is_array($tmparray)) {
1089 foreach ($tmparray as $key2 => $value2) {
1090 $array_other[
'object_'.$key.
'_'.preg_replace(
'/^object_/',
'', $key2)] = $value2;
1093 } elseif (is_object($value) && $recursive) {
1095 if (!empty($tmparray) && is_array($tmparray)) {
1096 foreach ($tmparray as $key2 => $value2) {
1097 $array_other[
'object_'.$key.
'_'.preg_replace(
'/^object_/',
'', $key2)] = $value2;
1105 return $array_other;
1126 if ($extrafields->attributes[
$object->table_element][
'count'] > 0) {
1127 foreach ($extrafields->attributes[
$object->table_element][
'label'] as $key => $label) {
1128 $formatedarrayoption =
$object->array_options;
1130 if ($extrafields->attributes[
$object->table_element][
'type'][$key] ==
'price') {
1131 $formatedarrayoption[
'options_'.$key] =
price2num($formatedarrayoption[
'options_'.$key]);
1132 $formatedarrayoption[
'options_'.$key.
'_currency'] =
price($formatedarrayoption[
'options_'.$key], 0, $outputlangs, 0, 0, -1,
$conf->currency);
1134 $array_to_fill = array_merge($array_to_fill, array($array_key.
'_options_'.$key.
'_currency' => $formatedarrayoption[
'options_'.$key.
'_currency']));
1135 } elseif ($extrafields->attributes[
$object->table_element][
'type'][$key] ==
'select') {
1136 $valueofselectkey = $formatedarrayoption[
'options_'.$key];
1137 if (array_key_exists($valueofselectkey, $extrafields->attributes[
$object->table_element][
'param'][$key][
'options'])) {
1138 $formatedarrayoption[
'options_'.$key] = $extrafields->attributes[
$object->table_element][
'param'][$key][
'options'][$valueofselectkey];
1140 $formatedarrayoption[
'options_'.$key] =
'';
1142 } elseif ($extrafields->attributes[
$object->table_element][
'type'][$key] ==
'checkbox') {
1143 $valArray = explode(
',', $formatedarrayoption[
'options_'.$key]);
1145 foreach ($extrafields->attributes[
$object->table_element][
'param'][$key][
'options'] as $keyopt => $valopt) {
1146 if (in_array($keyopt, $valArray)) {
1147 $output[] = $valopt;
1150 $formatedarrayoption[
'options_'.$key] = implode(
', ', $output);
1151 } elseif ($extrafields->attributes[
$object->table_element][
'type'][$key] ==
'date') {
1152 if (strlen($formatedarrayoption[
'options_'.$key]) > 0) {
1153 $date = $formatedarrayoption[
'options_'.$key];
1154 $formatedarrayoption[
'options_'.$key] =
dol_print_date($date,
'day');
1155 $formatedarrayoption[
'options_'.$key.
'_locale'] =
dol_print_date($date,
'day',
'tzserver', $outputlangs);
1156 $formatedarrayoption[
'options_'.$key.
'_rfc'] =
dol_print_date($date,
'dayrfc');
1158 $formatedarrayoption[
'options_'.$key] =
'';
1159 $formatedarrayoption[
'options_'.$key.
'_locale'] =
'';
1160 $formatedarrayoption[
'options_'.$key.
'_rfc'] =
'';
1162 $array_to_fill = array_merge($array_to_fill, array($array_key.
'_options_'.$key.
'_locale' => $formatedarrayoption[
'options_'.$key.
'_locale']));
1163 $array_to_fill = array_merge($array_to_fill, array($array_key.
'_options_'.$key.
'_rfc' => $formatedarrayoption[
'options_'.$key.
'_rfc']));
1164 } elseif ($extrafields->attributes[
$object->table_element][
'type'][$key] ==
'datetime') {
1165 $datetime = $formatedarrayoption[
'options_'.$key];
1166 $formatedarrayoption[
'options_'.$key] = ($datetime !=
"0000-00-00 00:00:00" ?
dol_print_date($datetime,
'dayhour') :
'');
1167 $formatedarrayoption[
'options_'.$key.
'_locale'] = ($datetime !=
"0000-00-00 00:00:00" ?
dol_print_date($datetime,
'dayhour',
'tzserver', $outputlangs) :
'');
1168 $formatedarrayoption[
'options_'.$key.
'_rfc'] = ($datetime !=
"0000-00-00 00:00:00" ?
dol_print_date($datetime,
'dayhourrfc') :
'');
1169 $array_to_fill = array_merge($array_to_fill, array($array_key.
'_options_'.$key.
'_locale' => $formatedarrayoption[
'options_'.$key.
'_locale']));
1170 $array_to_fill = array_merge($array_to_fill, array($array_key.
'_options_'.$key.
'_rfc' => $formatedarrayoption[
'options_'.$key.
'_rfc']));
1171 } elseif ($extrafields->attributes[
$object->table_element][
'type'][$key] ==
'link') {
1172 $id = $formatedarrayoption[
'options_'.$key];
1174 $param = $extrafields->attributes[
$object->table_element][
'param'][$key];
1175 $param_list = array_keys($param[
'options']);
1176 $InfoFieldList = explode(
":", $param_list[0]);
1177 $classname = $InfoFieldList[0];
1178 $classpath = $InfoFieldList[1];
1179 if (!empty($classpath)) {
1181 if ($classname && class_exists($classname)) {
1182 $tmpobject =
new $classname($this->db);
1183 '@phan-var-force CommonObject $tmpobject';
1184 $tmpobject->fetch(
$id);
1186 $formatedarrayoption[
'options_'.$key] = $tmpobject->name;
1192 if (array_key_exists(
'options_'.$key, $formatedarrayoption)) {
1193 $array_to_fill = array_merge($array_to_fill, array($array_key.
'_options_'.$key => $formatedarrayoption[
'options_'.$key]));
1195 $array_to_fill = array_merge($array_to_fill, array($array_key.
'_options_'.$key =>
''));
1200 return $array_to_fill;
1216 public function printRect($pdf, $x, $y, $l, $h, $hidetop = 0, $hidebottom = 0)
1218 if (empty($hidetop) || $hidetop == -1) {
1219 $pdf->line($x, $y, $x + $l, $y);
1221 $pdf->line($x + $l, $y, $x + $l, $y + $h);
1222 if (empty($hidebottom)) {
1223 $pdf->line($x + $l, $y + $h, $x, $y + $h);
1225 $pdf->line($x, $y + $h, $x, $y);
1242 public function printRoundedRect($pdf, $x, $y, $w, $h, $r, $hidetop = 0, $hidebottom = 0, $style =
'D')
1245 if (empty($hidetop) || $hidetop == -1) {
1246 $pdf->RoundedRect($x, $y, $w, $h, $r,
'1111', $style);
1249 $pdf->RoundedRect($x, $y, $w, $h, $r,
'0111', $style);
1251 if (!empty($hidebottom)) {
1252 $pdf->RoundedRect($x, $y, $w, $h, $r,
'1101', $style);
1265 if (empty($a[
'rank'])) {
1268 if (empty($b[
'rank'])) {
1271 if ($a[
'rank'] == $b[
'rank']) {
1274 return ($a[
'rank'] > $b[
'rank']) ? -1 : 1;
1293 uasort($this->cols, array($this,
'columnSort'));
1296 $curX = $this->page_largeur - $this->marge_droite;
1299 $arrayWidth = $this->page_largeur - $this->marge_droite - $this->marge_gauche;
1302 $totalDefinedColWidth = 0;
1304 foreach ($this->cols as $colKey => & $colDef) {
1309 if (!empty($colDef[
'scale'])) {
1311 $colDef[
'width'] = abs($arrayWidth * $colDef[
'scale'] / 100);
1314 if (empty($colDef[
'width'])) {
1317 $totalDefinedColWidth += $colDef[
'width'];
1321 foreach ($this->cols as $colKey => & $colDef) {
1323 if (!empty($colDef[
'title'])) {
1324 $colDef[
'title'] = array_replace($this->defaultTitlesFieldsStyle, $colDef[
'title']);
1326 $colDef[
'title'] = $this->defaultTitlesFieldsStyle;
1330 if (!empty($colDef[
'content'])) {
1331 $colDef[
'content'] = array_replace($this->defaultContentsFieldsStyle, $colDef[
'content']);
1333 $colDef[
'content'] = $this->defaultContentsFieldsStyle;
1338 if (empty($colDef[
'width'])) {
1339 $colDef[
'width'] = abs(($arrayWidth - $totalDefinedColWidth)) / $countFlexCol;
1344 $curX = $lastX - $colDef[
'width'];
1345 $colDef[
'xStartPos'] = $curX;
1346 $colDef[
'xEndPos'] = $lastX;
1359 $colDef = $this->cols[$colKey];
1360 return $colDef[
'width'] - $colDef[
'content'][
'padding'][3] - $colDef[
'content'][
'padding'][1];
1372 $colDef = (isset($this->cols[$colKey]) ? $this->cols[$colKey] :
null);
1373 return (is_array($colDef) ? ((isset($colDef[
'xStartPos']) ? $colDef[
'xStartPos'] : 0) + $colDef[
'content'][
'padding'][3]) : 0);
1384 if (!isset($this->cols[$colKey][
'rank'])) {
1387 return $this->cols[$colKey][
'rank'];
1405 if (!empty($targetCol)) {
1407 if ($rank >= 0 && $insertAfterTarget) {
1413 if ($rank < 0 && !empty($defArray[
'rank'])) {
1414 $rank = $defArray[
'rank'];
1422 foreach ($this->cols as $colKey => & $colDef) {
1423 if ($rank <= $colDef[
'rank']) {
1424 $colDef[
'rank'] += 1;
1428 $defArray[
'rank'] = $rank;
1429 $this->cols[$newColKey] = $defArray;
1446 global $hookmanager;
1448 $parameters = array(
1450 'columnText' => $columnText,
1451 'colKey' => $colKey,
1454 $reshook = $hookmanager->executeHooks(
'printStdColumnContent', $parameters, $this);
1459 if (empty($columnText)) {
1463 $colDef = $this->cols[$colKey];
1465 $curentCellPaddinds = $pdf->getCellPaddings();
1467 $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);
1468 $pdf->writeHTMLCell($colDef[
'width'], 2, isset($colDef[
'xStartPos']) ? $colDef[
'xStartPos'] : 0, $curY, $columnText, 0, 1, 0,
true, $colDef[
'content'][
'align']);
1471 $pdf->setCellPaddings($curentCellPaddinds[
'L'], $curentCellPaddinds[
'T'], $curentCellPaddinds[
'R'], $curentCellPaddinds[
'B']);
1495 $colDef = $this->cols[$colKey];
1497 $curentCellPaddinds = $pdf->getCellPaddings();
1499 $pdf->setCellPaddings($colDef[
'content'][
'padding'][3], $colDef[
'content'][
'padding'][0], $colDef[
'content'][
'padding'][1], $colDef[
'content'][
'padding'][2]);
1502 pdf_writelinedesc($pdf,
$object, $i, $outputlangs, $colDef[
'width'], 3, $colDef[
'xStartPos'], $curY, $hideref, $hidedesc, $issupplierline, empty($colDef[
'content'][
'align']) ?
'J' : $colDef[
'content'][
'align']);
1503 $posYAfterDescription = $pdf->GetY() - $colDef[
'content'][
'padding'][0];
1506 $pdf->setCellPaddings($curentCellPaddinds[
'L'], $curentCellPaddinds[
'T'], $curentCellPaddinds[
'R'], $curentCellPaddinds[
'B']);
1510 'display' =>
'list',
1511 'printableEnable' => array(3),
1512 'printableEnableNotEmpty' => array(4)
1514 $extrafieldDesc = $this->getExtrafieldsInHtml(
$object->lines[$i], $outputlangs, $params);
1515 if (!empty($extrafieldDesc)) {
1531 global $hookmanager;
1533 if (empty(
$object->table_element)) {
1537 $extrafieldsKeyPrefix =
"options_";
1540 $pos = strpos($extrafieldKey, $extrafieldsKeyPrefix);
1542 $extrafieldKey = substr($extrafieldKey, strlen($extrafieldsKeyPrefix));
1545 $extrafieldOptionsKey = $extrafieldsKeyPrefix.$extrafieldKey;
1549 if (is_null($this->extrafieldsCache)) {
1550 $this->extrafieldsCache =
new ExtraFields($this->db);
1552 if (empty($this->extrafieldsCache->attributes[
$object->table_element])) {
1553 $this->extrafieldsCache->fetch_name_optionals_label(
$object->table_element);
1555 $extrafields = $this->extrafieldsCache;
1557 $extrafieldOutputContent =
'';
1558 if (isset(
$object->array_options[$extrafieldOptionsKey])) {
1559 $extrafieldOutputContent = $extrafields->showOutputField($extrafieldKey,
$object->array_options[$extrafieldOptionsKey],
'',
$object->table_element, $outputlangs);
1563 if ($extrafields->attributes[
$object->table_element][
'type'][$extrafieldKey] ==
'link') {
1569 if ($extrafields->attributes[
$object->table_element][
'type'][$extrafieldKey] ==
'stars') {
1570 $extrafieldOutputContent =
'';
1571 for ($i = 0; $i <
$object->array_options[$extrafieldOptionsKey]; $i++) {
1572 $extrafieldOutputContent .=
' *';
1576 $parameters = array(
1578 'extrafields' => $extrafields,
1579 'extrafieldKey' => $extrafieldKey,
1580 'extrafieldOutputContent' => & $extrafieldOutputContent
1582 $reshook = $hookmanager->executeHooks(
'getPDFExtrafieldContent', $parameters, $this);
1587 $extrafieldOutputContent = $hookmanager->resPrint;
1590 return $extrafieldOutputContent;
1602 public function getExtrafieldsInHtml(
$object, $outputlangs, $params = array())
1604 global $hookmanager;
1606 if (empty(
$object->table_element)) {
1611 if (is_null($this->extrafieldsCache)) {
1612 $this->extrafieldsCache =
new ExtraFields($this->db);
1614 if (empty($this->extrafieldsCache->attributes[
$object->table_element])) {
1615 $this->extrafieldsCache->fetch_name_optionals_label(
$object->table_element);
1617 $extrafields = $this->extrafieldsCache;
1619 $defaultParams = array(
1621 'display' =>
'auto',
1622 'printableEnable' => array(1),
1623 'printableEnableNotEmpty' => array(2),
1626 'maxItemsInRow' => 2,
1630 'labelcolwidth' =>
'25%',
1631 'arrayOfLineBreakType' => array(
'text',
'html')
1635 'separator' =>
'<br>'
1644 $params += $defaultParams;
1653 if (!empty($extrafields->attributes[
$object->table_element][
'label']) && is_array($extrafields->attributes[
$object->table_element][
'label'])) {
1654 foreach ($extrafields->attributes[
$object->table_element][
'label'] as $key => $label) {
1657 $disableOnEmpty = 0;
1658 if (!empty($extrafields->attributes[
$object->table_element][
'printable'][$key])) {
1659 $printable = intval($extrafields->attributes[
$object->table_element][
'printable'][$key]);
1660 if (in_array($printable, $params[
'printableEnable']) || in_array($printable, $params[
'printableEnableNotEmpty'])) {
1664 if (in_array($printable, $params[
'printableEnableNotEmpty'])) {
1665 $disableOnEmpty = 1;
1669 if (empty($enabled)) {
1674 if (!empty($extrafields->attributes[
$object->table_element][
'langfile'][$key])) {
1675 $outputlangs->load($extrafields->attributes[
$object->table_element][
'langfile'][$key]);
1679 $field->rank = intval($extrafields->attributes[
$object->table_element][
'pos'][$key]);
1681 if (isset($extrafields->attributes[
$object->table_element][
'langfile'][$key])) {
1682 $outputlangs->load($extrafields->attributes[
$object->table_element][
'langfile'][$key]);
1684 $field->label = $outputlangs->transnoentities($label);
1685 $field->type = $extrafields->attributes[
$object->table_element][
'type'][$key];
1688 if ($disableOnEmpty && empty($field->content)) {
1696 if (!empty($fields)) {
1705 static function ($a, $b) {
1706 return ($a->rank > $b->rank) ? 1 : -1;
1711 $html .= !empty($params[
'style']) ?
'<style>'.$params[
'style'].
'</style>' :
'';
1714 if ($params[
'display'] ==
'auto') {
1715 $lastNnumbItems = 0;
1716 foreach ($params[
'auto'] as $display => $numbItems) {
1717 if ($lastNnumbItems <= $numbItems && count($fields) > $numbItems) {
1718 $lastNnumbItems = $numbItems;
1719 $params[
'display'] = $display;
1724 if ($params[
'display'] ==
'list') {
1727 foreach ($fields as $field) {
1728 $html .= !empty($i) ? $params[
'list'][
'separator'] :
'';
1729 $html .=
'<strong>'.$field->label.
' : </strong>';
1730 $html .= $field->content;
1733 } elseif ($params[
'display'] ==
'table') {
1735 $html .=
'<table class="extrafield-table" cellspacing="'.$params[
'table'][
'cellspacing'].
'" cellpadding="'.$params[
'table'][
'cellpadding'].
'" border="'.$params[
'table'][
'border'].
'">';
1739 $maxItemsInRow = $params[
'table'][
'maxItemsInRow'];
1740 foreach ($fields as $field) {
1742 if ($itemsInRow >= $maxItemsInRow) {
1744 $html .=
"</tr><tr>";
1749 if (in_array($field->type, $params[
'table'][
'arrayOfLineBreakType'])) {
1750 if ($itemsInRow > 0) {
1752 for ($i = $itemsInRow; $i <= $maxItemsInRow; $i++) {
1753 $html .=
"<td></td><td></td>";
1761 $itemsInRow = $maxItemsInRow;
1762 $html .=
'<td colspan="'.($maxItemsInRow * 2 - 1).
'">';
1763 $html .=
'<strong>'.$field->label.
' :</strong> ';
1764 $html .= $field->content;
1768 $html .=
'<td width="'.$params[
'table'][
'labelcolwidth'].
'" class="extrafield-label">';
1769 $html .=
'<strong>'.$field->label.
' :</strong>';
1773 $html .=
'<td class="extrafield-content">';
1774 $html .= $field->content;
1780 $html .=
'</table>';
1796 if (!empty($this->cols[$colKey][
'status'])) {
1813 public function pdfTabTitles(&$pdf, $tab_top, $tab_height, $outputlangs, $hidetop = 0)
1815 global $hookmanager,
$conf;
1817 foreach ($this->cols as $colKey => $colDef) {
1818 $parameters = array(
1819 'colKey' => $colKey,
1821 'outputlangs' => $outputlangs,
1822 'tab_top' => $tab_top,
1823 'tab_height' => $tab_height,
1824 'hidetop' => $hidetop
1827 $reshook = $hookmanager->executeHooks(
'pdfTabTitles', $parameters, $this);
1830 } elseif (empty($reshook)) {
1836 $colDef[
'title'][
'label'] = !empty($colDef[
'title'][
'label']) ? $colDef[
'title'][
'label'] : $outputlangs->transnoentities($colDef[
'title'][
'textkey']);
1839 if (!empty($colDef[
'border-left']) && isset($colDef[
'xStartPos'])) {
1840 $pdf->line($colDef[
'xStartPos'], $tab_top, $colDef[
'xStartPos'], $tab_top + $tab_height);
1843 if (empty($hidetop)) {
1845 $curentCellPaddinds = $pdf->getCellPaddings();
1848 global $outputlangsbis;
1849 if (is_object($outputlangsbis)) {
1851 $pdf->setCellPaddings($colDef[
'title'][
'padding'][3], $colDef[
'title'][
'padding'][0], $colDef[
'title'][
'padding'][1], 0.5);
1854 $pdf->setCellPaddings($colDef[
'title'][
'padding'][3], $colDef[
'title'][
'padding'][0], $colDef[
'title'][
'padding'][1], $colDef[
'title'][
'padding'][2]);
1856 if (isset($colDef[
'title'][
'align'])) {
1857 $align = $colDef[
'title'][
'align'];
1861 $pdf->SetXY($colDef[
'xStartPos'], $tab_top);
1862 $textWidth = $colDef[
'width'];
1863 $pdf->MultiCell($textWidth, 2, $colDef[
'title'][
'label'],
'', $align);
1866 if (is_object($outputlangsbis) && trim($colDef[
'title'][
'label'])) {
1867 $pdf->setCellPaddings($colDef[
'title'][
'padding'][3], 0, $colDef[
'title'][
'padding'][1], $colDef[
'title'][
'padding'][2]);
1868 $pdf->SetXY($colDef[
'xStartPos'], $pdf->GetY());
1869 $textbis = $outputlangsbis->transnoentities($colDef[
'title'][
'textkey']);
1870 $pdf->MultiCell($textWidth, 2, $textbis,
'', $align);
1873 $this->tabTitleHeight = max($pdf->GetY() - $tab_top, $this->tabTitleHeight);
1876 $pdf->setCellPaddings($curentCellPaddinds[
'L'], $curentCellPaddinds[
'T'], $curentCellPaddinds[
'R'], $curentCellPaddinds[
'B']);
1881 return $this->tabTitleHeight;
1896 if (!empty($hidedetails)) {
1900 if (empty(
$object->table_element)) {
1905 if (is_null($this->extrafieldsCache)) {
1906 $this->extrafieldsCache =
new ExtraFields($this->db);
1908 if (empty($this->extrafieldsCache->attributes[
$object->table_element])) {
1909 $this->extrafieldsCache->fetch_name_optionals_label(
$object->table_element);
1911 $extrafields = $this->extrafieldsCache;
1914 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'])) {
1915 foreach ($extrafields->attributes[
$object->table_element][
'label'] as $key => $label) {
1917 if ($extrafields->attributes[
$object->table_element][
'type'][$key] ==
'separate') {
1923 if (!empty($extrafields->attributes[
$object->table_element][
'printable'][$key])) {
1924 $printable = intval($extrafields->attributes[
$object->table_element][
'printable'][$key]);
1925 if ($printable === 1 || $printable === 2) {
1936 if (!empty($extrafields->attributes[
$object->table_element][
'langfile'][$key])) {
1937 $outputlangs->load($extrafields->attributes[
$object->table_element][
'langfile'][$key]);
1944 'rank' => intval($extrafields->attributes[
$object->table_element][
'pos'][$key]),
1946 'status' => (
bool) $enabled,
1948 'label' => $outputlangs->transnoentities($label)
1953 'border-left' =>
true,
1956 $alignTypeRight = array(
'double',
'int',
'price');
1957 if (in_array($extrafields->attributes[
$object->table_element][
'type'][$key], $alignTypeRight)) {
1958 $def[
'content'][
'align'] =
'R';
1961 $alignTypeLeft = array(
'text',
'html');
1962 if (in_array($extrafields->attributes[
$object->table_element][
'type'][$key], $alignTypeLeft)) {
1963 $def[
'content'][
'align'] =
'L';
1989 $this->defaultContentsFieldsStyle = array(
1991 'padding' => array(1, 0.5, 1, 0.5),
1995 $this->defaultTitlesFieldsStyle = array(
1997 'padding' => array(0.5, 0, 0.5, 0),
if( $user->socid > 0) if(! $user->hasRight('accounting', 'chartofaccount')) $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.
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.
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
__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.
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.
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 '.
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.
dol_now($mode='auto')
Return date for now.
getDolGlobalInt($key, $default=0)
Return a Dolibarr global constant int value.
dol_getIdFromCode($db, $key, $tablename, $fieldkey='code', $fieldid='id', $entityfilter=0, $filters='')
Return an id or code from a code or id.
dol_print_date($time, $format='', $tzoutput='auto', $outputlangs=null, $encodetooutput=false)
Output date in a string format according to outputlangs (or langs if not defined).
if(!function_exists( 'dol_getprefix')) dol_include_once($relpath, $classname='')
Make an include_once using default root and alternate root if it fails.
getImageFileNameForSize($file, $extName, $extImgTarget='')
Return the filename of file to get the thumbs.
get_exdir($num, $level, $alpha, $withoutslash, $object, $modulepart='')
Return a path to have a the directory according to object where files are stored.
global $conf
The following vars must be defined: $type2label $form $conf, $lang, The following vars may also be de...
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='', $use_short_label=0, $outputlangs=null)
Return translation label of a unit key.