58 public $errors = array();
68 public $extrafieldsCache;
73 public $update_main_doc_field;
104 public $option_multilang;
105 public $option_freetext;
106 public $option_draft_watermark;
109 public $option_modereg;
110 public $option_condreg;
111 public $option_escompte;
112 public $option_credit_note;
133 public $tabTitleHeight;
138 public $defaultTitlesFieldsStyle;
143 public $defaultContentsFieldsStyle;
154 public $phpmin = array(7, 1);
177 public $posxdiscount;
178 public $posxworkload;
179 public $posxtimespent;
180 public $posxprogress;
181 public $atleastonephoto;
182 public $atleastoneratenotnull;
183 public $atleastonediscount;
207 global $conf, $extrafields;
212 'myuser_lastname' => $user->lastname,
213 'myuser_firstname' => $user->firstname,
214 'myuser_fullname' => $user->getFullName($outputlangs, 1),
215 'myuser_login' => $user->login,
216 'myuser_phone' => $user->office_phone,
217 'myuser_address' => $user->address,
218 'myuser_zip' => $user->zip,
219 'myuser_town' => $user->town,
220 'myuser_country' => $user->country,
221 'myuser_country_code' => $user->country_code,
222 'myuser_state' => $user->state,
223 'myuser_state_code' => $user->state_code,
224 'myuser_fax' => $user->office_fax,
225 'myuser_mobile' => $user->user_mobile,
226 'myuser_email' => $user->email,
227 'myuser_logo' => $logotouse,
228 'myuser_job' => $user->job,
231 'myuser_dateemployment' =>
dol_print_date($user->dateemployment,
'day',
'tzuser'),
232 'myuser_dateemploymentend' =>
dol_print_date($user->dateemploymentend,
'day',
'tzuser'),
233 'myuser_gender' => $user->gender,
236 if (is_array($user->array_options) && count($user->array_options)) {
237 if (empty($extrafields->attributes[$user->table_element])) {
238 $extrafields->fetch_name_optionals_label($user->table_element);
255 global $conf, $extrafields;
257 if ($member->photo) {
258 $logotouse = $conf->member->dir_output.
'/'.
get_exdir(0, 0, 0, 1, $member,
'user').
'/photos/'.$member->photo;
260 $logotouse = DOL_DOCUMENT_ROOT.
'/public/theme/common/nophoto.png';
263 $array_member = array(
264 'mymember_lastname' => $member->lastname,
265 'mymember_firstname' => $member->firstname,
266 'mymember_fullname' => $member->getFullName($outputlangs, 1),
267 'mymember_login' => $member->login,
268 'mymember_address' => $member->address,
269 'mymember_zip' => $member->zip,
270 'mymember_town' => $member->town,
271 'mymember_country_code' => $member->country_code,
272 'mymember_country' => $member->country,
273 'mymember_state_code' => $member->state_code,
274 'mymember_state' => $member->state,
275 'mymember_phone_perso' => $member->phone_perso,
276 'mymember_phone_pro' => $member->phone,
277 'mymember_phone_mobile' => $member->phone_mobile,
278 'mymember_email' => $member->email,
279 'mymember_logo' => $logotouse,
280 'mymember_gender' => $member->gender,
281 'mymember_birth_locale' =>
dol_print_date($member->birth,
'day',
'tzuser', $outputlangs),
282 'mymember_birth' =>
dol_print_date($member->birth,
'day',
'tzuser'),
285 if (is_array($member->array_options) && count($member->array_options)) {
288 return $array_member;
305 if (empty($mysoc->forme_juridique) && !empty($mysoc->forme_juridique_code)) {
308 if (empty($mysoc->country) && !empty($mysoc->country_code)) {
309 $mysoc->country = $outputlangs->transnoentitiesnoconv(
"Country".$mysoc->country_code);
311 if (empty($mysoc->state) && !empty($mysoc->state_code)) {
312 $mysoc->state =
getState($mysoc->state_code, 0);
315 $logotouse = $conf->mycompany->dir_output.
'/logos/thumbs/'.$mysoc->logo_small;
318 'mycompany_logo' => $logotouse,
319 'mycompany_name' => $mysoc->name,
320 'mycompany_email' => $mysoc->email,
321 'mycompany_phone' => $mysoc->phone,
322 'mycompany_fax' => $mysoc->fax,
323 'mycompany_address' => $mysoc->address,
324 'mycompany_zip' => $mysoc->zip,
325 'mycompany_town' => $mysoc->town,
326 'mycompany_country' => $mysoc->country,
327 'mycompany_country_code' => $mysoc->country_code,
328 'mycompany_state' => $mysoc->state,
329 'mycompany_state_code' => $mysoc->state_code,
330 'mycompany_web' => $mysoc->url,
331 'mycompany_juridicalstatus' => $mysoc->forme_juridique,
332 'mycompany_managers' => $mysoc->managers,
333 'mycompany_capital' => $mysoc->capital,
334 'mycompany_barcode' => $mysoc->barcode,
335 'mycompany_idprof1' => $mysoc->idprof1,
336 'mycompany_idprof2' => $mysoc->idprof2,
337 'mycompany_idprof3' => $mysoc->idprof3,
338 'mycompany_idprof4' => $mysoc->idprof4,
339 'mycompany_idprof5' => $mysoc->idprof5,
340 'mycompany_idprof6' => $mysoc->idprof6,
341 'mycompany_vatnumber' => $mysoc->tva_intra,
342 'mycompany_socialobject' => $mysoc->socialobject,
343 'mycompany_note_private' => $mysoc->note_private,
369 $object->country = $outputlangs->transnoentitiesnoconv(
"Country".
$object->country_code);
375 $array_thirdparty = array(
376 'company_name' =>
$object->name,
377 'company_name_alias' =>
$object->name_alias,
378 'company_email' =>
$object->email,
379 'company_phone' =>
$object->phone,
381 'company_address' =>
$object->address,
383 'company_town' =>
$object->town,
384 'company_country' =>
$object->country,
385 'company_country_code' =>
$object->country_code,
386 'company_state' =>
$object->state,
387 'company_state_code' =>
$object->state_code,
389 'company_barcode' =>
$object->barcode,
390 'company_vatnumber' =>
$object->tva_intra,
391 'company_customercode' =>
$object->code_client,
392 'company_suppliercode' =>
$object->code_fournisseur,
393 'company_customeraccountancycode' =>
$object->code_compta_client,
394 'company_supplieraccountancycode' =>
$object->code_compta_fournisseur,
395 'company_juridicalstatus' =>
$object->forme_juridique,
396 'company_outstanding_limit' =>
$object->outstanding_limit,
397 'company_capital' =>
$object->capital,
398 'company_capital_formated'=>
price(
$object->capital, 0,
'', 1, -1),
399 'company_idprof1' =>
$object->idprof1,
400 'company_idprof2' =>
$object->idprof2,
401 'company_idprof3' =>
$object->idprof3,
402 'company_idprof4' =>
$object->idprof4,
403 'company_idprof5' =>
$object->idprof5,
404 'company_idprof6' =>
$object->idprof6,
405 'company_note_public' =>
$object->note_public,
406 'company_note_private' =>
$object->note_private,
407 'company_default_bank_iban' => (is_object(
$object->bank_account) ?
$object->bank_account->iban :
''),
408 'company_default_bank_bic' => (is_object(
$object->bank_account) ?
$object->bank_account->bic :
'')
412 if (is_array(
$object->array_options) && count(
$object->array_options)) {
417 return $array_thirdparty;
432 global $conf, $extrafields;
435 $object->country = $outputlangs->transnoentitiesnoconv(
"Country".
$object->country_code);
441 $array_contact = array(
442 $array_key.
'_fullname' =>
$object->getFullName($outputlangs, 1),
443 $array_key.
'_lastname' =>
$object->lastname,
444 $array_key.
'_firstname' =>
$object->firstname,
445 $array_key.
'_address' =>
$object->address,
446 $array_key.
'_zip' =>
$object->zip,
447 $array_key.
'_town' =>
$object->town,
448 $array_key.
'_state_id' =>
$object->state_id,
449 $array_key.
'_state_code' =>
$object->state_code,
450 $array_key.
'_state' =>
$object->state,
451 $array_key.
'_country_id' =>
$object->country_id,
452 $array_key.
'_country_code' =>
$object->country_code,
453 $array_key.
'_country' =>
$object->country,
454 $array_key.
'_poste' =>
$object->poste,
455 $array_key.
'_socid' =>
$object->socid,
456 $array_key.
'_statut' =>
$object->statut,
457 $array_key.
'_code' =>
$object->code,
458 $array_key.
'_email' =>
$object->email,
459 $array_key.
'_phone_pro' =>
$object->phone_pro,
460 $array_key.
'_phone_perso' =>
$object->phone_perso,
461 $array_key.
'_phone_mobile' =>
$object->phone_mobile,
462 $array_key.
'_fax' =>
$object->fax,
463 $array_key.
'_birthday' =>
$object->birthday,
464 $array_key.
'_default_lang' =>
$object->default_lang,
465 $array_key.
'_note_public' =>
$object->note_public,
466 $array_key.
'_note_private' =>
$object->note_private,
467 $array_key.
'_civility' =>
$object->civility,
471 if (is_array(
$object->array_options) && count(
$object->array_options)) {
476 return $array_contact;
493 $array_other = array(
498 'current_server_datehour' =>
dol_print_date($now,
'dayhour',
'tzserver'),
500 'current_date_locale' =>
dol_print_date($now,
'day',
'tzuser', $outputlangs),
501 'current_datehour_locale' =>
dol_print_date($now,
'dayhour',
'tzuser', $outputlangs),
502 'current_server_date_locale' =>
dol_print_date($now,
'day',
'tzserver', $outputlangs),
503 'current_server_datehour_locale' =>
dol_print_date($now,
'dayhour',
'tzserver', $outputlangs),
507 foreach ($conf->global as $key => $val) {
509 $newval =
'*****forbidden*****';
513 $array_other[
'__['.$key.
']__'] = $newval;
530 public function get_substitutionarray_object(
$object, $outputlangs, $array_key =
'object')
535 $sumpayed = $sumdeposit = $sumcreditnote =
'';
536 $already_payed_all = 0;
538 if (
$object->element ==
'facture') {
540 $invoice_source =
new Facture($this->db);
541 if (
$object->fk_facture_source > 0) {
542 $invoice_source->fetch(
$object->fk_facture_source);
544 $sumpayed =
$object->getSommePaiement();
545 $sumdeposit =
$object->getSumDepositsUsed();
546 $sumcreditnote =
$object->getSumCreditNotesUsed();
547 $already_payed_all = $sumpayed + $sumdeposit + $sumcreditnote;
552 if (get_class(
$object) ==
'CommandeFournisseur') {
558 $array_key.
'_id' =>
$object->id,
559 $array_key.
'_ref' => (property_exists(
$object,
'ref') ?
$object->ref :
''),
560 $array_key.
'_label' => (property_exists(
$object,
'label') ?
$object->label :
''),
561 $array_key.
'_ref_ext' => (property_exists(
$object,
'ref_ext') ?
$object->ref_ext :
''),
562 $array_key.
'_ref_customer' => (!empty(
$object->ref_client) ?
$object->ref_client : (empty(
$object->ref_customer) ?
'' :
$object->ref_customer)),
563 $array_key.
'_ref_supplier' => (!empty(
$object->ref_fournisseur) ?
$object->ref_fournisseur : (empty(
$object->ref_supplier) ?
'' :
$object->ref_supplier)),
564 $array_key.
'_source_invoice_ref' => ((empty($invoice_source) || empty($invoice_source->
ref)) ?
'' : $invoice_source->
ref),
579 $array_key.
'_payment_mode_code' =>
$object->mode_reglement_code,
580 $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),
581 $array_key.
'_payment_term_code' =>
$object->cond_reglement_code,
582 $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)),
586 $array_key.
'_total_ht_locale' =>
price(
$object->total_ht, 0, $outputlangs),
587 $array_key.
'_total_vat_locale' => (!empty(
$object->total_vat) ?
price(
$object->total_vat, 0, $outputlangs) :
price(
$object->total_tva, 0, $outputlangs)),
588 $array_key.
'_total_localtax1_locale' =>
price(
$object->total_localtax1, 0, $outputlangs),
589 $array_key.
'_total_localtax2_locale' =>
price(
$object->total_localtax2, 0, $outputlangs),
590 $array_key.
'_total_ttc_locale' =>
price(
$object->total_ttc, 0, $outputlangs),
598 $array_key.
'_multicurrency_code' =>
$object->multicurrency_code,
600 $array_key.
'_multicurrency_total_ht' =>
price2num(
$object->multicurrency_total_ht),
601 $array_key.
'_multicurrency_total_tva' =>
price2num(
$object->multicurrency_total_tva),
602 $array_key.
'_multicurrency_total_ttc' =>
price2num(
$object->multicurrency_total_ttc),
603 $array_key.
'_multicurrency_total_ht_locale' =>
price(
$object->multicurrency_total_ht, 0, $outputlangs),
604 $array_key.
'_multicurrency_total_tva_locale' =>
price(
$object->multicurrency_total_tva, 0, $outputlangs),
605 $array_key.
'_multicurrency_total_ttc_locale' =>
price(
$object->multicurrency_total_ttc, 0, $outputlangs),
607 $array_key.
'_note_private' =>
$object->note_private,
608 $array_key.
'_note_public' =>
$object->note_public,
609 $array_key.
'_note' =>
$object->note_public,
612 $array_key.
'_already_payed_locale' =>
price($sumpayed, 0, $outputlangs),
613 $array_key.
'_already_payed' =>
price2num($sumpayed),
614 $array_key.
'_already_deposit_locale' =>
price($sumdeposit, 0, $outputlangs),
615 $array_key.
'_already_deposit' =>
price2num($sumdeposit),
616 $array_key.
'_already_creditnote_locale' =>
price($sumcreditnote, 0, $outputlangs),
617 $array_key.
'_already_creditnote' =>
price2num($sumcreditnote),
619 $array_key.
'_already_payed_all_locale' =>
price(
price2num($already_payed_all,
'MT'), 0, $outputlangs),
620 $array_key.
'_already_payed_all' =>
price2num($already_payed_all,
'MT'),
623 $array_key.
'_remain_to_pay_locale' =>
price(
price2num(
$object->total_ttc - $already_payed_all,
'MT'), 0, $outputlangs),
624 $array_key.
'_remain_to_pay' =>
price2num(
$object->total_ttc - $already_payed_all,
'MT')
627 if (in_array(
$object->element, array(
'facture',
'invoice',
'supplier_invoice',
'facture_fournisseur'))) {
628 $bank_account =
null;
630 if (property_exists(
$object,
'fk_account') &&
$object->fk_account > 0) {
631 require_once DOL_DOCUMENT_ROOT.
'/compta/bank/class/account.class.php';
632 $bank_account =
new Account($this->db);
633 $bank_account->fetch(
$object->fk_account);
636 $resarray[$array_key.
'_bank_iban'] = (empty($bank_account) ?
'' : $bank_account->iban);
637 $resarray[$array_key.
'_bank_bic'] = (empty($bank_account) ?
'' : $bank_account->bic);
638 $resarray[$array_key.
'_bank_label'] = (empty($bank_account) ?
'' : $bank_account->label);
639 $resarray[$array_key.
'_bank_number'] = (empty($bank_account) ?
'' : $bank_account->number);
640 $resarray[$array_key.
'_bank_proprio'] = (empty($bank_account) ?
'' : $bank_account->proprio);
641 $resarray[$array_key.
'_bank_address'] = (empty($bank_account) ?
'' : $bank_account->address);
642 $resarray[$array_key.
'_bank_state'] = (empty($bank_account) ?
'' : $bank_account->state);
643 $resarray[$array_key.
'_bank_country'] = (empty($bank_account) ?
'' : $bank_account->country);
646 if (method_exists(
$object,
'getTotalDiscount') && in_array(get_class(
$object), array(
'Propal',
'Proposal',
'Commande',
'Facture',
'SupplierProposal',
'CommandeFournisseur',
'FactureFournisseur'))) {
647 $resarray[$array_key.
'_total_discount_ht_locale'] =
price(
$object->getTotalDiscount(), 0, $outputlangs);
648 $resarray[$array_key.
'_total_discount_ht'] =
price2num(
$object->getTotalDiscount());
650 $resarray[$array_key.
'_total_discount_ht_locale'] =
'';
651 $resarray[$array_key.
'_total_discount_ht'] =
'';
656 if (!is_object(
$object->project)) {
660 $resarray[$array_key.
'_project_ref'] =
$object->project->ref;
661 $resarray[$array_key.
'_project_title'] =
$object->project->title;
662 $resarray[$array_key.
'_project_description'] =
$object->project->description;
666 $resarray[$array_key.
'_project_ref'] =
'';
667 $resarray[$array_key.
'_project_title'] =
'';
668 $resarray[$array_key.
'_project_description'] =
'';
669 $resarray[$array_key.
'_project_date_start'] =
'';
670 $resarray[$array_key.
'_project_date_end'] =
'';
677 foreach (
$object->lines as $line) {
679 if (empty($resarray[$array_key.
'_total_vat_'.$line->tva_tx])) {
680 $resarray[$array_key.
'_total_vat_'.$line->tva_tx] = 0;
682 $resarray[$array_key.
'_total_vat_'.$line->tva_tx] += $line->total_tva;
683 $resarray[$array_key.
'_total_vat_locale_'.$line->tva_tx] =
price($resarray[$array_key.
'_total_vat_'.$line->tva_tx]);
685 $vatformated =
vatrate($line->tva_tx);
686 if (empty($resarray[$array_key.
'_total_vat_'.$vatformated])) {
687 $resarray[$array_key.
'_total_vat_'.$vatformated] = 0;
689 $resarray[$array_key.
'_total_vat_'.$vatformated] += $line->total_tva;
690 $resarray[$array_key.
'_total_vat_locale_'.$vatformated] =
price($resarray[$array_key.
'_total_vat_'.$vatformated]);
692 $totalUp += $line->subprice * $line->qty;
697 $resarray[
'object_total_up'] = $totalUp;
698 $resarray[
'object_total_up_locale'] =
price($resarray[
'object_total_up'], 0, $outputlangs);
699 if (method_exists(
$object,
'getTotalDiscount') && in_array(get_class(
$object), array(
'Propal',
'Proposal',
'Commande',
'Facture',
'SupplierProposal',
'CommandeFournisseur',
'FactureFournisseur'))) {
700 $totalDiscount =
$object->getTotalDiscount();
704 if (!empty($totalUp) && !empty($totalDiscount)) {
705 $resarray[
'object_total_discount'] = round(100 / $totalUp * $totalDiscount, 2);
706 $resarray[
'object_total_discount_locale'] =
price($resarray[
'object_total_discount'], 0, $outputlangs);
708 $resarray[
'object_total_discount'] =
'';
709 $resarray[
'object_total_discount_locale'] =
'';
714 if (is_array(
$object->array_options) && count(
$object->array_options)) {
737 'line_pos' => $linenumber,
740 'line_product_ref' => (empty($line->product_ref) ?
'' : $line->product_ref),
741 'line_product_ref_fourn' => (empty($line->ref_fourn) ?
'' : $line->ref_fourn),
742 'line_product_label' => (empty($line->product_label) ?
'' : $line->product_label),
743 'line_product_type' => (empty($line->product_type) ?
'' : $line->product_type),
744 'line_product_barcode' => (empty($line->product_barcode) ?
'' : $line->product_barcode),
745 'line_product_desc' => (empty($line->product_desc) ?
'' : $line->product_desc),
747 'line_desc' => $line->desc,
748 'line_vatrate' =>
vatrate($line->tva_tx,
true, $line->info_bits),
749 'line_localtax1_rate' =>
vatrate($line->localtax1_tx),
750 'line_localtax2_rate' =>
vatrate($line->localtax1_tx),
752 'line_up_locale' =>
price($line->subprice, 0, $outputlangs),
753 'line_total_up' =>
price2num($line->subprice * (
float) $line->qty),
754 'line_total_up_locale' =>
price($line->subprice * (
float) $line->qty, 0, $outputlangs),
755 'line_qty' => $line->qty,
756 'line_discount_percent' => ($line->remise_percent ? $line->remise_percent.
'%' :
''),
757 'line_price_ht' =>
price2num($line->total_ht),
758 'line_price_ttc' =>
price2num($line->total_ttc),
759 'line_price_vat' =>
price2num($line->total_tva),
760 'line_price_ht_locale' =>
price($line->total_ht, 0, $outputlangs),
761 'line_price_ttc_locale' =>
price($line->total_ttc, 0, $outputlangs),
762 'line_price_vat_locale' =>
price($line->total_tva, 0, $outputlangs),
765 'line_date_start_locale' =>
dol_print_date($line->date_start,
'day',
'tzserver', $outputlangs),
766 'line_date_start_rfc' =>
dol_print_date($line->date_start,
'dayrfc'),
768 'line_date_end_locale' =>
dol_print_date($line->date_end,
'day',
'tzserver', $outputlangs),
771 'line_multicurrency_code' =>
price2num($line->multicurrency_code),
772 'line_multicurrency_subprice' =>
price2num($line->multicurrency_subprice),
773 'line_multicurrency_total_ht' =>
price2num($line->multicurrency_total_ht),
774 'line_multicurrency_total_tva' =>
price2num($line->multicurrency_total_tva),
775 'line_multicurrency_total_ttc' =>
price2num($line->multicurrency_total_ttc),
776 'line_multicurrency_subprice_locale' =>
price($line->multicurrency_subprice, 0, $outputlangs),
777 'line_multicurrency_total_ht_locale' =>
price($line->multicurrency_total_ht, 0, $outputlangs),
778 'line_multicurrency_total_tva_locale' =>
price($line->multicurrency_total_tva, 0, $outputlangs),
779 'line_multicurrency_total_ttc_locale' =>
price($line->multicurrency_total_ttc, 0, $outputlangs),
784 $resarray[
'line_unit'] = $outputlangs->trans($line->getLabelOfUnit(
'long'));
785 $resarray[
'line_unit_short'] = $outputlangs->trans($line->getLabelOfUnit(
'short'));
789 $extrafieldkey = $line->table_element;
791 require_once DOL_DOCUMENT_ROOT.
'/core/class/extrafields.class.php';
793 $extrafields->fetch_name_optionals_label($extrafieldkey,
true);
794 $line->fetch_optionals();
799 if (get_class($line) ==
'CommandeFournisseurLigne') {
801 $extrafields->fetch_name_optionals_label(
"product_fournisseur_price");
802 $extralabels = $extrafields->attributes[
"product_fournisseur_price"][
'label'];
804 if (!empty($extralabels) && is_array($extralabels)) {
807 foreach ($extralabels as $key => $label) {
808 $columns .=
"$key, ";
811 if ($columns !=
"") {
812 $columns = substr($columns, 0, strlen($columns) - 2);
813 $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).
"'");
815 if ($this->db->num_rows($resql) > 0) {
816 $resql = $this->db->fetch_object($resql);
818 foreach ($extralabels as $key => $label) {
819 $resarray[
'line_product_supplier_'.$key] = $resql->$key;
827 if (isset($line->fk_product) && $line->fk_product > 0) {
828 $tmpproduct =
new Product($this->db);
829 $result = $tmpproduct->fetch($line->fk_product);
830 if (!empty($tmpproduct->array_options) && is_array($tmpproduct->array_options)) {
831 foreach ($tmpproduct->array_options as $key => $label) {
832 $resarray[
"line_product_".$key] = $label;
837 $extrafields->fetch_name_optionals_label(
"product");
838 if ($extrafields->attributes[
"product"][
'count'] > 0) {
839 $extralabels = $extrafields->attributes[
"product"][
'label'];
841 foreach ($extralabels as $key => $label) {
842 $resarray[
'line_product_options_'.$key] =
'';
865 include_once DOL_DOCUMENT_ROOT.
'/core/lib/product.lib.php';
868 $calculatedVolume = ((float)
$object->trueWidth * (
float)
$object->trueHeight * (float)
$object->trueDepth);
870 $array_shipment = array(
871 $array_key.
'_id' =>
$object->id,
872 $array_key.
'_ref' =>
$object->ref,
873 $array_key.
'_ref_ext' =>
$object->ref_ext,
874 $array_key.
'_ref_customer' =>
$object->ref_customer,
881 $array_key.
'_total_discount_ht' =>
price(
$object->getTotalDiscount()),
882 $array_key.
'_note_private' =>
$object->note_private,
883 $array_key.
'_note' =>
$object->note_public,
884 $array_key.
'_tracking_number' =>
$object->tracking_number,
885 $array_key.
'_tracking_url' =>
$object->tracking_url,
886 $array_key.
'_shipping_method' =>
$object->listmeths[0][
'libelle'],
895 foreach (
$object->lines as $line) {
896 if (empty($array_shipment[$array_key.
'_total_vat_'.$line->tva_tx])) {
897 $array_shipment[$array_key.
'_total_vat_'.$line->tva_tx] = 0;
899 $array_shipment[$array_key.
'_total_vat_'.$line->tva_tx] += $line->total_tva;
903 if (is_array(
$object->array_options) && count(
$object->array_options)) {
910 if (is_object(
$object->commande) && !empty(
$object->commande->ref)) {
911 $array_shipment[
'order_ref'] =
$object->commande->ref;
912 $array_shipment[
'order_ref_customer'] =
$object->commande->ref_customer;
915 return $array_shipment;
931 $array_other = array();
933 foreach (
$object as $key => $value) {
934 if (in_array($key, array(
'db',
'fields',
'lines',
'modelpdf',
'model_pdf'))) {
937 if (!empty($value)) {
938 if (!is_array($value) && !is_object($value)) {
939 $array_other[
'object_'.$key] = $value;
940 } elseif (is_array($value) && $recursive) {
942 if (!empty($tmparray) && is_array($tmparray)) {
943 foreach ($tmparray as $key2 => $value2) {
944 $array_other[
'object_'.$key.
'_'.preg_replace(
'/^object_/',
'', $key2)] = $value2;
947 } elseif (is_object($value) && $recursive) {
949 if (!empty($tmparray) && is_array($tmparray)) {
950 foreach ($tmparray as $key2 => $value2) {
951 $array_other[
'object_'.$key.
'_'.preg_replace(
'/^object_/',
'', $key2)] = $value2;
980 if ($extrafields->attributes[
$object->table_element][
'count'] > 0) {
981 foreach ($extrafields->attributes[
$object->table_element][
'label'] as $key => $label) {
982 $formatedarrayoption =
$object->array_options;
984 if ($extrafields->attributes[
$object->table_element][
'type'][$key] ==
'price') {
985 $formatedarrayoption[
'options_'.$key] =
price2num($formatedarrayoption[
'options_'.$key]);
986 $formatedarrayoption[
'options_'.$key.
'_currency'] =
price($formatedarrayoption[
'options_'.$key], 0, $outputlangs, 0, 0, -1, $conf->currency);
988 $array_to_fill = array_merge($array_to_fill, array($array_key.
'_options_'.$key.
'_currency' => $formatedarrayoption[
'options_'.$key.
'_currency']));
989 } elseif ($extrafields->attributes[
$object->table_element][
'type'][$key] ==
'select') {
990 $valueofselectkey = $formatedarrayoption[
'options_'.$key];
991 if (array_key_exists($valueofselectkey, $extrafields->attributes[
$object->table_element][
'param'][$key][
'options'])) {
992 $formatedarrayoption[
'options_'.$key] = $extrafields->attributes[
$object->table_element][
'param'][$key][
'options'][$valueofselectkey];
994 $formatedarrayoption[
'options_'.$key] =
'';
996 } elseif ($extrafields->attributes[
$object->table_element][
'type'][$key] ==
'checkbox') {
997 $valArray = explode(
',', $formatedarrayoption[
'options_'.$key]);
999 foreach ($extrafields->attributes[
$object->table_element][
'param'][$key][
'options'] as $keyopt => $valopt) {
1000 if (in_array($keyopt, $valArray)) {
1001 $output[] = $valopt;
1004 $formatedarrayoption[
'options_'.$key] = implode(
', ', $output);
1005 } elseif ($extrafields->attributes[
$object->table_element][
'type'][$key] ==
'date') {
1006 if (strlen($formatedarrayoption[
'options_'.$key]) > 0) {
1007 $date = $formatedarrayoption[
'options_'.$key];
1008 $formatedarrayoption[
'options_'.$key] =
dol_print_date($date,
'day');
1009 $formatedarrayoption[
'options_'.$key.
'_locale'] =
dol_print_date($date,
'day',
'tzserver', $outputlangs);
1010 $formatedarrayoption[
'options_'.$key.
'_rfc'] =
dol_print_date($date,
'dayrfc');
1012 $formatedarrayoption[
'options_'.$key] =
'';
1013 $formatedarrayoption[
'options_'.$key.
'_locale'] =
'';
1014 $formatedarrayoption[
'options_'.$key.
'_rfc'] =
'';
1016 $array_to_fill = array_merge($array_to_fill, array($array_key.
'_options_'.$key.
'_locale' => $formatedarrayoption[
'options_'.$key.
'_locale']));
1017 $array_to_fill = array_merge($array_to_fill, array($array_key.
'_options_'.$key.
'_rfc' => $formatedarrayoption[
'options_'.$key.
'_rfc']));
1018 } elseif ($extrafields->attributes[
$object->table_element][
'type'][$key] ==
'datetime') {
1019 $datetime = $formatedarrayoption[
'options_'.$key];
1020 $formatedarrayoption[
'options_'.$key] = ($datetime !=
"0000-00-00 00:00:00" ?
dol_print_date($datetime,
'dayhour') :
'');
1021 $formatedarrayoption[
'options_'.$key.
'_locale'] = ($datetime !=
"0000-00-00 00:00:00" ?
dol_print_date($datetime,
'dayhour',
'tzserver', $outputlangs) :
'');
1022 $formatedarrayoption[
'options_'.$key.
'_rfc'] = ($datetime !=
"0000-00-00 00:00:00" ?
dol_print_date($datetime,
'dayhourrfc') :
'');
1023 $array_to_fill = array_merge($array_to_fill, array($array_key.
'_options_'.$key.
'_locale' => $formatedarrayoption[
'options_'.$key.
'_locale']));
1024 $array_to_fill = array_merge($array_to_fill, array($array_key.
'_options_'.$key.
'_rfc' => $formatedarrayoption[
'options_'.$key.
'_rfc']));
1025 } elseif ($extrafields->attributes[
$object->table_element][
'type'][$key] ==
'link') {
1026 $id = $formatedarrayoption[
'options_'.$key];
1028 $param = $extrafields->attributes[
$object->table_element][
'param'][$key];
1029 $param_list = array_keys($param[
'options']);
1030 $InfoFieldList = explode(
":", $param_list[0]);
1031 $classname = $InfoFieldList[0];
1032 $classpath = $InfoFieldList[1];
1033 if (!empty($classpath)) {
1035 if ($classname && class_exists($classname)) {
1036 $tmpobject =
new $classname($this->db);
1037 $tmpobject->fetch($id);
1039 $formatedarrayoption[
'options_'.$key] = $tmpobject->name;
1045 if (array_key_exists(
'options_'.$key, $formatedarrayoption)) {
1046 $array_to_fill = array_merge($array_to_fill, array($array_key.
'_options_'.$key => $formatedarrayoption[
'options_'.$key]));
1048 $array_to_fill = array_merge($array_to_fill, array($array_key.
'_options_'.$key =>
''));
1053 return $array_to_fill;
1069 public function printRect($pdf, $x, $y, $l, $h, $hidetop = 0, $hidebottom = 0)
1071 if (empty($hidetop) || $hidetop == -1) {
1072 $pdf->line($x, $y, $x + $l, $y);
1074 $pdf->line($x + $l, $y, $x + $l, $y + $h);
1075 if (empty($hidebottom)) {
1076 $pdf->line($x + $l, $y + $h, $x, $y + $h);
1078 $pdf->line($x, $y + $h, $x, $y);
1091 if (empty($a[
'rank'])) {
1094 if (empty($b[
'rank'])) {
1097 if ($a[
'rank'] == $b[
'rank']) {
1100 return ($a[
'rank'] > $b[
'rank']) ? -1 : 1;
1119 uasort($this->cols, array($this,
'columnSort'));
1122 $curX = $this->page_largeur - $this->marge_droite;
1125 $arrayWidth = $this->page_largeur - $this->marge_droite - $this->marge_gauche;
1128 $totalDefinedColWidth = 0;
1130 foreach ($this->cols as $colKey => & $colDef) {
1135 if (!empty($colDef[
'scale'])) {
1137 $colDef[
'width'] = abs($arrayWidth * $colDef[
'scale'] / 100);
1140 if (empty($colDef[
'width'])) {
1143 $totalDefinedColWidth += $colDef[
'width'];
1147 foreach ($this->cols as $colKey => & $colDef) {
1149 if (!empty($colDef[
'title'])) {
1150 $colDef[
'title'] = array_replace($this->defaultTitlesFieldsStyle, $colDef[
'title']);
1152 $colDef[
'title'] = $this->defaultTitlesFieldsStyle;
1156 if (!empty($colDef[
'content'])) {
1157 $colDef[
'content'] = array_replace($this->defaultContentsFieldsStyle, $colDef[
'content']);
1159 $colDef[
'content'] = $this->defaultContentsFieldsStyle;
1164 if (empty($colDef[
'width'])) {
1165 $colDef[
'width'] = abs(($arrayWidth - $totalDefinedColWidth)) / $countFlexCol;
1170 $curX = $lastX - $colDef[
'width'];
1171 $colDef[
'xStartPos'] = $curX;
1172 $colDef[
'xEndPos'] = $lastX;
1185 $colDef = $this->cols[$colKey];
1186 return $colDef[
'width'] - $colDef[
'content'][
'padding'][3] - $colDef[
'content'][
'padding'][1];
1198 $colDef = (isset($this->cols[$colKey]) ? $this->cols[$colKey] :
null);
1199 return (is_array($colDef) ? ((isset($colDef[
'xStartPos']) ? $colDef[
'xStartPos'] : 0) + $colDef[
'content'][
'padding'][3]) : 0);
1210 if (!isset($this->cols[$colKey][
'rank'])) {
1213 return $this->cols[$colKey][
'rank'];
1231 if (!empty($targetCol)) {
1233 if ($rank >= 0 && $insertAfterTarget) {
1239 if ($rank < 0 && !empty($defArray[
'rank'])) {
1240 $rank = $defArray[
'rank'];
1248 foreach ($this->cols as $colKey => & $colDef) {
1249 if ($rank <= $colDef[
'rank']) {
1250 $colDef[
'rank'] = $colDef[
'rank'] + 1;
1254 $defArray[
'rank'] = $rank;
1255 $this->cols[$newColKey] = $defArray;
1272 global $hookmanager;
1274 $parameters = array(
1276 'columnText' => $columnText,
1277 'colKey' => $colKey,
1280 $reshook = $hookmanager->executeHooks(
'printStdColumnContent', $parameters, $this);
1285 if (empty($columnText)) {
1289 $colDef = $this->cols[$colKey];
1291 $curentCellPaddinds = $pdf->getCellPaddings();
1293 $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);
1294 $pdf->writeHTMLCell($colDef[
'width'], 2, isset($colDef[
'xStartPos']) ? $colDef[
'xStartPos'] : 0, $curY, $columnText, 0, 1, 0,
true, $colDef[
'content'][
'align']);
1297 $pdf->setCellPaddings($curentCellPaddinds[
'L'], $curentCellPaddinds[
'T'], $curentCellPaddinds[
'R'], $curentCellPaddinds[
'B']);
1321 $colDef = $this->cols[$colKey];
1323 $curentCellPaddinds = $pdf->getCellPaddings();
1325 $pdf->setCellPaddings($colDef[
'content'][
'padding'][3], $colDef[
'content'][
'padding'][0], $colDef[
'content'][
'padding'][1], $colDef[
'content'][
'padding'][2]);
1328 pdf_writelinedesc($pdf,
$object, $i, $outputlangs, $colDef[
'width'], 3, $colDef[
'xStartPos'], $curY, $hideref, $hidedesc, $issupplierline, empty($colDef[
'content'][
'align']) ?
'J' : $colDef[
'content'][
'align']);
1329 $posYAfterDescription = $pdf->GetY() - $colDef[
'content'][
'padding'][0];
1332 $pdf->setCellPaddings($curentCellPaddinds[
'L'], $curentCellPaddinds[
'T'], $curentCellPaddinds[
'R'], $curentCellPaddinds[
'B']);
1336 'display' =>
'list',
1337 'printableEnable' => array(3),
1338 'printableEnableNotEmpty' => array(4)
1340 $extrafieldDesc = $this->getExtrafieldsInHtml(
$object->lines[$i], $outputlangs, $params);
1341 if (!empty($extrafieldDesc)) {
1357 global $hookmanager;
1359 if (empty(
$object->table_element)) {
1363 $extrafieldsKeyPrefix =
"options_";
1366 $pos = strpos($extrafieldKey, $extrafieldsKeyPrefix);
1368 $extrafieldKey = substr($extrafieldKey, strlen($extrafieldsKeyPrefix));
1371 $extrafieldOptionsKey = $extrafieldsKeyPrefix.$extrafieldKey;
1375 if (empty($this->extrafieldsCache)) {
1376 $this->extrafieldsCache =
new ExtraFields($this->db);
1378 if (empty($this->extrafieldsCache->attributes[
$object->table_element])) {
1379 $this->extrafieldsCache->fetch_name_optionals_label(
$object->table_element);
1381 $extrafields = $this->extrafieldsCache;
1383 $extrafieldOutputContent =
'';
1384 if (isset(
$object->array_options[$extrafieldOptionsKey])) {
1385 $extrafieldOutputContent = $extrafields->showOutputField($extrafieldKey,
$object->array_options[$extrafieldOptionsKey],
'',
$object->table_element, $outputlangs);
1389 if ($extrafields->attributes[
$object->table_element][
'type'][$extrafieldKey] ==
'link') {
1394 $parameters = array(
1396 'extrafields' => $extrafields,
1397 'extrafieldKey' => $extrafieldKey,
1398 'extrafieldOutputContent' => & $extrafieldOutputContent
1400 $reshook = $hookmanager->executeHooks(
'getPDFExtrafieldContent', $parameters, $this);
1405 $extrafieldOutputContent = $hookmanager->resPrint;
1408 return $extrafieldOutputContent;
1420 public function getExtrafieldsInHtml(
$object, $outputlangs, $params = array())
1422 global $hookmanager;
1424 if (empty(
$object->table_element)) {
1429 if (empty($this->extrafieldsCache)) {
1430 $this->extrafieldsCache =
new ExtraFields($this->db);
1432 if (empty($this->extrafieldsCache->attributes[
$object->table_element])) {
1433 $this->extrafieldsCache->fetch_name_optionals_label(
$object->table_element);
1435 $extrafields = $this->extrafieldsCache;
1437 $defaultParams = array(
1439 'display' =>
'auto',
1440 'printableEnable' => array(1),
1441 'printableEnableNotEmpty' => array(2),
1444 'maxItemsInRow' => 2,
1448 'labelcolwidth' =>
'25%',
1449 'arrayOfLineBreakType' => array(
'text',
'html')
1453 'separator' =>
'<br>'
1462 $params = $params + $defaultParams;
1471 if (!empty($extrafields->attributes[
$object->table_element][
'label']) && is_array($extrafields->attributes[
$object->table_element][
'label'])) {
1472 foreach ($extrafields->attributes[
$object->table_element][
'label'] as $key => $label) {
1475 $disableOnEmpty = 0;
1476 if (!empty($extrafields->attributes[
$object->table_element][
'printable'][$key])) {
1477 $printable = intval($extrafields->attributes[
$object->table_element][
'printable'][$key]);
1478 if (in_array($printable, $params[
'printableEnable']) || in_array($printable, $params[
'printableEnableNotEmpty'])) {
1482 if (in_array($printable, $params[
'printableEnableNotEmpty'])) {
1483 $disableOnEmpty = 1;
1487 if (empty($enabled)) {
1492 if (!empty($extrafields->attributes[
$object->table_element][
'langfile'][$key])) {
1493 $outputlangs->load($extrafields->attributes[
$object->table_element][
'langfile'][$key]);
1497 $field->rank = intval($extrafields->attributes[
$object->table_element][
'pos'][$key]);
1499 if (isset($extrafields->attributes[
$object->table_element][
'langfile'][$key])) {
1500 $outputlangs->load($extrafields->attributes[
$object->table_element][
'langfile'][$key]);
1502 $field->label = $outputlangs->transnoentities($label);
1503 $field->type = $extrafields->attributes[
$object->table_element][
'type'][$key];
1506 if ($disableOnEmpty && empty($field->content)) {
1514 if (!empty($fields)) {
1523 static function ($a, $b) {
1524 return ($a->rank > $b->rank) ? 1 : -1;
1529 $html .= !empty($params[
'style']) ?
'<style>'.$params[
'style'].
'</style>' :
'';
1532 if ($params[
'display'] ==
'auto') {
1533 $lastNnumbItems = 0;
1534 foreach ($params[
'auto'] as $display => $numbItems) {
1535 if ($lastNnumbItems <= $numbItems && count($fields) > $numbItems) {
1536 $lastNnumbItems = $numbItems;
1537 $params[
'display'] = $display;
1542 if ($params[
'display'] ==
'list') {
1545 foreach ($fields as $field) {
1546 $html .= !empty($i) ? $params[
'list'][
'separator'] :
'';
1547 $html .=
'<strong>'.$field->label.
' : </strong>';
1548 $html .= $field->content;
1551 } elseif ($params[
'display'] ==
'table') {
1553 $html .=
'<table class="extrafield-table" cellspacing="'.$params[
'table'][
'cellspacing'].
'" cellpadding="'.$params[
'table'][
'cellpadding'].
'" border="'.$params[
'table'][
'border'].
'">';
1557 $maxItemsInRow = $params[
'table'][
'maxItemsInRow'];
1558 foreach ($fields as $field) {
1560 if ($itemsInRow >= $maxItemsInRow) {
1562 $html .=
"</tr><tr>";
1567 if (in_array($field->type, $params[
'table'][
'arrayOfLineBreakType'])) {
1568 if ($itemsInRow > 0) {
1570 for ($i = $itemsInRow; $i <= $maxItemsInRow; $i++) {
1571 $html .=
"<td></td><td></td>";
1579 $itemsInRow = $maxItemsInRow;
1580 $html .=
'<td colspan="'.($maxItemsInRow * 2 - 1).
'">';
1581 $html .=
'<strong>'.$field->label.
' :</strong> ';
1582 $html .= $field->content;
1586 $html .=
'<td width="'.$params[
'table'][
'labelcolwidth'].
'" class="extrafield-label">';
1587 $html .=
'<strong>'.$field->label.
' :</strong>';
1591 $html .=
'<td class="extrafield-content">';
1592 $html .= $field->content;
1598 $html .=
'</table>';
1614 if (!empty($this->cols[$colKey][
'status'])) {
1631 public function pdfTabTitles(&$pdf, $tab_top, $tab_height, $outputlangs, $hidetop = 0)
1633 global $hookmanager, $conf;
1635 foreach ($this->cols as $colKey => $colDef) {
1636 $parameters = array(
1637 'colKey' => $colKey,
1639 'outputlangs' => $outputlangs,
1640 'tab_top' => $tab_top,
1641 'tab_height' => $tab_height,
1642 'hidetop' => $hidetop
1645 $reshook = $hookmanager->executeHooks(
'pdfTabTitles', $parameters, $this);
1648 } elseif (empty($reshook)) {
1654 $colDef[
'title'][
'label'] = !empty($colDef[
'title'][
'label']) ? $colDef[
'title'][
'label'] : $outputlangs->transnoentities($colDef[
'title'][
'textkey']);
1657 if (!empty($colDef[
'border-left']) && isset($colDef[
'xStartPos'])) {
1658 $pdf->line($colDef[
'xStartPos'], $tab_top, $colDef[
'xStartPos'], $tab_top + $tab_height);
1661 if (empty($hidetop)) {
1663 $curentCellPaddinds = $pdf->getCellPaddings();
1666 global $outputlangsbis;
1667 if (is_object($outputlangsbis)) {
1669 $pdf->setCellPaddings($colDef[
'title'][
'padding'][3], $colDef[
'title'][
'padding'][0], $colDef[
'title'][
'padding'][1], 0.5);
1672 $pdf->setCellPaddings($colDef[
'title'][
'padding'][3], $colDef[
'title'][
'padding'][0], $colDef[
'title'][
'padding'][1], $colDef[
'title'][
'padding'][2]);
1674 if (isset($colDef[
'title'][
'align'])) {
1675 $align = $colDef[
'title'][
'align'];
1679 $pdf->SetXY($colDef[
'xStartPos'], $tab_top);
1680 $textWidth = $colDef[
'width'];
1681 $pdf->MultiCell($textWidth, 2, $colDef[
'title'][
'label'],
'', $align);
1684 if (is_object($outputlangsbis) && trim($colDef[
'title'][
'label'])) {
1685 $pdf->setCellPaddings($colDef[
'title'][
'padding'][3], 0, $colDef[
'title'][
'padding'][1], $colDef[
'title'][
'padding'][2]);
1686 $pdf->SetXY($colDef[
'xStartPos'], $pdf->GetY());
1687 $textbis = $outputlangsbis->transnoentities($colDef[
'title'][
'textkey']);
1688 $pdf->MultiCell($textWidth, 2, $textbis,
'', $align);
1691 $this->tabTitleHeight = max($pdf->GetY() - $tab_top, $this->tabTitleHeight);
1694 $pdf->setCellPaddings($curentCellPaddinds[
'L'], $curentCellPaddinds[
'T'], $curentCellPaddinds[
'R'], $curentCellPaddinds[
'B']);
1699 return $this->tabTitleHeight;
1714 if (!empty($hidedetails)) {
1718 if (empty(
$object->table_element)) {
1723 if (empty($this->extrafieldsCache)) {
1724 $this->extrafieldsCache =
new ExtraFields($this->db);
1726 if (empty($this->extrafieldsCache->attributes[
$object->table_element])) {
1727 $this->extrafieldsCache->fetch_name_optionals_label(
$object->table_element);
1729 $extrafields = $this->extrafieldsCache;
1732 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'])) {
1733 foreach ($extrafields->attributes[
$object->table_element][
'label'] as $key => $label) {
1735 if ($extrafields->attributes[
$object->table_element][
'type'][$key] ==
'separate') {
1741 if (!empty($extrafields->attributes[
$object->table_element][
'printable'][$key])) {
1742 $printable = intval($extrafields->attributes[
$object->table_element][
'printable'][$key]);
1743 if ($printable === 1 || $printable === 2) {
1754 if (!empty($extrafields->attributes[
$object->table_element][
'langfile'][$key])) {
1755 $outputlangs->load($extrafields->attributes[
$object->table_element][
'langfile'][$key]);
1762 'rank' => intval($extrafields->attributes[
$object->table_element][
'pos'][$key]),
1764 'status' => (
bool) $enabled,
1766 'label' => $outputlangs->transnoentities($label)
1771 'border-left' =>
true,
1774 $alignTypeRight = array(
'double',
'int',
'price');
1775 if (in_array($extrafields->attributes[
$object->table_element][
'type'][$key], $alignTypeRight)) {
1776 $def[
'content'][
'align'] =
'R';
1779 $alignTypeLeft = array(
'text',
'html');
1780 if (in_array($extrafields->attributes[
$object->table_element][
'type'][$key], $alignTypeLeft)) {
1781 $def[
'content'][
'align'] =
'L';
1807 $this->defaultContentsFieldsStyle = array(
1809 'padding' => array(1, 0.5, 1, 0.5),
1813 $this->defaultTitlesFieldsStyle = array(
1815 'padding' => array(0.5, 0, 0.5, 0),
if( $user->socid > 0) if(! $user->hasRight('accounting', 'chartofaccount')) $object
Class to manage bank accounts.
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...
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.
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_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.
setEventMessages($mesg, $mesgs, $style='mesgs', $messagekey='', $noduplicate=0)
Set event messages in dol_events session object.
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($unit, $measuring_style='', $scale='', $use_short_label=0, $outputlangs=null)
Return translation label of a unit key.