51 public $errors = array();
61 public $extrafieldsCache;
66 public $update_main_doc_field;
97 public $option_multilang;
98 public $option_freetext;
99 public $option_draft_watermark;
102 public $option_modereg;
103 public $option_condreg;
104 public $option_escompte;
105 public $option_credit_note;
113 public $phpmin = array(7, 1);
143 global $conf, $extrafields;
145 $logotouse = $conf->user->dir_output.
'/'.
get_exdir($user->id, 2, 0, 1, $user,
'user').
'/'.$user->photo;
148 'myuser_lastname'=>$user->lastname,
149 'myuser_firstname'=>$user->firstname,
150 'myuser_fullname'=>$user->getFullName($outputlangs, 1),
151 'myuser_login'=>$user->login,
152 'myuser_phone'=>$user->office_phone,
153 'myuser_address'=>$user->address,
154 'myuser_zip'=>$user->zip,
155 'myuser_town'=>$user->town,
156 'myuser_country'=>$user->country,
157 'myuser_country_code'=>$user->country_code,
158 'myuser_state'=>$user->state,
159 'myuser_state_code'=>$user->state_code,
160 'myuser_fax'=>$user->office_fax,
161 'myuser_mobile'=>$user->user_mobile,
162 'myuser_email'=>$user->email,
163 'myuser_logo'=>$logotouse,
164 'myuser_job'=>$user->job,
167 'myuser_dateemployment'=>
dol_print_date($user->dateemployment,
'day',
'tzuser'),
168 'myuser_dateemploymentend'=>
dol_print_date($user->dateemploymentend,
'day',
'tzuser'),
169 'myuser_gender'=>$user->gender,
172 if (is_array($user->array_options) && count($user->array_options)) {
188 global $conf, $extrafields;
190 if ($member->photo) {
191 $logotouse = $conf->adherent->dir_output.
'/'.
get_exdir(0, 0, 0, 1, $member,
'user').
'/photos/'.$member->photo;
193 $logotouse = DOL_DOCUMENT_ROOT.
'/public/theme/common/nophoto.png';
196 $array_member = array(
197 'mymember_lastname' => $member->lastname,
198 'mymember_firstname' => $member->firstname,
199 'mymember_fullname' => $member->getFullName($outputlangs, 1),
200 'mymember_login' => $member->login,
201 'mymember_address' => $member->address,
202 'mymember_zip' => $member->zip,
203 'mymember_town' => $member->town,
204 'mymember_country_code' => $member->country_code,
205 'mymember_country' => $member->country,
206 'mymember_state_code' => $member->state_code,
207 'mymember_state' => $member->state,
208 'mymember_phone_perso' => $member->phone_perso,
209 'mymember_phone_pro' => $member->phone,
210 'mymember_phone_mobile' => $member->phone_mobile,
211 'mymember_email' => $member->email,
212 'mymember_logo' => $logotouse,
213 'mymember_gender' => $member->gender,
214 'mymember_birth_locale' =>
dol_print_date($member->birth,
'day',
'tzuser', $outputlangs),
215 'mymember_birth' =>
dol_print_date($member->birth,
'day',
'tzuser'),
218 if (is_array($member->array_options) && count($member->array_options)) {
221 return $array_member;
238 if (empty($mysoc->forme_juridique) && !empty($mysoc->forme_juridique_code)) {
241 if (empty($mysoc->country) && !empty($mysoc->country_code)) {
242 $mysoc->country = $outputlangs->transnoentitiesnoconv(
"Country".$mysoc->country_code);
244 if (empty($mysoc->state) && !empty($mysoc->state_code)) {
245 $mysoc->state =
getState($mysoc->state_code, 0);
248 $logotouse = $conf->mycompany->dir_output.
'/logos/thumbs/'.$mysoc->logo_small;
251 'mycompany_logo'=>$logotouse,
252 'mycompany_name'=>$mysoc->name,
253 'mycompany_email'=>$mysoc->email,
254 'mycompany_phone'=>$mysoc->phone,
255 'mycompany_fax'=>$mysoc->fax,
256 'mycompany_address'=>$mysoc->address,
257 'mycompany_zip'=>$mysoc->zip,
258 'mycompany_town'=>$mysoc->town,
259 'mycompany_country'=>$mysoc->country,
260 'mycompany_country_code'=>$mysoc->country_code,
261 'mycompany_state'=>$mysoc->state,
262 'mycompany_state_code'=>$mysoc->state_code,
263 'mycompany_web'=>$mysoc->url,
264 'mycompany_juridicalstatus'=>$mysoc->forme_juridique,
265 'mycompany_managers'=>$mysoc->managers,
266 'mycompany_capital'=>$mysoc->capital,
267 'mycompany_barcode'=>$mysoc->barcode,
268 'mycompany_idprof1'=>$mysoc->idprof1,
269 'mycompany_idprof2'=>$mysoc->idprof2,
270 'mycompany_idprof3'=>$mysoc->idprof3,
271 'mycompany_idprof4'=>$mysoc->idprof4,
272 'mycompany_idprof5'=>$mysoc->idprof5,
273 'mycompany_idprof6'=>$mysoc->idprof6,
274 'mycompany_vatnumber'=>$mysoc->tva_intra,
275 'mycompany_socialobject'=>$mysoc->socialobject,
276 'mycompany_note_private'=>$mysoc->note_private,
295 global $conf, $extrafields;
297 if (empty($object->country) && !empty($object->country_code)) {
298 $object->country = $outputlangs->transnoentitiesnoconv(
"Country".$object->country_code);
300 if (empty($object->state) && !empty($object->state_code)) {
301 $object->state =
getState($object->state_code, 0);
304 $array_thirdparty = array(
305 'company_name'=>$object->name,
306 'company_name_alias' => $object->name_alias,
307 'company_email'=>$object->email,
308 'company_phone'=>$object->phone,
309 'company_fax'=>$object->fax,
310 'company_address'=>$object->address,
311 'company_zip'=>$object->zip,
312 'company_town'=>$object->town,
313 'company_country'=>$object->country,
314 'company_country_code'=>$object->country_code,
315 'company_state'=>$object->state,
316 'company_state_code'=>$object->state_code,
317 'company_web'=>$object->url,
318 'company_barcode'=>$object->barcode,
319 'company_vatnumber'=>$object->tva_intra,
320 'company_customercode'=>$object->code_client,
321 'company_suppliercode'=>$object->code_fournisseur,
322 'company_customeraccountancycode'=>$object->code_compta,
323 'company_supplieraccountancycode'=>$object->code_compta_fournisseur,
324 'company_juridicalstatus'=>$object->forme_juridique,
325 'company_outstanding_limit'=>$object->outstanding_limit,
326 'company_capital'=>$object->capital,
327 'company_capital_formated'=>
price($object->capital, 0,
'', 1, -1),
328 'company_idprof1'=>$object->idprof1,
329 'company_idprof2'=>$object->idprof2,
330 'company_idprof3'=>$object->idprof3,
331 'company_idprof4'=>$object->idprof4,
332 'company_idprof5'=>$object->idprof5,
333 'company_idprof6'=>$object->idprof6,
334 'company_note_public'=>$object->note_public,
335 'company_note_private'=>$object->note_private,
336 'company_default_bank_iban'=>(is_object($object->bank_account) ? $object->bank_account->iban :
''),
337 'company_default_bank_bic'=>(is_object($object->bank_account) ? $object->bank_account->bic :
'')
341 if (is_array($object->array_options) && count($object->array_options)) {
342 $object->fetch_optionals();
346 return $array_thirdparty;
361 global $conf, $extrafields;
363 if (empty($object->country) && !empty($object->country_code)) {
364 $object->country = $outputlangs->transnoentitiesnoconv(
"Country".$object->country_code);
366 if (empty($object->state) && !empty($object->state_code)) {
367 $object->state =
getState($object->state_code, 0);
370 $array_contact = array(
371 $array_key.
'_fullname' => $object->getFullName($outputlangs, 1),
372 $array_key.
'_lastname' => $object->lastname,
373 $array_key.
'_firstname' => $object->firstname,
374 $array_key.
'_address' => $object->address,
375 $array_key.
'_zip' => $object->zip,
376 $array_key.
'_town' => $object->town,
377 $array_key.
'_state_id' => $object->state_id,
378 $array_key.
'_state_code' => $object->state_code,
379 $array_key.
'_state' => $object->state,
380 $array_key.
'_country_id' => $object->country_id,
381 $array_key.
'_country_code' => $object->country_code,
382 $array_key.
'_country' => $object->country,
383 $array_key.
'_poste' => $object->poste,
384 $array_key.
'_socid' => $object->socid,
385 $array_key.
'_statut' => $object->statut,
386 $array_key.
'_code' => $object->code,
387 $array_key.
'_email' => $object->email,
388 $array_key.
'_phone_pro' => $object->phone_pro,
389 $array_key.
'_phone_perso' => $object->phone_perso,
390 $array_key.
'_phone_mobile' => $object->phone_mobile,
391 $array_key.
'_fax' => $object->fax,
392 $array_key.
'_birthday' => $object->birthday,
393 $array_key.
'_default_lang' => $object->default_lang,
394 $array_key.
'_note_public' => $object->note_public,
395 $array_key.
'_note_private' => $object->note_private,
396 $array_key.
'_civility' => $object->civility,
400 if (is_array($object->array_options) && count($object->array_options)) {
401 $object->fetch_optionals();
405 return $array_contact;
422 $array_other = array(
427 'current_server_datehour'=>
dol_print_date($now,
'dayhour',
'tzserver'),
429 'current_date_locale'=>
dol_print_date($now,
'day',
'tzuser', $outputlangs),
430 'current_datehour_locale'=>
dol_print_date($now,
'dayhour',
'tzuser', $outputlangs),
431 'current_server_date_locale'=>
dol_print_date($now,
'day',
'tzserver', $outputlangs),
432 'current_server_datehour_locale'=>
dol_print_date($now,
'dayhour',
'tzserver', $outputlangs),
436 foreach ($conf->global as $key => $val) {
438 $newval =
'*****forbidden*****';
442 $array_other[
'__['.$key.
']__'] = $newval;
462 global $conf, $extrafields;
464 $sumpayed = $sumdeposit = $sumcreditnote =
'';
465 $already_payed_all = 0;
467 if ($object->element ==
'facture') {
468 $invoice_source =
new Facture($this->db);
469 if ($object->fk_facture_source > 0) {
470 $invoice_source->fetch($object->fk_facture_source);
472 $sumpayed = $object->getSommePaiement();
473 $sumdeposit = $object->getSumDepositsUsed();
474 $sumcreditnote = $object->getSumCreditNotesUsed();
475 $already_payed_all = $sumpayed + $sumdeposit + $sumcreditnote;
477 if ($object->fk_account > 0) {
478 require_once DOL_DOCUMENT_ROOT.
'/compta/bank/class/account.class.php';
479 $bank_account =
new Account($this->db);
480 $bank_account->fetch($object->fk_account);
484 $date = (isset($object->element) && $object->element ==
'contrat' && isset($object->date_contrat)) ? $object->date_contrat : (isset($object->date) ? $object->date :
null);
486 if (get_class($object) ==
'CommandeFournisseur') {
488 $object->date_validation = $object->date_valid;
489 $object->date_commande = $object->date;
492 $array_key.
'_id'=>$object->id,
493 $array_key.
'_ref' => (property_exists($object,
'ref') ? $object->ref :
''),
494 $array_key.
'_label' => (property_exists($object,
'label') ? $object->label :
''),
495 $array_key.
'_ref_ext' => (property_exists($object,
'ref_ext') ? $object->ref_ext :
''),
496 $array_key.
'_ref_customer'=>(!empty($object->ref_client) ? $object->ref_client : (empty($object->ref_customer) ?
'' : $object->ref_customer)),
497 $array_key.
'_ref_supplier'=>(!empty($object->ref_fournisseur) ? $object->ref_fournisseur : (empty($object->ref_supplier) ?
'' : $object->ref_supplier)),
498 $array_key.
'_source_invoice_ref'=>((empty($invoice_source) || empty($invoice_source->ref)) ?
'' : $invoice_source->ref),
503 $array_key.
'_date_limit'=>(!empty($object->date_lim_reglement) ?
dol_print_date($object->date_lim_reglement,
'day') :
''),
504 $array_key.
'_date_limit_rfc'=>(!empty($object->date_lim_reglement) ?
dol_print_date($object->date_lim_reglement,
'dayrfc') :
''),
505 $array_key.
'_date_end'=>(!empty($object->fin_validite) ?
dol_print_date($object->fin_validite,
'day') :
''),
506 $array_key.
'_date_creation'=>
dol_print_date($object->date_creation,
'day'),
507 $array_key.
'_date_modification'=>(!empty($object->date_modification) ?
dol_print_date($object->date_modification,
'day') :
''),
508 $array_key.
'_date_validation'=>(!empty($object->date_validation) ?
dol_print_date($object->date_validation,
'dayhour') :
''),
509 $array_key.
'_date_approve'=>(!empty($object->date_approve) ?
dol_print_date($object->date_approve,
'day') :
''),
510 $array_key.
'_date_delivery_planed'=>(!empty($object->delivery_date) ?
dol_print_date($object->delivery_date,
'day') :
''),
511 $array_key.
'_date_close'=>(!empty($object->date_cloture) ?
dol_print_date($object->date_cloture,
'dayhour') :
''),
513 $array_key.
'_payment_mode_code'=>$object->mode_reglement_code,
514 $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),
515 $array_key.
'_payment_term_code'=>$object->cond_reglement_code,
516 $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)),
518 $array_key.
'_incoterms' => (method_exists($object,
'display_incoterms') ? $object->display_incoterms() :
''),
520 $array_key.
'_bank_iban' => (!empty($bank_account) ? $bank_account->iban :
''),
521 $array_key.
'_bank_bic' => (!empty($bank_account) ? $bank_account->bic :
''),
522 $array_key.
'_bank_label' => (!empty($bank_account) ? $bank_account->label :
''),
523 $array_key.
'_bank_number' => (!empty($bank_account) ? $bank_account->number :
''),
524 $array_key.
'_bank_proprio' => (!empty($bank_account) ? $bank_account->proprio :
''),
526 $array_key.
'_total_ht_locale'=>
price($object->total_ht, 0, $outputlangs),
527 $array_key.
'_total_vat_locale'=>(!empty($object->total_vat) ?
price($object->total_vat, 0, $outputlangs) :
price($object->total_tva, 0, $outputlangs)),
528 $array_key.
'_total_localtax1_locale'=>
price($object->total_localtax1, 0, $outputlangs),
529 $array_key.
'_total_localtax2_locale'=>
price($object->total_localtax2, 0, $outputlangs),
530 $array_key.
'_total_ttc_locale'=>
price($object->total_ttc, 0, $outputlangs),
532 $array_key.
'_total_ht'=>
price2num($object->total_ht),
533 $array_key.
'_total_vat'=>(!empty($object->total_vat) ?
price2num($object->total_vat) :
price2num($object->total_tva)),
534 $array_key.
'_total_localtax1'=>
price2num($object->total_localtax1),
535 $array_key.
'_total_localtax2'=>
price2num($object->total_localtax2),
536 $array_key.
'_total_ttc'=>
price2num($object->total_ttc),
538 $array_key.
'_multicurrency_code' => $object->multicurrency_code,
539 $array_key.
'_multicurrency_tx' =>
price2num($object->multicurrency_tx),
540 $array_key.
'_multicurrency_total_ht' =>
price2num($object->multicurrency_total_ht),
541 $array_key.
'_multicurrency_total_tva' =>
price2num($object->multicurrency_total_tva),
542 $array_key.
'_multicurrency_total_ttc' =>
price2num($object->multicurrency_total_ttc),
543 $array_key.
'_multicurrency_total_ht_locale' =>
price($object->multicurrency_total_ht, 0, $outputlangs),
544 $array_key.
'_multicurrency_total_tva_locale' =>
price($object->multicurrency_total_tva, 0, $outputlangs),
545 $array_key.
'_multicurrency_total_ttc_locale' =>
price($object->multicurrency_total_ttc, 0, $outputlangs),
547 $array_key.
'_note_private'=>$object->note,
548 $array_key.
'_note_public'=>$object->note_public,
549 $array_key.
'_note'=>$object->note_public,
552 $array_key.
'_already_payed_locale'=>
price($sumpayed, 0, $outputlangs),
553 $array_key.
'_already_payed'=>
price2num($sumpayed),
554 $array_key.
'_already_deposit_locale'=>
price($sumdeposit, 0, $outputlangs),
555 $array_key.
'_already_deposit'=>
price2num($sumdeposit),
556 $array_key.
'_already_creditnote_locale'=>
price($sumcreditnote, 0, $outputlangs),
557 $array_key.
'_already_creditnote'=>
price2num($sumcreditnote),
559 $array_key.
'_already_payed_all_locale'=>
price(
price2num($already_payed_all,
'MT'), 0, $outputlangs),
560 $array_key.
'_already_payed_all'=>
price2num($already_payed_all,
'MT'),
563 $array_key.
'_remain_to_pay_locale'=>
price(
price2num($object->total_ttc - $already_payed_all,
'MT'), 0, $outputlangs),
564 $array_key.
'_remain_to_pay'=>
price2num($object->total_ttc - $already_payed_all,
'MT')
567 if (method_exists($object,
'getTotalDiscount') && in_array(get_class($object), array(
'Propal',
'Proposal',
'Commande',
'Facture',
'SupplierProposal',
'CommandeFournisseur',
'FactureFournisseur'))) {
568 $resarray[$array_key.
'_total_discount_ht_locale'] =
price($object->getTotalDiscount(), 0, $outputlangs);
569 $resarray[$array_key.
'_total_discount_ht'] =
price2num($object->getTotalDiscount());
571 $resarray[$array_key.
'_total_discount_ht_locale'] =
'';
572 $resarray[$array_key.
'_total_discount_ht'] =
'';
576 if ($object->element !=
"project" && !empty($object->fk_project) && $object->fk_project > 0) {
577 if (!is_object($object->project)) {
578 $object->fetch_projet();
581 $resarray[$array_key.
'_project_ref'] = $object->project->ref;
582 $resarray[$array_key.
'_project_title'] = $object->project->title;
583 $resarray[$array_key.
'_project_description'] = $object->project->description;
584 $resarray[$array_key.
'_project_date_start'] =
dol_print_date($object->project->date_start,
'day');
585 $resarray[$array_key.
'_project_date_end'] =
dol_print_date($object->project->date_end,
'day');
587 $resarray[$array_key.
'_project_ref'] =
'';
588 $resarray[$array_key.
'_project_title'] =
'';
589 $resarray[$array_key.
'_project_description'] =
'';
590 $resarray[$array_key.
'_project_date_start'] =
'';
591 $resarray[$array_key.
'_project_date_end'] =
'';
595 if (is_array($object->lines) && count($object->lines) > 0) {
598 foreach ($object->lines as $line) {
600 if (empty($resarray[$array_key.
'_total_vat_'.$line->tva_tx])) {
601 $resarray[$array_key.
'_total_vat_'.$line->tva_tx] = 0;
603 $resarray[$array_key.
'_total_vat_'.$line->tva_tx] += $line->total_tva;
604 $resarray[$array_key.
'_total_vat_locale_'.$line->tva_tx] =
price($resarray[$array_key.
'_total_vat_'.$line->tva_tx]);
606 $vatformated =
vatrate($line->tva_tx);
607 if (empty($resarray[$array_key.
'_total_vat_'.$vatformated])) {
608 $resarray[$array_key.
'_total_vat_'.$vatformated] = 0;
610 $resarray[$array_key.
'_total_vat_'.$vatformated] += $line->total_tva;
611 $resarray[$array_key.
'_total_vat_locale_'.$vatformated] =
price($resarray[$array_key.
'_total_vat_'.$vatformated]);
613 $totalUp += $line->subprice * $line->qty;
618 $resarray[
'object_total_up'] = $totalUp;
619 $resarray[
'object_total_up_locale'] =
price($resarray[
'object_total_up'], 0, $outputlangs);
620 if (method_exists($object,
'getTotalDiscount') && in_array(get_class($object), array(
'Propal',
'Proposal',
'Commande',
'Facture',
'SupplierProposal',
'CommandeFournisseur',
'FactureFournisseur'))) {
621 $totalDiscount = $object->getTotalDiscount();
625 if (!empty($totalUp) && !empty($totalDiscount)) {
626 $resarray[
'object_total_discount'] = round(100 / $totalUp * $totalDiscount, 2);
627 $resarray[
'object_total_discount_locale'] =
price($resarray[
'object_total_discount'], 0, $outputlangs);
629 $resarray[
'object_total_discount'] =
'';
630 $resarray[
'object_total_discount_locale'] =
'';
635 if (is_array($object->array_options) && count($object->array_options)) {
636 $object->fetch_optionals();
658 'line_pos' => $linenumber,
661 'line_product_ref'=>(empty($line->product_ref) ?
'' : $line->product_ref),
662 'line_product_ref_fourn'=>(empty($line->ref_fourn) ?
'' : $line->ref_fourn),
663 'line_product_label'=>(empty($line->product_label) ?
'' : $line->product_label),
664 'line_product_type'=>(empty($line->product_type) ?
'' : $line->product_type),
665 'line_product_barcode'=>(empty($line->product_barcode) ?
'' : $line->product_barcode),
666 'line_product_desc'=>(empty($line->product_desc) ?
'' : $line->product_desc),
668 'line_desc'=>$line->desc,
669 'line_vatrate'=>
vatrate($line->tva_tx,
true, $line->info_bits),
670 'line_localtax1_rate'=>
vatrate($line->localtax1_tx),
671 'line_localtax2_rate'=>
vatrate($line->localtax1_tx),
673 'line_up_locale'=>
price($line->subprice, 0, $outputlangs),
674 'line_total_up'=>
price2num($line->subprice * $line->qty),
675 'line_total_up_locale'=>
price($line->subprice * $line->qty, 0, $outputlangs),
676 'line_qty'=>$line->qty,
677 'line_discount_percent'=>($line->remise_percent ? $line->remise_percent.
'%' :
''),
678 'line_price_ht'=>
price2num($line->total_ht),
679 'line_price_ttc'=>
price2num($line->total_ttc),
680 'line_price_vat'=>
price2num($line->total_tva),
681 'line_price_ht_locale'=>
price($line->total_ht, 0, $outputlangs),
682 'line_price_ttc_locale'=>
price($line->total_ttc, 0, $outputlangs),
683 'line_price_vat_locale'=>
price($line->total_tva, 0, $outputlangs),
686 'line_date_start_locale'=>
dol_print_date($line->date_start,
'day',
'tzserver', $outputlangs),
687 'line_date_start_rfc'=>
dol_print_date($line->date_start,
'dayrfc'),
689 'line_date_end_locale'=>
dol_print_date($line->date_end,
'day',
'tzserver', $outputlangs),
692 'line_multicurrency_code' =>
price2num($line->multicurrency_code),
693 'line_multicurrency_subprice' =>
price2num($line->multicurrency_subprice),
694 'line_multicurrency_total_ht' =>
price2num($line->multicurrency_total_ht),
695 'line_multicurrency_total_tva' =>
price2num($line->multicurrency_total_tva),
696 'line_multicurrency_total_ttc' =>
price2num($line->multicurrency_total_ttc),
697 'line_multicurrency_subprice_locale' =>
price($line->multicurrency_subprice, 0, $outputlangs),
698 'line_multicurrency_total_ht_locale' =>
price($line->multicurrency_total_ht, 0, $outputlangs),
699 'line_multicurrency_total_tva_locale' =>
price($line->multicurrency_total_tva, 0, $outputlangs),
700 'line_multicurrency_total_ttc_locale' =>
price($line->multicurrency_total_ttc, 0, $outputlangs),
705 $resarray[
'line_unit'] = $outputlangs->trans($line->getLabelOfUnit(
'long'));
706 $resarray[
'line_unit_short'] = $outputlangs->trans($line->getLabelOfUnit(
'short'));
710 $extrafieldkey = $line->table_element;
712 require_once DOL_DOCUMENT_ROOT.
'/core/class/extrafields.class.php';
714 $extrafields->fetch_name_optionals_label($extrafieldkey,
true);
715 $line->fetch_optionals();
720 if (get_class($line) ==
'CommandeFournisseurLigne') {
722 $extrafields->fetch_name_optionals_label(
"product_fournisseur_price");
723 $extralabels = $extrafields->attributes[
"product_fournisseur_price"][
'label'];
725 if (!empty($extralabels) && is_array($extralabels)) {
728 foreach ($extralabels as $key => $label) {
729 $columns .=
"$key, ";
732 if ($columns !=
"") {
733 $columns = substr($columns, 0, strlen($columns) - 2);
734 $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).
"'");
736 if ($this->db->num_rows($resql) > 0) {
737 $resql = $this->db->fetch_object($resql);
739 foreach ($extralabels as $key => $label) {
740 $resarray[
'line_product_supplier_'.$key] = $resql->$key;
748 if (isset($line->fk_product) && $line->fk_product > 0) {
749 $tmpproduct =
new Product($this->db);
750 $result = $tmpproduct->fetch($line->fk_product);
751 if (!empty($tmpproduct->array_options) && is_array($tmpproduct->array_options)) {
752 foreach ($tmpproduct->array_options as $key => $label) {
753 $resarray[
"line_product_".$key] = $label;
758 $extrafields->fetch_name_optionals_label(
"product");
759 $extralabels = $extrafields->attributes[
"product"][
'label'];
761 if (!empty($extralabels) && is_array($extralabels)) {
762 foreach ($extralabels as $key => $label) {
763 $resarray[
'line_product_options_'.$key] =
'';
784 global $conf, $extrafields;
786 $object->list_delivery_methods($object->shipping_method_id);
787 $calculatedVolume = ($object->trueWidth * $object->trueHeight * $object->trueDepth);
789 $array_shipment = array(
790 $array_key.
'_id'=>$object->id,
791 $array_key.
'_ref'=>$object->ref,
792 $array_key.
'_ref_ext'=>$object->ref_ext,
793 $array_key.
'_ref_customer'=>$object->ref_customer,
794 $array_key.
'_date_delivery'=>
dol_print_date($object->date_delivery,
'day'),
795 $array_key.
'_hour_delivery'=>
dol_print_date($object->date_delivery,
'hour'),
796 $array_key.
'_date_creation'=>
dol_print_date($object->date_creation,
'day'),
797 $array_key.
'_total_ht'=>
price($object->total_ht),
798 $array_key.
'_total_vat'=>
price($object->total_tva),
799 $array_key.
'_total_ttc'=>
price($object->total_ttc),
800 $array_key.
'_total_discount_ht' =>
price($object->getTotalDiscount()),
801 $array_key.
'_note_private'=>$object->note_private,
802 $array_key.
'_note'=>$object->note_public,
803 $array_key.
'_tracking_number'=>$object->tracking_number,
804 $array_key.
'_tracking_url'=>$object->tracking_url,
805 $array_key.
'_shipping_method'=>$object->listmeths[0][
'libelle'],
806 $array_key.
'_weight'=>$object->trueWeight.
' '.
measuringUnitString(0,
'weight', $object->weight_units),
807 $array_key.
'_width'=>$object->trueWidth.
' '.
measuringUnitString(0,
'size', $object->width_units),
808 $array_key.
'_height'=>$object->trueHeight.
' '.
measuringUnitString(0,
'size', $object->height_units),
809 $array_key.
'_depth'=>$object->trueDepth.
' '.
measuringUnitString(0,
'size', $object->depth_units),
814 foreach ($object->lines as $line) {
815 if (empty($array_shipment[$array_key.
'_total_vat_'.$line->tva_tx])) {
816 $array_shipment[$array_key.
'_total_vat_'.$line->tva_tx] = 0;
818 $array_shipment[$array_key.
'_total_vat_'.$line->tva_tx] += $line->total_tva;
822 if (is_array($object->array_options) && count($object->array_options)) {
823 $object->fetch_optionals();
829 if (!empty($object->commande) && is_object($object->commande)) {
830 $array_shipment[
'order_ref'] = $object->commande->ref;
831 $array_shipment[
'order_ref_customer'] = $object->commande->ref_customer;
834 return $array_shipment;
854 'line_product_ref'=>$line->product_ref,
855 'line_product_label'=>$line->product_label,
856 'line_desc'=>$line->desc,
857 'line_vatrate'=>
vatrate($line->tva_tx,
true, $line->info_bits),
858 'line_up'=>
price($line->subprice),
859 'line_total_up'=>
price($line->subprice * $line->qty),
860 'line_qty'=>$line->qty,
861 'line_qty_shipped'=>$line->qty_shipped,
862 'line_qty_asked'=>$line->qty_asked,
863 'line_discount_percent'=>($line->remise_percent ? $line->remise_percent.
'%' :
''),
864 'line_price_ht'=>
price($line->total_ht),
865 'line_price_ttc'=>
price($line->total_ttc),
866 'line_price_vat'=>
price($line->total_tva),
867 'line_weight'=>empty($line->weight) ?
'' : $line->weight * $line->qty_shipped.
' '.
measuringUnitString(0,
'weight', $line->weight_units),
868 'line_length'=>empty($line->length) ?
'' : $line->length * $line->qty_shipped.
' '.
measuringUnitString(0,
'size', $line->length_units),
869 'line_surface'=>empty($line->surface) ?
'' : $line->surface * $line->qty_shipped.
' '.
measuringUnitString(0,
'surface', $line->surface_units),
870 'line_volume'=>empty($line->volume) ?
'' : $line->volume * $line->qty_shipped.
' '.
measuringUnitString(0,
'volume', $line->volume_units),
874 $extrafieldkey = $line->element;
876 require_once DOL_DOCUMENT_ROOT.
'/core/class/extrafields.class.php';
878 $extrafields->fetch_name_optionals_label($extrafieldkey,
true);
879 $line->fetch_optionals();
884 if (isset($line->fk_product) && $line->fk_product > 0) {
885 $tmpproduct =
new Product($this->db);
886 $tmpproduct->fetch($line->fk_product);
887 if (!empty($tmpproduct->array_options) && is_array($tmpproduct->array_options)) {
888 foreach ($tmpproduct->array_options as $key=>$label) {
889 $resarray[
"line_product_".$key] = $label;
910 $array_other = array();
911 if (!empty($object)) {
912 foreach ($object as $key => $value) {
913 if (in_array($key, array(
'db',
'fields',
'lines',
'modelpdf',
'model_pdf'))) {
916 if (!empty($value)) {
917 if (!is_array($value) && !is_object($value)) {
918 $array_other[
'object_'.$key] = $value;
919 } elseif (is_array($value) && $recursive) {
921 if (!empty($tmparray) && is_array($tmparray)) {
922 foreach ($tmparray as $key2 => $value2) {
923 $array_other[
'object_'.$key.
'_'.preg_replace(
'/^object_/',
'', $key2)] = $value2;
926 } elseif (is_object($value) && $recursive) {
928 if (!empty($tmparray) && is_array($tmparray)) {
929 foreach ($tmparray as $key2 => $value2) {
930 $array_other[
'object_'.$key.
'_'.preg_replace(
'/^object_/',
'', $key2)] = $value2;
961 if (is_array($extrafields->attributes[$object->table_element][
'label'])) {
962 foreach ($extrafields->attributes[$object->table_element][
'label'] as $key => $label) {
963 $formatedarrayoption = $object->array_options;
965 if ($extrafields->attributes[$object->table_element][
'type'][$key] ==
'price') {
966 $formatedarrayoption[
'options_'.$key] =
price2num($formatedarrayoption[
'options_'.$key]);
967 $formatedarrayoption[
'options_'.$key.
'_currency'] =
price($formatedarrayoption[
'options_'.$key], 0, $outputlangs, 0, 0, -1, $conf->currency);
969 $array_to_fill = array_merge($array_to_fill, array($array_key.
'_options_'.$key.
'_currency' => $formatedarrayoption[
'options_'.$key.
'_currency']));
970 } elseif ($extrafields->attributes[$object->table_element][
'type'][$key] ==
'select') {
971 $valueofselectkey = $formatedarrayoption[
'options_'.$key];
972 if (array_key_exists($valueofselectkey, $extrafields->attributes[$object->table_element][
'param'][$key][
'options'])) {
973 $formatedarrayoption[
'options_'.$key] = $extrafields->attributes[$object->table_element][
'param'][$key][
'options'][$valueofselectkey];
975 $formatedarrayoption[
'options_'.$key] =
'';
977 } elseif ($extrafields->attributes[$object->table_element][
'type'][$key] ==
'checkbox') {
978 $valArray = explode(
',', $formatedarrayoption[
'options_'.$key]);
980 foreach ($extrafields->attributes[$object->table_element][
'param'][$key][
'options'] as $keyopt => $valopt) {
981 if (in_array($keyopt, $valArray)) {
985 $formatedarrayoption[
'options_'.$key] = implode(
', ', $output);
986 } elseif ($extrafields->attributes[$object->table_element][
'type'][$key] ==
'date') {
987 if (strlen($formatedarrayoption[
'options_'.$key]) > 0) {
988 $date = $formatedarrayoption[
'options_'.$key];
989 $formatedarrayoption[
'options_'.$key] =
dol_print_date($date,
'day');
990 $formatedarrayoption[
'options_'.$key.
'_locale'] =
dol_print_date($date,
'day',
'tzserver', $outputlangs);
991 $formatedarrayoption[
'options_'.$key.
'_rfc'] =
dol_print_date($date,
'dayrfc');
993 $formatedarrayoption[
'options_'.$key] =
'';
994 $formatedarrayoption[
'options_'.$key.
'_locale'] =
'';
995 $formatedarrayoption[
'options_'.$key.
'_rfc'] =
'';
997 $array_to_fill = array_merge($array_to_fill, array($array_key.
'_options_'.$key.
'_locale' => $formatedarrayoption[
'options_'.$key.
'_locale']));
998 $array_to_fill = array_merge($array_to_fill, array($array_key.
'_options_'.$key.
'_rfc' => $formatedarrayoption[
'options_'.$key.
'_rfc']));
999 } elseif ($extrafields->attributes[$object->table_element][
'type'][$key] ==
'datetime') {
1000 $datetime = $formatedarrayoption[
'options_'.$key];
1001 $formatedarrayoption[
'options_'.$key] = ($datetime !=
"0000-00-00 00:00:00" ?
dol_print_date($datetime,
'dayhour') :
'');
1002 $formatedarrayoption[
'options_'.$key.
'_locale'] = ($datetime !=
"0000-00-00 00:00:00" ?
dol_print_date($datetime,
'dayhour',
'tzserver', $outputlangs) :
'');
1003 $formatedarrayoption[
'options_'.$key.
'_rfc'] = ($datetime !=
"0000-00-00 00:00:00" ?
dol_print_date($datetime,
'dayhourrfc') :
'');
1004 $array_to_fill = array_merge($array_to_fill, array($array_key.
'_options_'.$key.
'_locale' => $formatedarrayoption[
'options_'.$key.
'_locale']));
1005 $array_to_fill = array_merge($array_to_fill, array($array_key.
'_options_'.$key.
'_rfc' => $formatedarrayoption[
'options_'.$key.
'_rfc']));
1006 } elseif ($extrafields->attributes[$object->table_element][
'type'][$key] ==
'link') {
1007 $id = $formatedarrayoption[
'options_'.$key];
1009 $param = $extrafields->attributes[$object->table_element][
'param'][$key];
1010 $param_list = array_keys($param[
'options']);
1011 $InfoFieldList = explode(
":", $param_list[0]);
1012 $classname = $InfoFieldList[0];
1013 $classpath = $InfoFieldList[1];
1014 if (!empty($classpath)) {
1016 if ($classname && class_exists($classname)) {
1017 $tmpobject =
new $classname($this->db);
1018 $tmpobject->fetch($id);
1020 $formatedarrayoption[
'options_'.$key] = $tmpobject->name;
1026 if (array_key_exists(
'options_'.$key, $formatedarrayoption)) {
1027 $array_to_fill = array_merge($array_to_fill, array($array_key.
'_options_'.$key => $formatedarrayoption[
'options_'.$key]));
1029 $array_to_fill = array_merge($array_to_fill, array($array_key.
'_options_'.$key =>
''));
1034 return $array_to_fill;
1050 public function printRect($pdf, $x, $y, $l, $h, $hidetop = 0, $hidebottom = 0)
1052 if (empty($hidetop) || $hidetop == -1) {
1053 $pdf->line($x, $y, $x + $l, $y);
1055 $pdf->line($x + $l, $y, $x + $l, $y + $h);
1056 if (empty($hidebottom)) {
1057 $pdf->line($x + $l, $y + $h, $x, $y + $h);
1059 $pdf->line($x, $y + $h, $x, $y);
1072 if (empty($a[
'rank'])) {
1075 if (empty($b[
'rank'])) {
1078 if ($a[
'rank'] == $b[
'rank']) {
1081 return ($a[
'rank'] > $b[
'rank']) ? -1 : 1;
1096 $this->defineColumnField($object, $outputlangs, $hidedetails, $hidedesc, $hideref);
1100 uasort($this->cols, array($this,
'columnSort'));
1103 $curX = $this->page_largeur - $this->marge_droite;
1106 $arrayWidth = $this->page_largeur - $this->marge_droite - $this->marge_gauche;
1109 $totalDefinedColWidth = 0;
1111 foreach ($this->cols as $colKey => & $colDef) {
1116 if (!empty($colDef[
'scale'])) {
1118 $colDef[
'width'] = abs($arrayWidth * $colDef[
'scale'] / 100);
1121 if (empty($colDef[
'width'])) {
1124 $totalDefinedColWidth += $colDef[
'width'];
1128 foreach ($this->cols as $colKey => & $colDef) {
1130 if (!empty($colDef[
'title'])) {
1131 $colDef[
'title'] = array_replace($this->defaultTitlesFieldsStyle, $colDef[
'title']);
1133 $colDef[
'title'] = $this->defaultTitlesFieldsStyle;
1137 if (!empty($colDef[
'content'])) {
1138 $colDef[
'content'] = array_replace($this->defaultContentsFieldsStyle, $colDef[
'content']);
1140 $colDef[
'content'] = $this->defaultContentsFieldsStyle;
1145 if (empty($colDef[
'width'])) {
1146 $colDef[
'width'] = abs(($arrayWidth - $totalDefinedColWidth)) / $countFlexCol;
1151 $curX = $lastX - $colDef[
'width'];
1152 $colDef[
'xStartPos'] = $curX;
1153 $colDef[
'xEndPos'] = $lastX;
1166 $colDef = $this->cols[$colKey];
1167 return $colDef[
'width'] - $colDef[
'content'][
'padding'][3] - $colDef[
'content'][
'padding'][1];
1179 $colDef = (isset($this->cols[$colKey]) ? $this->cols[$colKey] :
null);
1180 return (is_array($colDef) ? ((isset($colDef[
'xStartPos']) ? $colDef[
'xStartPos'] : 0) + $colDef[
'content'][
'padding'][3]) : 0);
1191 if (!isset($this->cols[$colKey][
'rank'])) {
1194 return $this->cols[$colKey][
'rank'];
1206 public function insertNewColumnDef($newColKey, $defArray, $targetCol =
false, $insertAfterTarget =
false)
1212 if (!empty($targetCol)) {
1214 if ($rank >= 0 && $insertAfterTarget) {
1220 if ($rank < 0 && !empty($defArray[
'rank'])) {
1221 $rank = $defArray[
'rank'];
1229 foreach ($this->cols as $colKey => & $colDef) {
1230 if ($rank <= $colDef[
'rank']) {
1231 $colDef[
'rank'] = $colDef[
'rank'] + 1;
1235 $defArray[
'rank'] = $rank;
1236 $this->cols[$newColKey] = $defArray;
1253 global $hookmanager;
1255 $parameters = array(
1257 'columnText' => $columnText,
1258 'colKey' => $colKey,
1261 $reshook = $hookmanager->executeHooks(
'printStdColumnContent', $parameters, $this);
1266 if (empty($columnText)) {
1270 $colDef = $this->cols[$colKey];
1272 $curentCellPaddinds = $pdf->getCellPaddings();
1274 $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);
1275 $pdf->writeHTMLCell($colDef[
'width'], 2, isset($colDef[
'xStartPos']) ? $colDef[
'xStartPos'] : 0, $curY, $columnText, 0, 1, 0,
true, $colDef[
'content'][
'align']);
1278 $pdf->setCellPaddings($curentCellPaddinds[
'L'], $curentCellPaddinds[
'T'], $curentCellPaddinds[
'R'], $curentCellPaddinds[
'B']);
1299 public function printColDescContent($pdf, &$curY, $colKey, $object, $i, $outputlangs, $hideref = 0, $hidedesc = 0, $issupplierline = 0)
1302 $colDef = $this->cols[$colKey];
1304 $curentCellPaddinds = $pdf->getCellPaddings();
1306 $pdf->setCellPaddings($colDef[
'content'][
'padding'][3], $colDef[
'content'][
'padding'][0], $colDef[
'content'][
'padding'][1], $colDef[
'content'][
'padding'][2]);
1309 pdf_writelinedesc($pdf, $object, $i, $outputlangs, $colDef[
'width'], 3, $colDef[
'xStartPos'], $curY, $hideref, $hidedesc, $issupplierline);
1310 $posYAfterDescription = $pdf->GetY() - $colDef[
'content'][
'padding'][0];
1313 $pdf->setCellPaddings($curentCellPaddinds[
'L'], $curentCellPaddinds[
'T'], $curentCellPaddinds[
'R'], $curentCellPaddinds[
'B']);
1317 'display' =>
'list',
1318 'printableEnable' => array(3),
1319 'printableEnableNotEmpty' => array(4)
1321 $extrafieldDesc = $this->getExtrafieldsInHtml($object->lines[$i], $outputlangs, $params);
1322 if (!empty($extrafieldDesc)) {
1338 global $hookmanager;
1340 if (empty($object->table_element)) {
1344 $extrafieldsKeyPrefix =
"options_";
1347 $pos = strpos($extrafieldKey, $extrafieldsKeyPrefix);
1349 $extrafieldKey = substr($extrafieldKey, strlen($extrafieldsKeyPrefix));
1352 $extrafieldOptionsKey = $extrafieldsKeyPrefix.$extrafieldKey;
1356 if (empty($this->extrafieldsCache)) {
1357 $this->extrafieldsCache =
new ExtraFields($this->db);
1359 if (empty($this->extrafieldsCache->attributes[$object->table_element])) {
1360 $this->extrafieldsCache->fetch_name_optionals_label($object->table_element);
1362 $extrafields = $this->extrafieldsCache;
1364 $extrafieldOutputContent =
'';
1365 if (isset($object->array_options[$extrafieldOptionsKey])) {
1366 $extrafieldOutputContent = $extrafields->showOutputField($extrafieldKey, $object->array_options[$extrafieldOptionsKey],
'', $object->table_element, $outputlangs);
1370 if ($extrafields->attributes[$object->table_element][
'type'][$extrafieldKey] ==
'link') {
1375 $parameters = array(
1376 'object' => $object,
1377 'extrafields' => $extrafields,
1378 'extrafieldKey' => $extrafieldKey,
1379 'extrafieldOutputContent' =>& $extrafieldOutputContent
1381 $reshook = $hookmanager->executeHooks(
'getPDFExtrafieldContent', $parameters, $this);
1386 $extrafieldOutputContent = $hookmanager->resPrint;
1389 return $extrafieldOutputContent;
1401 public function getExtrafieldsInHtml($object, $outputlangs, $params = array())
1403 global $hookmanager;
1405 if (empty($object->table_element)) {
1410 if (empty($this->extrafieldsCache)) {
1411 $this->extrafieldsCache =
new ExtraFields($this->db);
1413 if (empty($this->extrafieldsCache->attributes[$object->table_element])) {
1414 $this->extrafieldsCache->fetch_name_optionals_label($object->table_element);
1416 $extrafields = $this->extrafieldsCache;
1418 $defaultParams = array(
1420 'display' =>
'auto',
1421 'printableEnable' => array(1),
1422 'printableEnableNotEmpty' => array(2),
1425 'maxItemsInRow' => 2,
1429 'labelcolwidth' =>
'25%',
1430 'arrayOfLineBreakType' => array(
'text',
'html')
1434 'separator' =>
'<br>'
1443 $params = $params + $defaultParams;
1452 if (!empty($extrafields->attributes[$object->table_element][
'label']) && is_array($extrafields->attributes[$object->table_element][
'label'])) {
1453 foreach ($extrafields->attributes[$object->table_element][
'label'] as $key => $label) {
1456 $disableOnEmpty = 0;
1457 if (!empty($extrafields->attributes[$object->table_element][
'printable'][$key])) {
1458 $printable = intval($extrafields->attributes[$object->table_element][
'printable'][$key]);
1459 if (in_array($printable, $params[
'printableEnable']) || in_array($printable, $params[
'printableEnableNotEmpty'])) {
1463 if (in_array($printable, $params[
'printableEnableNotEmpty'])) {
1464 $disableOnEmpty = 1;
1468 if (empty($enabled)) {
1472 $field =
new stdClass();
1473 $field->rank = intval($extrafields->attributes[$object->table_element][
'pos'][$key]);
1475 $field->label = $outputlangs->transnoentities($label);
1476 $field->type = $extrafields->attributes[$object->table_element][
'type'][$key];
1479 if ($disableOnEmpty && empty($field->content)) {
1487 if (!empty($fields)) {
1489 uasort($fields,
function ($a, $b) {
1490 return ($a->rank > $b->rank) ? 1 : -1;
1494 $html .= !empty($params[
'style']) ?
'<style>'.$params[
'style'].
'</style>' :
'';
1497 if ($params[
'display'] ==
'auto') {
1498 $lastNnumbItems = 0;
1499 foreach ($params[
'auto'] as $display => $numbItems) {
1500 if ($lastNnumbItems <= $numbItems && count($fields) > $numbItems) {
1501 $lastNnumbItems = $numbItems;
1502 $params[
'display'] = $display;
1507 if ($params[
'display'] ==
'list') {
1510 foreach ($fields as $field) {
1511 $html .= !empty($i) ? $params[
'list'][
'separator'] :
'';
1512 $html .=
'<strong>'.$field->label.
' : </strong>';
1513 $html .= $field->content;
1516 } elseif ($params[
'display'] ==
'table') {
1518 $html .=
'<table class="extrafield-table" cellspacing="'.$params[
'table'][
'cellspacing'].
'" cellpadding="'.$params[
'table'][
'cellpadding'].
'" border="'.$params[
'table'][
'border'].
'">';
1522 $maxItemsInRow = $params[
'table'][
'maxItemsInRow'];
1523 foreach ($fields as $field) {
1525 if ($itemsInRow >= $maxItemsInRow) {
1527 $html .=
"</tr><tr>";
1532 if (in_array($field->type, $params[
'table'][
'arrayOfLineBreakType'])) {
1533 if ($itemsInRow > 0) {
1535 for ($i = $itemsInRow; $i <= $maxItemsInRow; $i++) {
1536 $html .=
"<td></td><td></td>";
1544 $itemsInRow = $maxItemsInRow;
1545 $html .=
'<td colspan="'.($maxItemsInRow * 2 - 1).
'">';
1546 $html .=
'<strong>'.$field->label.
' :</strong> ';
1547 $html .= $field->content;
1551 $html .=
'<td width="'.$params[
'table'][
'labelcolwidth'].
'" class="extrafield-label">';
1552 $html .=
'<strong>'.$field->label.
' :</strong>';
1556 $html .=
'<td class="extrafield-content">';
1557 $html .= $field->content;
1563 $html .=
'</table>';
1579 if (!empty($this->cols[$colKey][
'status'])) {
1596 public function pdfTabTitles(&$pdf, $tab_top, $tab_height, $outputlangs, $hidetop = 0)
1598 global $hookmanager, $conf;
1600 foreach ($this->cols as $colKey => $colDef) {
1601 $parameters = array(
1602 'colKey' => $colKey,
1604 'outputlangs' => $outputlangs,
1605 'tab_top' => $tab_top,
1606 'tab_height' => $tab_height,
1607 'hidetop' => $hidetop
1610 $reshook = $hookmanager->executeHooks(
'pdfTabTitles', $parameters, $this);
1613 } elseif (empty($reshook)) {
1619 $colDef[
'title'][
'label'] = !empty($colDef[
'title'][
'label']) ? $colDef[
'title'][
'label'] : $outputlangs->transnoentities($colDef[
'title'][
'textkey']);
1622 if (!empty($colDef[
'border-left']) && isset($colDef[
'xStartPos'])) {
1623 $pdf->line($colDef[
'xStartPos'], $tab_top, $colDef[
'xStartPos'], $tab_top + $tab_height);
1626 if (empty($hidetop)) {
1628 $curentCellPaddinds = $pdf->getCellPaddings();
1631 global $outputlangsbis;
1632 if (is_object($outputlangsbis)) {
1634 $pdf->setCellPaddings($colDef[
'title'][
'padding'][3], $colDef[
'title'][
'padding'][0], $colDef[
'title'][
'padding'][1], 0.5);
1637 $pdf->setCellPaddings($colDef[
'title'][
'padding'][3], $colDef[
'title'][
'padding'][0], $colDef[
'title'][
'padding'][1], $colDef[
'title'][
'padding'][2]);
1639 if (isset($colDef[
'title'][
'align'])) {
1640 $align = $colDef[
'title'][
'align'];
1644 $pdf->SetXY($colDef[
'xStartPos'], $tab_top);
1645 $textWidth = $colDef[
'width'];
1646 $pdf->MultiCell($textWidth, 2, $colDef[
'title'][
'label'],
'', $align);
1649 if (is_object($outputlangsbis) && trim($colDef[
'title'][
'label'])) {
1650 $pdf->setCellPaddings($colDef[
'title'][
'padding'][3], 0, $colDef[
'title'][
'padding'][1], $colDef[
'title'][
'padding'][2]);
1651 $pdf->SetXY($colDef[
'xStartPos'], $pdf->GetY());
1652 $textbis = $outputlangsbis->transnoentities($colDef[
'title'][
'textkey']);
1653 $pdf->MultiCell($textWidth, 2, $textbis,
'', $align);
1656 $this->tabTitleHeight = max($pdf->GetY() - $tab_top, $this->tabTitleHeight);
1659 $pdf->setCellPaddings($curentCellPaddinds[
'L'], $curentCellPaddinds[
'T'], $curentCellPaddinds[
'R'], $curentCellPaddinds[
'B']);
1664 return $this->tabTitleHeight;
1679 if (!empty($hidedetails)) {
1683 if (empty($object->table_element)) {
1688 if (empty($this->extrafieldsCache)) {
1689 $this->extrafieldsCache =
new ExtraFields($this->db);
1691 if (empty($this->extrafieldsCache->attributes[$object->table_element])) {
1692 $this->extrafieldsCache->fetch_name_optionals_label($object->table_element);
1694 $extrafields = $this->extrafieldsCache;
1697 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'])) {
1698 foreach ($extrafields->attributes[$object->table_element][
'label'] as $key => $label) {
1700 if ($extrafields->attributes[$object->table_element][
'type'][$key] ==
'separate') {
1706 if (!empty($extrafields->attributes[$object->table_element][
'printable'][$key])) {
1707 $printable = intval($extrafields->attributes[$object->table_element][
'printable'][$key]);
1708 if ($printable === 1 || $printable === 2) {
1719 if (!empty($extrafields->attributes[$object->table_element][
'langfile'][$key])) {
1720 $outputlangs->load($extrafields->attributes[$object->table_element][
'langfile'][$key]);
1727 'rank' => intval($extrafields->attributes[$object->table_element][
'pos'][$key]),
1729 'status' => boolval($enabled),
1731 'label' => $outputlangs->transnoentities($label)
1736 'border-left' =>
true,
1739 $alignTypeRight = array(
'double',
'int',
'price');
1740 if (in_array($extrafields->attributes[$object->table_element][
'type'][$key], $alignTypeRight)) {
1741 $def[
'content'][
'align'] =
'R';
1744 $alignTypeLeft = array(
'text',
'html');
1745 if (in_array($extrafields->attributes[$object->table_element][
'type'][$key], $alignTypeLeft)) {
1746 $def[
'content'][
'align'] =
'L';
Class to manage bank accounts.
Parent class for documents generators.
get_substitutionarray_shipment($object, $outputlangs, $array_key='object')
Define array with couple substitution key => substitution value Note that vars into substitutions arr...
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.
get_substitutionarray_object($object, $outputlangs, $array_key='object')
Define array with couple substitution key => substitution value Note that vars into substitutions arr...
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.
insertNewColumnDef($newColKey, $defArray, $targetCol=false, $insertAfterTarget=false)
get column position rank from column key
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.
get_substitutionarray_shipment_lines($line, $outputlangs)
Define array with couple substitution key => substitution value Note that vars into substitutions arr...
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.
getState($id, $withcode='', $dbtouse=0, $withregion=0, $outputlangs='', $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 formated 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_print_date($time, $format='', $tzoutput='auto', $outputlangs='', $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.
dol_now($mode='auto')
Return date for now.
getDolGlobalInt($key, $default=0)
Return dolibarr global constant int value.
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)
Output line description into PDF.
measuringUnitString($unit, $measuring_style='', $scale='', $use_short_label=0, $outputlangs=null)
Return translation label of a unit key.