46 public $errors = array();
56 public $extrafieldsCache;
61 public $update_main_doc_field;
77 public $option_multilang;
78 public $option_freetext;
79 public $option_draft_watermark;
81 public $option_modereg;
82 public $option_condreg;
83 public $option_escompte;
84 public $option_credit_note;
111 global $conf, $extrafields;
113 $logotouse = $conf->user->dir_output.
'/'.
get_exdir($user->id, 2, 0, 1, $user,
'user').
'/'.$user->photo;
116 'myuser_lastname'=>$user->lastname,
117 'myuser_firstname'=>$user->firstname,
118 'myuser_fullname'=>$user->getFullName($outputlangs, 1),
119 'myuser_login'=>$user->login,
120 'myuser_phone'=>$user->office_phone,
121 'myuser_address'=>$user->address,
122 'myuser_zip'=>$user->zip,
123 'myuser_town'=>$user->town,
124 'myuser_country'=>$user->country,
125 'myuser_country_code'=>$user->country_code,
126 'myuser_state'=>$user->state,
127 'myuser_state_code'=>$user->state_code,
128 'myuser_fax'=>$user->office_fax,
129 'myuser_mobile'=>$user->user_mobile,
130 'myuser_email'=>$user->email,
131 'myuser_logo'=>$logotouse,
132 'myuser_job'=>$user->job,
136 if (is_array($user->array_options) && count($user->array_options)) {
152 global $conf, $extrafields;
154 if ($member->photo) {
155 $logotouse = $conf->adherent->dir_output.
'/'.
get_exdir(0, 0, 0, 1, $member,
'user').
'/photos/'.$member->photo;
157 $logotouse = DOL_DOCUMENT_ROOT.
'/public/theme/common/nophoto.png';
160 $array_member = array(
161 'mymember_lastname' => $member->lastname,
162 'mymember_firstname' => $member->firstname,
163 'mymember_fullname' => $member->getFullName($outputlangs, 1),
164 'mymember_login' => $member->login,
165 'mymember_address' => $member->address,
166 'mymember_zip' => $member->zip,
167 'mymember_town' => $member->town,
168 'mymember_country_code' => $member->country_code,
169 'mymember_country' => $member->country,
170 'mymember_state_code' => $member->state_code,
171 'mymember_state' => $member->state,
172 'mymember_phone_perso' => $member->phone_perso,
173 'mymember_phone_pro' => $member->phone,
174 'mymember_phone_mobile' => $member->phone_mobile,
175 'mymember_email' => $member->email,
176 'mymember_logo' => $logotouse,
177 'mymember_gender' => $member->gender,
178 'mymember_birth_locale' =>
dol_print_date($member->birth,
'day',
'tzuser', $outputlangs),
179 'mymember_birth' =>
dol_print_date($member->birth,
'day',
'tzuser'),
182 if (is_array($member->array_options) && count($member->array_options)) {
185 return $array_member;
202 if (empty($mysoc->forme_juridique) && !empty($mysoc->forme_juridique_code)) {
205 if (empty($mysoc->country) && !empty($mysoc->country_code)) {
206 $mysoc->country = $outputlangs->transnoentitiesnoconv(
"Country".$mysoc->country_code);
208 if (empty($mysoc->state) && !empty($mysoc->state_code)) {
209 $mysoc->state =
getState($mysoc->state_code, 0);
212 $logotouse = $conf->mycompany->dir_output.
'/logos/thumbs/'.$mysoc->logo_small;
215 'mycompany_logo'=>$logotouse,
216 'mycompany_name'=>$mysoc->name,
217 'mycompany_email'=>$mysoc->email,
218 'mycompany_phone'=>$mysoc->phone,
219 'mycompany_fax'=>$mysoc->fax,
220 'mycompany_address'=>$mysoc->address,
221 'mycompany_zip'=>$mysoc->zip,
222 'mycompany_town'=>$mysoc->town,
223 'mycompany_country'=>$mysoc->country,
224 'mycompany_country_code'=>$mysoc->country_code,
225 'mycompany_state'=>$mysoc->state,
226 'mycompany_state_code'=>$mysoc->state_code,
227 'mycompany_web'=>$mysoc->url,
228 'mycompany_juridicalstatus'=>$mysoc->forme_juridique,
229 'mycompany_managers'=>$mysoc->managers,
230 'mycompany_capital'=>$mysoc->capital,
231 'mycompany_barcode'=>$mysoc->barcode,
232 'mycompany_idprof1'=>$mysoc->idprof1,
233 'mycompany_idprof2'=>$mysoc->idprof2,
234 'mycompany_idprof3'=>$mysoc->idprof3,
235 'mycompany_idprof4'=>$mysoc->idprof4,
236 'mycompany_idprof5'=>$mysoc->idprof5,
237 'mycompany_idprof6'=>$mysoc->idprof6,
238 'mycompany_vatnumber'=>$mysoc->tva_intra,
239 'mycompany_object'=>$mysoc->object,
240 'mycompany_note_private'=>$mysoc->note_private,
259 global $conf, $extrafields;
261 if (empty($object->country) && !empty($object->country_code)) {
262 $object->country = $outputlangs->transnoentitiesnoconv(
"Country".$object->country_code);
264 if (empty($object->state) && !empty($object->state_code)) {
265 $object->state =
getState($object->state_code, 0);
268 $array_thirdparty = array(
269 'company_name'=>$object->name,
270 'company_name_alias' => $object->name_alias,
271 'company_email'=>$object->email,
272 'company_phone'=>$object->phone,
273 'company_fax'=>$object->fax,
274 'company_address'=>$object->address,
275 'company_zip'=>$object->zip,
276 'company_town'=>$object->town,
277 'company_country'=>$object->country,
278 'company_country_code'=>$object->country_code,
279 'company_state'=>$object->state,
280 'company_state_code'=>$object->state_code,
281 'company_web'=>$object->url,
282 'company_barcode'=>$object->barcode,
283 'company_vatnumber'=>$object->tva_intra,
284 'company_customercode'=>$object->code_client,
285 'company_suppliercode'=>$object->code_fournisseur,
286 'company_customeraccountancycode'=>$object->code_compta,
287 'company_supplieraccountancycode'=>$object->code_compta_fournisseur,
288 'company_juridicalstatus'=>$object->forme_juridique,
289 'company_outstanding_limit'=>$object->outstanding_limit,
290 'company_capital'=>$object->capital,
291 'company_idprof1'=>$object->idprof1,
292 'company_idprof2'=>$object->idprof2,
293 'company_idprof3'=>$object->idprof3,
294 'company_idprof4'=>$object->idprof4,
295 'company_idprof5'=>$object->idprof5,
296 'company_idprof6'=>$object->idprof6,
297 'company_note_public'=>$object->note_public,
298 'company_note_private'=>$object->note_private,
299 'company_default_bank_iban'=>(is_object($object->bank_account) ? $object->bank_account->iban :
''),
300 'company_default_bank_bic'=>(is_object($object->bank_account) ? $object->bank_account->bic :
'')
304 if (is_array($object->array_options) && count($object->array_options)) {
305 $object->fetch_optionals();
309 return $array_thirdparty;
324 global $conf, $extrafields;
326 if (empty($object->country) && !empty($object->country_code)) {
327 $object->country = $outputlangs->transnoentitiesnoconv(
"Country".$object->country_code);
329 if (empty($object->state) && !empty($object->state_code)) {
330 $object->state =
getState($object->state_code, 0);
333 $array_contact = array(
334 $array_key.
'_fullname' => $object->getFullName($outputlangs, 1),
335 $array_key.
'_lastname' => $object->lastname,
336 $array_key.
'_firstname' => $object->firstname,
337 $array_key.
'_address' => $object->address,
338 $array_key.
'_zip' => $object->zip,
339 $array_key.
'_town' => $object->town,
340 $array_key.
'_state_id' => $object->state_id,
341 $array_key.
'_state_code' => $object->state_code,
342 $array_key.
'_state' => $object->state,
343 $array_key.
'_country_id' => $object->country_id,
344 $array_key.
'_country_code' => $object->country_code,
345 $array_key.
'_country' => $object->country,
346 $array_key.
'_poste' => $object->poste,
347 $array_key.
'_socid' => $object->socid,
348 $array_key.
'_statut' => $object->statut,
349 $array_key.
'_code' => $object->code,
350 $array_key.
'_email' => $object->email,
351 $array_key.
'_phone_pro' => $object->phone_pro,
352 $array_key.
'_phone_perso' => $object->phone_perso,
353 $array_key.
'_phone_mobile' => $object->phone_mobile,
354 $array_key.
'_fax' => $object->fax,
355 $array_key.
'_birthday' => $object->birthday,
356 $array_key.
'_default_lang' => $object->default_lang,
357 $array_key.
'_note_public' => $object->note_public,
358 $array_key.
'_note_private' => $object->note_private,
359 $array_key.
'_civility' => $object->civility,
363 if (is_array($object->array_options) && count($object->array_options)) {
364 $object->fetch_optionals();
368 return $array_contact;
385 $array_other = array(
390 'current_server_datehour'=>
dol_print_date($now,
'dayhour',
'tzserver'),
392 'current_date_locale'=>
dol_print_date($now,
'day',
'tzuser', $outputlangs),
393 'current_datehour_locale'=>
dol_print_date($now,
'dayhour',
'tzuser', $outputlangs),
394 'current_server_date_locale'=>
dol_print_date($now,
'day',
'tzserver', $outputlangs),
395 'current_server_datehour_locale'=>
dol_print_date($now,
'dayhour',
'tzserver', $outputlangs),
399 foreach ($conf->global as $key => $val) {
401 $newval =
'*****forbidden*****';
405 $array_other[
'__['.$key.
']__'] = $newval;
424 global $conf, $extrafields;
426 $sumpayed = $sumdeposit = $sumcreditnote =
'';
427 $already_payed_all = 0;
429 if ($object->element ==
'facture') {
430 $invoice_source =
new Facture($this->
db);
431 if ($object->fk_facture_source > 0) {
432 $invoice_source->fetch($object->fk_facture_source);
434 $sumpayed = $object->getSommePaiement();
435 $sumdeposit = $object->getSumDepositsUsed();
436 $sumcreditnote = $object->getSumCreditNotesUsed();
437 $already_payed_all = $sumpayed + $sumdeposit + $sumcreditnote;
439 if ($object->fk_account > 0) {
440 require_once DOL_DOCUMENT_ROOT.
'/compta/bank/class/account.class.php';
442 $bank_account->fetch($object->fk_account);
446 $date = ($object->element ==
'contrat' ? $object->date_contrat : $object->date);
449 $array_key.
'_id'=>$object->id,
450 $array_key.
'_ref' => (property_exists($object,
'ref') ? $object->ref :
''),
451 $array_key.
'_label' => (property_exists($object,
'label') ? $object->label :
''),
452 $array_key.
'_ref_ext' => (property_exists($object,
'ref_ext') ? $object->ref_ext :
''),
453 $array_key.
'_ref_customer'=>(!empty($object->ref_client) ? $object->ref_client : (empty($object->ref_customer) ?
'' : $object->ref_customer)),
454 $array_key.
'_ref_supplier'=>(!empty($object->ref_fournisseur) ? $object->ref_fournisseur : (empty($object->ref_supplier) ?
'' : $object->ref_supplier)),
455 $array_key.
'_source_invoice_ref'=>$invoice_source->ref,
460 $array_key.
'_date_limit'=>(!empty($object->date_lim_reglement) ?
dol_print_date($object->date_lim_reglement,
'day') :
''),
461 $array_key.
'_date_end'=>(!empty($object->fin_validite) ?
dol_print_date($object->fin_validite,
'day') :
''),
462 $array_key.
'_date_creation'=>
dol_print_date($object->date_creation,
'day'),
463 $array_key.
'_date_modification'=>(!empty($object->date_modification) ?
dol_print_date($object->date_modification,
'day') :
''),
464 $array_key.
'_date_validation'=>(!empty($object->date_validation) ?
dol_print_date($object->date_validation,
'dayhour') :
''),
465 $array_key.
'_date_delivery_planed'=>(!empty($object->date_livraison) ?
dol_print_date($object->date_livraison,
'day') :
''),
466 $array_key.
'_date_close'=>(!empty($object->date_cloture) ?
dol_print_date($object->date_cloture,
'dayhour') :
''),
468 $array_key.
'_payment_mode_code'=>$object->mode_reglement_code,
469 $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),
470 $array_key.
'_payment_term_code'=>$object->cond_reglement_code,
471 $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)),
473 $array_key.
'_incoterms' => (method_exists($object,
'display_incoterms') ? $object->display_incoterms() :
''),
475 $array_key.
'_bank_iban'=>$bank_account->iban,
476 $array_key.
'_bank_bic'=>$bank_account->bic,
477 $array_key.
'_bank_label'=>$bank_account->label,
478 $array_key.
'_bank_number'=>$bank_account->number,
479 $array_key.
'_bank_proprio'=>$bank_account->proprio,
481 $array_key.
'_total_ht_locale'=>
price($object->total_ht, 0, $outputlangs),
482 $array_key.
'_total_vat_locale'=>(!empty($object->total_vat) ?
price($object->total_vat, 0, $outputlangs) :
price($object->total_tva, 0, $outputlangs)),
483 $array_key.
'_total_localtax1_locale'=>
price($object->total_localtax1, 0, $outputlangs),
484 $array_key.
'_total_localtax2_locale'=>
price($object->total_localtax2, 0, $outputlangs),
485 $array_key.
'_total_ttc_locale'=>
price($object->total_ttc, 0, $outputlangs),
487 $array_key.
'_total_ht'=>
price2num($object->total_ht),
488 $array_key.
'_total_vat'=>(!empty($object->total_vat) ?
price2num($object->total_vat) :
price2num($object->total_tva)),
489 $array_key.
'_total_localtax1'=>
price2num($object->total_localtax1),
490 $array_key.
'_total_localtax2'=>
price2num($object->total_localtax2),
491 $array_key.
'_total_ttc'=>
price2num($object->total_ttc),
493 $array_key.
'_multicurrency_code' => $object->multicurrency_code,
494 $array_key.
'_multicurrency_tx' =>
price2num($object->multicurrency_tx),
495 $array_key.
'_multicurrency_total_ht' =>
price2num($object->multicurrency_total_ht),
496 $array_key.
'_multicurrency_total_tva' =>
price2num($object->multicurrency_total_tva),
497 $array_key.
'_multicurrency_total_ttc' =>
price2num($object->multicurrency_total_ttc),
498 $array_key.
'_multicurrency_total_ht_locale' =>
price($object->multicurrency_total_ht, 0, $outputlangs),
499 $array_key.
'_multicurrency_total_tva_locale' =>
price($object->multicurrency_total_tva, 0, $outputlangs),
500 $array_key.
'_multicurrency_total_ttc_locale' =>
price($object->multicurrency_total_ttc, 0, $outputlangs),
502 $array_key.
'_note_private'=>$object->note,
503 $array_key.
'_note_public'=>$object->note_public,
504 $array_key.
'_note'=>$object->note_public,
507 $array_key.
'_already_payed_locale'=>
price($sumpayed, 0, $outputlangs),
508 $array_key.
'_already_payed'=>
price2num($sumpayed),
509 $array_key.
'_already_deposit_locale'=>
price($sumdeposit, 0, $outputlangs),
510 $array_key.
'_already_deposit'=>
price2num($sumdeposit),
511 $array_key.
'_already_creditnote_locale'=>
price($sumcreditnote, 0, $outputlangs),
512 $array_key.
'_already_creditnote'=>
price2num($sumcreditnote),
514 $array_key.
'_already_payed_all_locale'=>
price(
price2num($already_payed_all,
'MT'), 0, $outputlangs),
515 $array_key.
'_already_payed_all'=>
price2num($already_payed_all,
'MT'),
518 $array_key.
'_remain_to_pay_locale'=>
price(
price2num($object->total_ttc - $already_payed_all,
'MT'), 0, $outputlangs),
519 $array_key.
'_remain_to_pay'=>
price2num($object->total_ttc - $already_payed_all,
'MT')
522 if (method_exists($object,
'getTotalDiscount') && in_array(get_class($object), array(
'Propal',
'Proposal',
'Commande',
'Facture',
'SupplierProposal',
'CommandeFournisseur',
'FactureFournisseur'))) {
523 $resarray[$array_key.
'_total_discount_ht_locale'] =
price($object->getTotalDiscount(), 0, $outputlangs);
524 $resarray[$array_key.
'_total_discount_ht'] =
price2num($object->getTotalDiscount());
526 $resarray[$array_key.
'_total_discount_ht_locale'] =
'';
527 $resarray[$array_key.
'_total_discount_ht'] =
'';
531 if ($object->element !=
"project" && !empty($object->fk_project) && $object->fk_project > 0) {
532 if (!is_object($object->project)) {
533 $object->fetch_projet();
536 $resarray[$array_key.
'_project_ref'] = $object->project->ref;
537 $resarray[$array_key.
'_project_title'] = $object->project->title;
538 $resarray[$array_key.
'_project_description'] = $object->project->description;
539 $resarray[$array_key.
'_project_date_start'] =
dol_print_date($object->project->date_start,
'day');
540 $resarray[$array_key.
'_project_date_end'] =
dol_print_date($object->project->date_end,
'day');
544 if (is_array($object->lines) && count($object->lines) > 0) {
547 foreach ($object->lines as $line) {
549 if (empty($resarray[$array_key.
'_total_vat_'.$line->tva_tx])) {
550 $resarray[$array_key.
'_total_vat_'.$line->tva_tx] = 0;
552 $resarray[$array_key.
'_total_vat_'.$line->tva_tx] += $line->total_tva;
553 $resarray[$array_key.
'_total_vat_locale_'.$line->tva_tx] =
price($resarray[$array_key.
'_total_vat_'.$line->tva_tx]);
555 $vatformated =
vatrate($line->tva_tx);
556 if (empty($resarray[$array_key.
'_total_vat_'.$vatformated])) {
557 $resarray[$array_key.
'_total_vat_'.$vatformated] = 0;
559 $resarray[$array_key.
'_total_vat_'.$vatformated] += $line->total_tva;
560 $resarray[$array_key.
'_total_vat_locale_'.$vatformated] =
price($resarray[$array_key.
'_total_vat_'.$vatformated]);
562 $totalUp += $line->subprice * $line->qty;
567 $resarray[
'object_total_up'] = $totalUp;
568 $resarray[
'object_total_up_locale'] =
price($resarray[
'object_total_up'], 0, $outputlangs);
569 if (method_exists($object,
'getTotalDiscount') && in_array(get_class($object), array(
'Propal',
'Proposal',
'Commande',
'Facture',
'SupplierProposal',
'CommandeFournisseur',
'FactureFournisseur'))) {
570 $totalDiscount = $object->getTotalDiscount();
574 if (!empty($totalUp) && !empty($totalDiscount)) {
575 $resarray[
'object_total_discount'] = round(100 / $totalUp * $totalDiscount, 2);
576 $resarray[
'object_total_discount_locale'] =
price($resarray[
'object_total_discount'], 0, $outputlangs);
578 $resarray[
'object_total_discount'] =
'';
579 $resarray[
'object_total_discount_locale'] =
'';
584 if (is_array($object->array_options) && count($object->array_options)) {
585 $object->fetch_optionals();
608 'line_pos' => $linenumber,
611 'line_product_ref'=>(empty($line->product_ref) ?
'' : $line->product_ref),
612 'line_product_ref_fourn'=>(empty($line->ref_fourn) ?
'' : $line->ref_fourn),
613 'line_product_label'=>(empty($line->product_label) ?
'' : $line->product_label),
614 'line_product_type'=>(empty($line->product_type) ?
'' : $line->product_type),
615 'line_product_barcode'=>(empty($line->product_barcode) ?
'' : $line->product_barcode),
616 'line_product_desc'=>(empty($line->product_desc) ?
'' : $line->product_desc),
618 'line_desc'=>$line->desc,
619 'line_vatrate'=>
vatrate($line->tva_tx,
true, $line->info_bits),
620 'line_localtax1_rate'=>
vatrate($line->localtax1_tx),
621 'line_localtax2_rate'=>
vatrate($line->localtax1_tx),
623 'line_up_locale'=>
price($line->subprice, 0, $outputlangs),
624 'line_total_up'=>
price2num($line->subprice * $line->qty),
625 'line_total_up_locale'=>
price($line->subprice * $line->qty, 0, $outputlangs),
626 'line_qty'=>$line->qty,
627 'line_discount_percent'=>($line->remise_percent ? $line->remise_percent.
'%' :
''),
628 'line_price_ht'=>
price2num($line->total_ht),
629 'line_price_ttc'=>
price2num($line->total_ttc),
630 'line_price_vat'=>
price2num($line->total_tva),
631 'line_price_ht_locale'=>
price($line->total_ht, 0, $outputlangs),
632 'line_price_ttc_locale'=>
price($line->total_ttc, 0, $outputlangs),
633 'line_price_vat_locale'=>
price($line->total_tva, 0, $outputlangs),
636 'line_date_start_locale'=>
dol_print_date($line->date_start,
'day',
'tzserver', $outputlangs),
637 'line_date_start_rfc'=>
dol_print_date($line->date_start,
'dayrfc'),
639 'line_date_end_locale'=>
dol_print_date($line->date_end,
'day',
'tzserver', $outputlangs),
642 'line_multicurrency_code' =>
price2num($line->multicurrency_code),
643 'line_multicurrency_subprice' =>
price2num($line->multicurrency_subprice),
644 'line_multicurrency_total_ht' =>
price2num($line->multicurrency_total_ht),
645 'line_multicurrency_total_tva' =>
price2num($line->multicurrency_total_tva),
646 'line_multicurrency_total_ttc' =>
price2num($line->multicurrency_total_ttc),
647 'line_multicurrency_subprice_locale' =>
price($line->multicurrency_subprice, 0, $outputlangs),
648 'line_multicurrency_total_ht_locale' =>
price($line->multicurrency_total_ht, 0, $outputlangs),
649 'line_multicurrency_total_tva_locale' =>
price($line->multicurrency_total_tva, 0, $outputlangs),
650 'line_multicurrency_total_ttc_locale' =>
price($line->multicurrency_total_ttc, 0, $outputlangs),
655 $resarray[
'line_unit'] = $outputlangs->trans($line->getLabelOfUnit(
'long'));
656 $resarray[
'line_unit_short'] = $outputlangs->trans($line->getLabelOfUnit(
'short'));
660 $extrafieldkey = $line->table_element;
662 require_once DOL_DOCUMENT_ROOT.
'/core/class/extrafields.class.php';
664 $extrafields->fetch_name_optionals_label($extrafieldkey,
true);
665 $line->fetch_optionals();
670 if (get_class($line) ==
'CommandeFournisseurLigne') {
672 $extrafields->fetch_name_optionals_label(
"product_fournisseur_price");
673 $extralabels = $extrafields->attributes[
"product_fournisseur_price"][
'label'];
675 if (!empty($extralabels) && is_array($extralabels)) {
678 foreach ($extralabels as $key => $label) {
679 $columns .=
"$key, ";
682 if ($columns !=
"") {
683 $columns = substr($columns, 0, strlen($columns) - 2);
684 $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).
"'");
686 if ($this->
db->num_rows(
$resql) > 0) {
689 foreach ($extralabels as $key => $label) {
690 $resarray[
'line_product_supplier_'.$key] =
$resql->$key;
698 if (isset($line->fk_product) && $line->fk_product > 0) {
700 $result = $tmpproduct->fetch($line->fk_product);
701 foreach ($tmpproduct->array_options as $key => $label) {
702 $resarray[
"line_product_".$key] = $label;
721 global $conf, $extrafields;
723 $object->list_delivery_methods($object->shipping_method_id);
724 $calculatedVolume = ($object->trueWidth * $object->trueHeight * $object->trueDepth);
726 $array_shipment = array(
727 $array_key.
'_id'=>$object->id,
728 $array_key.
'_ref'=>$object->ref,
729 $array_key.
'_ref_ext'=>$object->ref_ext,
730 $array_key.
'_ref_customer'=>$object->ref_customer,
731 $array_key.
'_date_delivery'=>
dol_print_date($object->date_delivery,
'day'),
732 $array_key.
'_hour_delivery'=>
dol_print_date($object->date_delivery,
'hour'),
733 $array_key.
'_date_creation'=>
dol_print_date($object->date_creation,
'day'),
734 $array_key.
'_total_ht'=>
price($object->total_ht),
735 $array_key.
'_total_vat'=>
price($object->total_tva),
736 $array_key.
'_total_ttc'=>
price($object->total_ttc),
737 $array_key.
'_total_discount_ht' =>
price($object->getTotalDiscount()),
738 $array_key.
'_note_private'=>$object->note_private,
739 $array_key.
'_note'=>$object->note_public,
740 $array_key.
'_tracking_number'=>$object->tracking_number,
741 $array_key.
'_tracking_url'=>$object->tracking_url,
742 $array_key.
'_shipping_method'=>$object->listmeths[0][
'libelle'],
743 $array_key.
'_weight'=>$object->trueWeight.
' '.
measuringUnitString(0,
'weight', $object->weight_units),
744 $array_key.
'_width'=>$object->trueWidth.
' '.
measuringUnitString(0,
'size', $object->width_units),
745 $array_key.
'_height'=>$object->trueHeight.
' '.
measuringUnitString(0,
'size', $object->height_units),
746 $array_key.
'_depth'=>$object->trueDepth.
' '.
measuringUnitString(0,
'size', $object->depth_units),
751 foreach ($object->lines as $line) {
752 if (empty($array_shipment[$array_key.
'_total_vat_'.$line->tva_tx])) {
753 $array_shipment[$array_key.
'_total_vat_'.$line->tva_tx] = 0;
755 $array_shipment[$array_key.
'_total_vat_'.$line->tva_tx] += $line->total_tva;
759 if (is_array($object->array_options) && count($object->array_options)) {
760 $object->fetch_optionals();
766 if (!empty($object->commande) && is_object($object->commande)) {
767 $array_shipment[
'order_ref'] = $object->commande->ref;
768 $array_shipment[
'order_ref_customer'] = $object->commande->ref_customer;
771 return $array_shipment;
791 'line_product_ref'=>$line->product_ref,
792 'line_product_label'=>$line->product_label,
793 'line_desc'=>$line->desc,
794 'line_vatrate'=>
vatrate($line->tva_tx,
true, $line->info_bits),
795 'line_up'=>
price($line->subprice),
796 'line_total_up'=>
price($line->subprice * $line->qty),
797 'line_qty'=>$line->qty,
798 'line_qty_shipped'=>$line->qty_shipped,
799 'line_qty_asked'=>$line->qty_asked,
800 'line_discount_percent'=>($line->remise_percent ? $line->remise_percent.
'%' :
''),
801 'line_price_ht'=>
price($line->total_ht),
802 'line_price_ttc'=>
price($line->total_ttc),
803 'line_price_vat'=>
price($line->total_tva),
804 'line_weight'=>empty($line->weight) ?
'' : $line->weight * $line->qty_shipped.
' '.
measuringUnitString(0,
'weight', $line->weight_units),
805 'line_length'=>empty($line->length) ?
'' : $line->length * $line->qty_shipped.
' '.
measuringUnitString(0,
'size', $line->length_units),
806 'line_surface'=>empty($line->surface) ?
'' : $line->surface * $line->qty_shipped.
' '.
measuringUnitString(0,
'surface', $line->surface_units),
807 'line_volume'=>empty($line->volume) ?
'' : $line->volume * $line->qty_shipped.
' '.
measuringUnitString(0,
'volume', $line->volume_units),
811 $extrafieldkey = $line->element;
813 require_once DOL_DOCUMENT_ROOT.
'/core/class/extrafields.class.php';
815 $extrafields->fetch_name_optionals_label($extrafieldkey,
true);
816 $line->fetch_optionals();
821 if (isset($line->fk_product) && $line->fk_product > 0) {
823 $tmpproduct->fetch($line->fk_product);
824 foreach ($tmpproduct->array_options as $key=>$label)
825 $resarray[
"line_product_".$key] = $label;
844 $array_other = array();
845 if (!empty($object)) {
846 foreach ($object as $key => $value) {
847 if (in_array($key, array(
'db',
'fields',
'lines',
'modelpdf',
'model_pdf'))) {
850 if (!empty($value)) {
851 if (!is_array($value) && !is_object($value)) {
852 $array_other[
'object_'.$key] = $value;
853 } elseif (is_array($value) && $recursive) {
855 foreach ($tmparray as $key2 => $value2) {
856 $array_other[
'object_'.$key.
'_'.preg_replace(
'/^object_/',
'', $key2)] = $value2;
858 } elseif (is_object($value) && $recursive) {
860 foreach ($tmparray as $key2 => $value2) {
861 $array_other[
'object_'.$key.
'_'.preg_replace(
'/^object_/',
'', $key2)] = $value2;
890 if (is_array($extrafields->attributes[$object->table_element][
'label'])) {
891 foreach ($extrafields->attributes[$object->table_element][
'label'] as $key => $label) {
892 if ($extrafields->attributes[$object->table_element][
'type'][$key] ==
'price') {
893 $object->array_options[
'options_'.$key] =
price2num($object->array_options[
'options_'.$key]);
894 $object->array_options[
'options_'.$key.
'_currency'] =
price($object->array_options[
'options_'.$key], 0, $outputlangs, 0, 0, -1, $conf->currency);
896 $array_to_fill = array_merge($array_to_fill, array($array_key.
'_options_'.$key.
'_currency' => $object->array_options[
'options_'.$key.
'_currency']));
897 } elseif ($extrafields->attributes[$object->table_element][
'type'][$key] ==
'select') {
898 $valueofselectkey = $object->array_options[
'options_'.$key];
899 if (array_key_exists($valueofselectkey, $extrafields->attributes[$object->table_element][
'param'][$key][
'options'])) {
900 $object->array_options[
'options_'.$key] = $extrafields->attributes[$object->table_element][
'param'][$key][
'options'][$valueofselectkey];
902 $object->array_options[
'options_'.$key] =
'';
904 } elseif ($extrafields->attributes[$object->table_element][
'type'][$key] ==
'checkbox') {
905 $valArray = explode(
',', $object->array_options[
'options_'.$key]);
907 foreach ($extrafields->attributes[$object->table_element][
'param'][$key][
'options'] as $keyopt => $valopt) {
908 if (in_array($keyopt, $valArray)) {
912 $object->array_options[
'options_'.$key] = implode(
', ', $output);
913 } elseif ($extrafields->attributes[$object->table_element][
'type'][$key] ==
'date') {
914 if (strlen($object->array_options[
'options_'.$key]) > 0) {
915 $date = $object->array_options[
'options_'.$key];
916 $object->array_options[
'options_'.$key] =
dol_print_date($date,
'day');
917 $object->array_options[
'options_'.$key.
'_locale'] =
dol_print_date($date,
'day',
'tzserver', $outputlangs);
918 $object->array_options[
'options_'.$key.
'_rfc'] =
dol_print_date($date,
'dayrfc');
920 $object->array_options[
'options_'.$key] =
'';
921 $object->array_options[
'options_'.$key.
'_locale'] =
'';
922 $object->array_options[
'options_'.$key.
'_rfc'] =
'';
924 $array_to_fill = array_merge($array_to_fill, array($array_key.
'_options_'.$key.
'_locale' => $object->array_options[
'options_'.$key.
'_locale']));
925 $array_to_fill = array_merge($array_to_fill, array($array_key.
'_options_'.$key.
'_rfc' => $object->array_options[
'options_'.$key.
'_rfc']));
926 } elseif ($extrafields->attributes[$object->table_element][
'label'][$key] ==
'datetime') {
927 $datetime = $object->array_options[
'options_'.$key];
928 $object->array_options[
'options_'.$key] = ($datetime !=
"0000-00-00 00:00:00" ?
dol_print_date($object->array_options[
'options_'.$key],
'dayhour') :
'');
929 $object->array_options[
'options_'.$key.
'_locale'] = ($datetime !=
"0000-00-00 00:00:00" ?
dol_print_date($object->array_options[
'options_'.$key],
'dayhour',
'tzserver', $outputlangs) :
'');
930 $object->array_options[
'options_'.$key.
'_rfc'] = ($datetime !=
"0000-00-00 00:00:00" ?
dol_print_date($object->array_options[
'options_'.$key],
'dayhourrfc') :
'');
931 $array_to_fill = array_merge($array_to_fill, array($array_key.
'_options_'.$key.
'_locale' => $object->array_options[
'options_'.$key.
'_locale']));
932 $array_to_fill = array_merge($array_to_fill, array($array_key.
'_options_'.$key.
'_rfc' => $object->array_options[
'options_'.$key.
'_rfc']));
933 } elseif ($extrafields->attributes[$object->table_element][
'type'][$key] ==
'link') {
934 $id = $object->array_options[
'options_'.$key];
936 $param = $extrafields->attributes[$object->table_element][
'param'][$key];
937 $param_list = array_keys($param[
'options']);
938 $InfoFieldList = explode(
":", $param_list[0]);
939 $classname = $InfoFieldList[0];
940 $classpath = $InfoFieldList[1];
941 if (!empty($classpath)) {
943 if ($classname && class_exists($classname)) {
944 $tmpobject =
new $classname($this->
db);
945 $tmpobject->fetch($id);
947 $object->array_options[
'options_'.$key] = $tmpobject->name;
953 if (array_key_exists(
'options_'.$key, $object->array_options)) {
954 $array_to_fill = array_merge($array_to_fill, array($array_key.
'_options_'.$key => $object->array_options[
'options_'.$key]));
956 $array_to_fill = array_merge($array_to_fill, array($array_key.
'_options_'.$key =>
''));
961 return $array_to_fill;
977 public function printRect($pdf, $x, $y, $l, $h, $hidetop = 0, $hidebottom = 0)
979 if (empty($hidetop) || $hidetop == -1) {
980 $pdf->line($x, $y, $x + $l, $y);
982 $pdf->line($x + $l, $y, $x + $l, $y + $h);
983 if (empty($hidebottom)) {
984 $pdf->line($x + $l, $y + $h, $x, $y + $h);
986 $pdf->line($x, $y + $h, $x, $y);
999 if (empty($a[
'rank'])) {
1002 if (empty($b[
'rank'])) {
1005 if ($a[
'rank'] == $b[
'rank']) {
1008 return ($a[
'rank'] > $b[
'rank']) ? -1 : 1;
1025 $this->defineColumnField($object, $outputlangs, $hidedetails, $hidedesc, $hideref);
1029 uasort($this->cols, array($this,
'columnSort'));
1032 $curX = $this->page_largeur - $this->marge_droite;
1035 $arrayWidth = $this->page_largeur - $this->marge_droite - $this->marge_gauche;
1038 $totalDefinedColWidth = 0;
1040 foreach ($this->cols as $colKey => & $colDef) {
1045 if (!empty($colDef[
'scale'])) {
1047 $colDef[
'width'] = abs($arrayWidth * $colDef[
'scale'] / 100);
1050 if (empty($colDef[
'width'])) {
1053 $totalDefinedColWidth += $colDef[
'width'];
1057 foreach ($this->cols as $colKey => & $colDef) {
1059 if (!empty($colDef[
'title'])) {
1060 $colDef[
'title'] = array_replace($this->defaultTitlesFieldsStyle, $colDef[
'title']);
1062 $colDef[
'title'] = $this->defaultTitlesFieldsStyle;
1066 if (!empty($colDef[
'content'])) {
1067 $colDef[
'content'] = array_replace($this->defaultContentsFieldsStyle, $colDef[
'content']);
1069 $colDef[
'content'] = $this->defaultContentsFieldsStyle;
1074 if (empty($colDef[
'width'])) {
1075 $colDef[
'width'] = abs(($arrayWidth - $totalDefinedColWidth)) / $countFlexCol;
1080 $curX = $lastX - $colDef[
'width'];
1081 $colDef[
'xStartPos'] = $curX;
1082 $colDef[
'xEndPos'] = $lastX;
1095 $colDef = $this->cols[$colKey];
1096 return $colDef[
'width'] - $colDef[
'content'][
'padding'][3] - $colDef[
'content'][
'padding'][1];
1108 $colDef = $this->cols[$colKey];
1109 return $colDef[
'xStartPos'] + $colDef[
'content'][
'padding'][3];
1120 if (!isset($this->cols[$colKey][
'rank'])) {
1123 return $this->cols[$colKey][
'rank'];
1135 public function insertNewColumnDef($newColKey, $defArray, $targetCol =
false, $insertAfterTarget =
false)
1141 if (!empty($targetCol)) {
1143 if ($rank >= 0 && $insertAfterTarget) {
1149 if ($rank < 0 && !empty($defArray[
'rank'])) {
1150 $rank = $defArray[
'rank'];
1158 foreach ($this->cols as $colKey => & $colDef) {
1159 if ($rank <= $colDef[
'rank']) {
1160 $colDef[
'rank'] = $colDef[
'rank'] + 1;
1164 $defArray[
'rank'] = $rank;
1165 $this->cols[$newColKey] = $defArray;
1182 global $hookmanager;
1184 $parameters = array(
1186 'columnText' => $columnText,
1187 'colKey' => $colKey,
1190 $reshook = $hookmanager->executeHooks(
'printStdColumnContent', $parameters, $this);
1195 if (empty($columnText)) {
1199 $colDef = $this->cols[$colKey];
1201 $curentCellPaddinds = $pdf->getCellPaddings();
1203 $pdf->setCellPaddings($colDef[
'content'][
'padding'][3], $colDef[
'content'][
'padding'][0], $colDef[
'content'][
'padding'][1], $colDef[
'content'][
'padding'][2]);
1204 $pdf->writeHTMLCell($colDef[
'width'], 2, $colDef[
'xStartPos'], $curY, $columnText, 0, 1, 0,
true, $colDef[
'content'][
'align']);
1207 $pdf->setCellPaddings($curentCellPaddinds[
'L'], $curentCellPaddinds[
'T'], $curentCellPaddinds[
'R'], $curentCellPaddinds[
'B']);
1226 public function printColDescContent($pdf, &$curY, $colKey, $object, $i, $outputlangs, $hideref = 0, $hidedesc = 0, $issupplierline = 0)
1229 $colDef = $this->cols[$colKey];
1231 $curentCellPaddinds = $pdf->getCellPaddings();
1233 $pdf->setCellPaddings($colDef[
'content'][
'padding'][3], $colDef[
'content'][
'padding'][0], $colDef[
'content'][
'padding'][1], $colDef[
'content'][
'padding'][2]);
1236 pdf_writelinedesc($pdf, $object, $i, $outputlangs, $colDef[
'width'], 3, $colDef[
'xStartPos'], $curY, $hideref, $hidedesc, $issupplierline);
1237 $posYAfterDescription = $pdf->GetY() - $colDef[
'content'][
'padding'][0];
1240 $pdf->setCellPaddings($curentCellPaddinds[
'L'], $curentCellPaddinds[
'T'], $curentCellPaddinds[
'R'], $curentCellPaddinds[
'B']);
1244 'display' =>
'list',
1245 'printableEnable' => array(3),
1246 'printableEnableNotEmpty' => array(4)
1248 $extrafieldDesc = $this->getExtrafieldsInHtml($object->lines[$i], $outputlangs, $params);
1249 if (!empty($extrafieldDesc)) {
1265 global $hookmanager;
1267 if (empty($object->table_element)) {
1271 $extrafieldsKeyPrefix =
"options_";
1274 $pos = strpos($extrafieldKey, $extrafieldsKeyPrefix);
1276 $extrafieldKey = substr($extrafieldKey, strlen($extrafieldsKeyPrefix));
1279 $extrafieldOptionsKey = $extrafieldsKeyPrefix.$extrafieldKey;
1283 if (empty($this->extrafieldsCache)) {
1286 if (empty($this->extrafieldsCache->attributes[$object->table_element])) {
1287 $this->extrafieldsCache->fetch_name_optionals_label($object->table_element);
1289 $extrafields = $this->extrafieldsCache;
1291 $extrafieldOutputContent = $extrafields->showOutputField($extrafieldKey, $object->array_options[$extrafieldOptionsKey],
'', $object->table_element);
1294 if ($extrafields->attributes[$object->table_element][
'type'][$extrafieldKey] ==
'link') {
1299 $parameters = array(
1300 'object' => $object,
1301 'extrafields' => $extrafields,
1302 'extrafieldKey' => $extrafieldKey,
1303 'extrafieldOutputContent' =>& $extrafieldOutputContent
1305 $reshook = $hookmanager->executeHooks(
'getPDFExtrafieldContent', $parameters, $this);
1310 $extrafieldOutputContent = $hookmanager->resPrint;
1313 return $extrafieldOutputContent;
1325 public function getExtrafieldsInHtml($object, $outputlangs, $params = array())
1327 global $hookmanager;
1329 if (empty($object->table_element)) {
1334 if (empty($this->extrafieldsCache)) {
1337 if (empty($this->extrafieldsCache->attributes[$object->table_element])) {
1338 $this->extrafieldsCache->fetch_name_optionals_label($object->table_element);
1340 $extrafields = $this->extrafieldsCache;
1342 $defaultParams = array(
1344 'display' =>
'auto',
1345 'printableEnable' => array(1),
1346 'printableEnableNotEmpty' => array(2),
1349 'maxItemsInRow' => 2,
1353 'labelcolwidth' =>
'25%',
1354 'arrayOfLineBreakType' => array(
'text',
'html')
1358 'separator' =>
'<br>'
1367 $params = $params + $defaultParams;
1377 if (!empty($extrafields->attributes[$object->table_element][
'label']) && is_array($extrafields->attributes[$object->table_element][
'label'])) {
1378 foreach ($extrafields->attributes[$object->table_element][
'label'] as $key => $label) {
1381 $disableOnEmpty = 0;
1382 if (!empty($extrafields->attributes[$object->table_element][
'printable'][$key])) {
1383 $printable = intval($extrafields->attributes[$object->table_element][
'printable'][$key]);
1384 if (in_array($printable, $params[
'printableEnable']) || in_array($printable, $params[
'printableEnableNotEmpty'])) {
1388 if (in_array($printable, $params[
'printableEnableNotEmpty'])) {
1389 $disableOnEmpty = 1;
1393 if (empty($enabled)) {
1397 $field =
new stdClass();
1398 $field->rank = intval($extrafields->attributes[$object->table_element][
'pos'][$key]);
1400 $field->label = $outputlangs->transnoentities($label);
1401 $field->type = $extrafields->attributes[$object->table_element][
'type'][$key];
1404 if ($disableOnEmpty && empty($field->content)) {
1412 if (!empty($fields)) {
1414 uasort($fields,
function ($a, $b) {
1415 return ($a->rank > $b->rank) ? 1 : -1;
1419 $html .= !empty($params[
'style']) ?
'<style>'.$params[
'style'].
'</style>' :
'';
1422 if ($params[
'display'] ==
'auto') {
1423 $lastNnumbItems = 0;
1424 foreach ($params[
'auto'] as $display => $numbItems) {
1425 if ($lastNnumbItems <= $numbItems && count($fields) > $numbItems) {
1426 $lastNnumbItems = $numbItems;
1427 $params[
'display'] = $display;
1432 if ($params[
'display'] ==
'list') {
1435 foreach ($fields as $field) {
1436 $html .= !empty($i) ? $params[
'list'][
'separator'] :
'';
1437 $html .=
'<strong>'.$field->label.
' : </strong>';
1438 $html .= $field->content;
1441 } elseif ($params[
'display'] ==
'table') {
1443 $html .=
'<table class="extrafield-table" cellspacing="'.$params[
'table'][
'cellspacing'].
'" cellpadding="'.$params[
'table'][
'cellpadding'].
'" border="'.$params[
'table'][
'border'].
'">';
1447 $maxItemsInRow = $params[
'table'][
'maxItemsInRow'];
1448 foreach ($fields as $field) {
1450 if ($itemsInRow >= $maxItemsInRow) {
1452 $html .=
"</tr><tr>";
1457 if (in_array($field->type, $params[
'table'][
'arrayOfLineBreakType'])) {
1458 if ($itemsInRow > 0) {
1460 for ($i = $itemsInRow; $i <= $maxItemsInRow; $i++) {
1461 $html .=
"<td></td><td></td>";
1469 $itemsInRow = $maxItemsInRow;
1470 $html .=
'<td colspan="'.($maxItemsInRow * 2 - 1).
'">';
1471 $html .=
'<strong>'.$field->label.
' :</strong> ';
1472 $html .= $field->content;
1476 $html .=
'<td width="'.$params[
'table'][
'labelcolwidth'].
'" class="extrafield-label">';
1477 $html .=
'<strong>'.$field->label.
' :</strong>';
1481 $html .=
'<td class="extrafield-content">';
1482 $html .= $field->content;
1488 $html .=
'</table>';
1504 if (!empty($this->cols[$colKey][
'status'])) {
1521 public function pdfTabTitles(&$pdf, $tab_top, $tab_height, $outputlangs, $hidetop = 0)
1523 global $hookmanager, $conf;
1525 foreach ($this->cols as $colKey => $colDef) {
1526 $parameters = array(
1527 'colKey' => $colKey,
1529 'outputlangs' => $outputlangs,
1530 'tab_top' => $tab_top,
1531 'tab_height' => $tab_height,
1532 'hidetop' => $hidetop
1535 $reshook = $hookmanager->executeHooks(
'pdfTabTitles', $parameters, $this);
1538 } elseif (empty($reshook)) {
1544 $colDef[
'title'][
'label'] = !empty($colDef[
'title'][
'label']) ? $colDef[
'title'][
'label'] : $outputlangs->transnoentities($colDef[
'title'][
'textkey']);
1547 if (!empty($colDef[
'border-left'])) {
1548 $pdf->line($colDef[
'xStartPos'], $tab_top, $colDef[
'xStartPos'], $tab_top + $tab_height);
1551 if (empty($hidetop)) {
1553 $curentCellPaddinds = $pdf->getCellPaddings();
1556 global $outputlangsbis;
1557 if (is_object($outputlangsbis)) {
1559 $pdf->setCellPaddings($colDef[
'title'][
'padding'][3], $colDef[
'title'][
'padding'][0], $colDef[
'title'][
'padding'][1], 0.5);
1562 $pdf->setCellPaddings($colDef[
'title'][
'padding'][3], $colDef[
'title'][
'padding'][0], $colDef[
'title'][
'padding'][1], $colDef[
'title'][
'padding'][2]);
1565 $pdf->SetXY($colDef[
'xStartPos'], $tab_top);
1566 $textWidth = $colDef[
'width'];
1567 $pdf->MultiCell($textWidth, 2, $colDef[
'title'][
'label'],
'', $colDef[
'title'][
'align']);
1570 if (is_object($outputlangsbis) && trim($colDef[
'title'][
'label'])) {
1571 $pdf->setCellPaddings($colDef[
'title'][
'padding'][3], 0, $colDef[
'title'][
'padding'][1], $colDef[
'title'][
'padding'][2]);
1572 $pdf->SetXY($colDef[
'xStartPos'], $pdf->GetY());
1573 $textbis = $outputlangsbis->transnoentities($colDef[
'title'][
'textkey']);
1574 $pdf->MultiCell($textWidth, 2, $textbis,
'', $colDef[
'title'][
'align']);
1577 $this->tabTitleHeight = max($pdf->GetY() - $tab_top, $this->tabTitleHeight);
1580 $pdf->setCellPaddings($curentCellPaddinds[
'L'], $curentCellPaddinds[
'T'], $curentCellPaddinds[
'R'], $curentCellPaddinds[
'B']);
1585 return $this->tabTitleHeight;
1602 if (!empty($hidedetails)) {
1606 if (empty($object->table_element)) {
1611 if (empty($this->extrafieldsCache)) {
1614 if (empty($this->extrafieldsCache->attributes[$object->table_element])) {
1615 $this->extrafieldsCache->fetch_name_optionals_label($object->table_element);
1617 $extrafields = $this->extrafieldsCache;
1620 if (!empty($extrafields->attributes[$object->table_element]) && is_array($extrafields->attributes[$object->table_element][
'label'])) {
1621 foreach ($extrafields->attributes[$object->table_element][
'label'] as $key => $label) {
1623 if ($extrafields->attributes[$object->table_element][
'type'][$key] ==
'separate') {
1629 if (!empty($extrafields->attributes[$object->table_element][
'printable'][$key])) {
1630 $printable = intval($extrafields->attributes[$object->table_element][
'printable'][$key]);
1631 if ($printable === 1 || $printable === 2) {
1642 if (!empty($extrafields->attributes[$object->table_element][
'langfile'][$key])) {
1643 $outputlangs->load($extrafields->attributes[$object->table_element][
'langfile'][$key]);
1650 'rank' => intval($extrafields->attributes[$object->table_element][
'pos'][$key]),
1652 'status' => boolval($enabled),
1654 'label' => $outputlangs->transnoentities($label)
1659 'border-left' =>
true,
1662 $alignTypeRight = array(
'double',
'int',
'price');
1663 if (in_array($extrafields->attributes[$object->table_element][
'type'][$key], $alignTypeRight)) {
1664 $def[
'content'][
'align'] =
'R';
1667 $alignTypeLeft = array(
'text',
'html');
1668 if (in_array($extrafields->attributes[$object->table_element][
'type'][$key], $alignTypeLeft)) {
1669 $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.
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.
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.
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.
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.
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)
Retourne le nom traduit de la forme juridique.
if(isModEnabled('facture') &&!empty($user->rights->facture->lire)) if((isModEnabled('fournisseur') &&empty($conf->global->MAIN_USE_NEW_SUPPLIERMOD) && $user->hasRight("fournisseur", "facture", "lire"))||(isModEnabled('supplier_invoice') && $user->hasRight("supplier_invoice", "lire"))) if(isModEnabled('don') &&!empty($user->rights->don->lire)) if(isModEnabled('tax') &&!empty($user->rights->tax->charges->lire)) if(isModEnabled('facture') &&isModEnabled('commande') && $user->hasRight("commande", "lire") &&empty($conf->global->WORKFLOW_DISABLE_CREATE_INVOICE_FROM_ORDER)) $resql
Social contributions to pay.
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 '.
setEventMessages($mesg, $mesgs, $style='mesgs', $messagekey='')
Set event messages in dol_events session object.
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.
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.
$conf db
API class for accounts.