46 public $errors = array();
56 public $extrafieldsCache;
80 global $conf, $extrafields;
82 $logotouse = $conf->user->dir_output.
'/'.
get_exdir($user->id, 2, 0, 1, $user,
'user').
'/'.$user->photo;
85 'myuser_lastname'=>$user->lastname,
86 'myuser_firstname'=>$user->firstname,
87 'myuser_fullname'=>$user->getFullName($outputlangs, 1),
88 'myuser_login'=>$user->login,
89 'myuser_phone'=>$user->office_phone,
90 'myuser_address'=>$user->address,
91 'myuser_zip'=>$user->zip,
92 'myuser_town'=>$user->town,
93 'myuser_country'=>$user->country,
94 'myuser_country_code'=>$user->country_code,
95 'myuser_state'=>$user->state,
96 'myuser_state_code'=>$user->state_code,
97 'myuser_fax'=>$user->office_fax,
98 'myuser_mobile'=>$user->user_mobile,
99 'myuser_email'=>$user->email,
100 'myuser_logo'=>$logotouse,
101 'myuser_job'=>$user->job,
105 if (is_array($user->array_options) && count($user->array_options)) {
121 global $conf, $extrafields;
123 if ($member->photo) {
124 $logotouse = $conf->adherent->dir_output.
'/'.
get_exdir(0, 0, 0, 1, $member,
'user').
'/photos/'.$member->photo;
126 $logotouse = DOL_DOCUMENT_ROOT.
'/public/theme/common/nophoto.png';
129 $array_member = array(
130 'mymember_lastname' => $member->lastname,
131 'mymember_firstname' => $member->firstname,
132 'mymember_fullname' => $member->getFullName($outputlangs, 1),
133 'mymember_login' => $member->login,
134 'mymember_address' => $member->address,
135 'mymember_zip' => $member->zip,
136 'mymember_town' => $member->town,
137 'mymember_country_code' => $member->country_code,
138 'mymember_country' => $member->country,
139 'mymember_state_code' => $member->state_code,
140 'mymember_state' => $member->state,
141 'mymember_phone_perso' => $member->phone_perso,
142 'mymember_phone_pro' => $member->phone,
143 'mymember_phone_mobile' => $member->phone_mobile,
144 'mymember_email' => $member->email,
145 'mymember_logo' => $logotouse,
146 'mymember_gender' => $member->gender,
147 'mymember_birth_locale' =>
dol_print_date($member->birth,
'day',
'tzuser', $outputlangs),
148 'mymember_birth' =>
dol_print_date($member->birth,
'day',
'tzuser'),
151 if (is_array($member->array_options) && count($member->array_options)) {
154 return $array_member;
171 if (empty($mysoc->forme_juridique) && !empty($mysoc->forme_juridique_code))
175 if (empty($mysoc->country) && !empty($mysoc->country_code))
177 $mysoc->country = $outputlangs->transnoentitiesnoconv(
"Country".$mysoc->country_code);
179 if (empty($mysoc->state) && !empty($mysoc->state_code))
181 $mysoc->state =
getState($mysoc->state_code, 0);
184 $logotouse = $conf->mycompany->dir_output.
'/logos/thumbs/'.$mysoc->logo_small;
187 'mycompany_logo'=>$logotouse,
188 'mycompany_name'=>$mysoc->name,
189 'mycompany_email'=>$mysoc->email,
190 'mycompany_phone'=>$mysoc->phone,
191 'mycompany_fax'=>$mysoc->fax,
192 'mycompany_address'=>$mysoc->address,
193 'mycompany_zip'=>$mysoc->zip,
194 'mycompany_town'=>$mysoc->town,
195 'mycompany_country'=>$mysoc->country,
196 'mycompany_country_code'=>$mysoc->country_code,
197 'mycompany_state'=>$mysoc->state,
198 'mycompany_state_code'=>$mysoc->state_code,
199 'mycompany_web'=>$mysoc->url,
200 'mycompany_juridicalstatus'=>$mysoc->forme_juridique,
201 'mycompany_managers'=>$mysoc->managers,
202 'mycompany_capital'=>$mysoc->capital,
203 'mycompany_barcode'=>$mysoc->barcode,
204 'mycompany_idprof1'=>$mysoc->idprof1,
205 'mycompany_idprof2'=>$mysoc->idprof2,
206 'mycompany_idprof3'=>$mysoc->idprof3,
207 'mycompany_idprof4'=>$mysoc->idprof4,
208 'mycompany_idprof5'=>$mysoc->idprof5,
209 'mycompany_idprof6'=>$mysoc->idprof6,
210 'mycompany_vatnumber'=>$mysoc->tva_intra,
211 'mycompany_object'=>$mysoc->object,
212 'mycompany_note_private'=>$mysoc->note_private,
230 global $conf, $extrafields;
232 if (empty($object->country) && !empty($object->country_code))
234 $object->country = $outputlangs->transnoentitiesnoconv(
"Country".$object->country_code);
236 if (empty($object->state) && !empty($object->state_code))
238 $object->state =
getState($object->state_code, 0);
241 $array_thirdparty = array(
242 'company_name'=>$object->name,
243 'company_name_alias' => $object->name_alias,
244 'company_email'=>$object->email,
245 'company_phone'=>$object->phone,
246 'company_fax'=>$object->fax,
247 'company_address'=>$object->address,
248 'company_zip'=>$object->zip,
249 'company_town'=>$object->town,
250 'company_country'=>$object->country,
251 'company_country_code'=>$object->country_code,
252 'company_state'=>$object->state,
253 'company_state_code'=>$object->state_code,
254 'company_web'=>$object->url,
255 'company_barcode'=>$object->barcode,
256 'company_vatnumber'=>$object->tva_intra,
257 'company_customercode'=>$object->code_client,
258 'company_suppliercode'=>$object->code_fournisseur,
259 'company_customeraccountancycode'=>$object->code_compta,
260 'company_supplieraccountancycode'=>$object->code_compta_fournisseur,
261 'company_juridicalstatus'=>$object->forme_juridique,
262 'company_outstanding_limit'=>$object->outstanding_limit,
263 'company_capital'=>$object->capital,
264 'company_idprof1'=>$object->idprof1,
265 'company_idprof2'=>$object->idprof2,
266 'company_idprof3'=>$object->idprof3,
267 'company_idprof4'=>$object->idprof4,
268 'company_idprof5'=>$object->idprof5,
269 'company_idprof6'=>$object->idprof6,
270 'company_note_public'=>$object->note_public,
271 'company_note_private'=>$object->note_private,
272 'company_default_bank_iban'=>(is_object($object->bank_account) ? $object->bank_account->iban :
''),
273 'company_default_bank_bic'=>(is_object($object->bank_account) ? $object->bank_account->bic :
'')
277 if (is_array($object->array_options) && count($object->array_options))
279 $object->fetch_optionals();
283 return $array_thirdparty;
298 global $conf, $extrafields;
300 if (empty($object->country) && !empty($object->country_code))
302 $object->country = $outputlangs->transnoentitiesnoconv(
"Country".$object->country_code);
304 if (empty($object->state) && !empty($object->state_code))
306 $object->state =
getState($object->state_code, 0);
309 $array_contact = array(
310 $array_key.
'_fullname' => $object->getFullName($outputlangs, 1),
311 $array_key.
'_lastname' => $object->lastname,
312 $array_key.
'_firstname' => $object->firstname,
313 $array_key.
'_address' => $object->address,
314 $array_key.
'_zip' => $object->zip,
315 $array_key.
'_town' => $object->town,
316 $array_key.
'_state_id' => $object->state_id,
317 $array_key.
'_state_code' => $object->state_code,
318 $array_key.
'_state' => $object->state,
319 $array_key.
'_country_id' => $object->country_id,
320 $array_key.
'_country_code' => $object->country_code,
321 $array_key.
'_country' => $object->country,
322 $array_key.
'_poste' => $object->poste,
323 $array_key.
'_socid' => $object->socid,
324 $array_key.
'_statut' => $object->statut,
325 $array_key.
'_code' => $object->code,
326 $array_key.
'_email' => $object->email,
327 $array_key.
'_jabberid' => $object->jabberid,
328 $array_key.
'_phone_pro' => $object->phone_pro,
329 $array_key.
'_phone_perso' => $object->phone_perso,
330 $array_key.
'_phone_mobile' => $object->phone_mobile,
331 $array_key.
'_fax' => $object->fax,
332 $array_key.
'_birthday' => $object->birthday,
333 $array_key.
'_default_lang' => $object->default_lang,
334 $array_key.
'_note_public' => $object->note_public,
335 $array_key.
'_note_private' => $object->note_private,
336 $array_key.
'_civility' => $object->civility,
340 if (is_array($object->array_options) && count($object->array_options))
342 $object->fetch_optionals();
346 return $array_contact;
363 $array_other = array(
368 'current_server_datehour'=>
dol_print_date($now,
'dayhour',
'tzserver'),
370 'current_date_locale'=>
dol_print_date($now,
'day',
'tzuser', $outputlangs),
371 'current_datehour_locale'=>
dol_print_date($now,
'dayhour',
'tzuser', $outputlangs),
372 'current_server_date_locale'=>
dol_print_date($now,
'day',
'tzserver', $outputlangs),
373 'current_server_datehour_locale'=>
dol_print_date($now,
'dayhour',
'tzserver', $outputlangs),
377 foreach ($conf->global as $key => $val)
379 if (
isASecretKey($key)) $newval =
'*****forbidden*****';
381 $array_other[
'__['.$key.
']__'] = $newval;
400 global $conf, $extrafields;
402 $sumpayed = $sumdeposit = $sumcreditnote =
'';
403 $already_payed_all = 0;
405 if ($object->element ==
'facture')
407 $invoice_source =
new Facture($this->
db);
408 if ($object->fk_facture_source > 0)
410 $invoice_source->fetch($object->fk_facture_source);
412 $sumpayed = $object->getSommePaiement();
413 $sumdeposit = $object->getSumDepositsUsed();
414 $sumcreditnote = $object->getSumCreditNotesUsed();
415 $already_payed_all = $sumpayed + $sumdeposit + $sumcreditnote;
416 $remain_to_pay = $sumpayed - $sumdeposit - $sumcreditnote;
418 if ($object->fk_account > 0) {
419 require_once DOL_DOCUMENT_ROOT.
'/compta/bank/class/account.class.php';
421 $bank_account->fetch($object->fk_account);
425 $date = ($object->element ==
'contrat' ? $object->date_contrat : $object->date);
428 $array_key.
'_id'=>$object->id,
429 $array_key.
'_ref'=>$object->ref,
430 $array_key.
'_ref_ext'=>$object->ref_ext,
431 $array_key.
'_ref_customer'=>(!empty($object->ref_client) ? $object->ref_client : (empty($object->ref_customer) ?
'' : $object->ref_customer)),
432 $array_key.
'_ref_supplier'=>(!empty($object->ref_fournisseur) ? $object->ref_fournisseur : (empty($object->ref_supplier) ?
'' : $object->ref_supplier)),
433 $array_key.
'_source_invoice_ref'=>$invoice_source->ref,
438 $array_key.
'_date_limit'=>(!empty($object->date_lim_reglement) ?
dol_print_date($object->date_lim_reglement,
'day') :
''),
439 $array_key.
'_date_end'=>(!empty($object->fin_validite) ?
dol_print_date($object->fin_validite,
'day') :
''),
440 $array_key.
'_date_creation'=>
dol_print_date($object->date_creation,
'day'),
441 $array_key.
'_date_modification'=>(!empty($object->date_modification) ?
dol_print_date($object->date_modification,
'day') :
''),
442 $array_key.
'_date_validation'=>(!empty($object->date_validation) ?
dol_print_date($object->date_validation,
'dayhour') :
''),
443 $array_key.
'_date_delivery_planed'=>(!empty($object->date_livraison) ?
dol_print_date($object->date_livraison,
'day') :
''),
444 $array_key.
'_date_close'=>(!empty($object->date_cloture) ?
dol_print_date($object->date_cloture,
'dayhour') :
''),
446 $array_key.
'_payment_mode_code'=>$object->mode_reglement_code,
447 $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),
448 $array_key.
'_payment_term_code'=>$object->cond_reglement_code,
449 $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)),
451 $array_key.
'_incoterms'=>(method_exists($object,
'display_incoterms') ? $object->display_incoterms() :
''),
453 $array_key.
'_bank_iban'=>$bank_account->iban,
454 $array_key.
'_bank_bic'=>$bank_account->bic,
456 $array_key.
'_total_ht_locale'=>
price($object->total_ht, 0, $outputlangs),
457 $array_key.
'_total_vat_locale'=>(!empty($object->total_vat) ?
price($object->total_vat, 0, $outputlangs) :
price($object->total_tva, 0, $outputlangs)),
458 $array_key.
'_total_localtax1_locale'=>
price($object->total_localtax1, 0, $outputlangs),
459 $array_key.
'_total_localtax2_locale'=>
price($object->total_localtax2, 0, $outputlangs),
460 $array_key.
'_total_ttc_locale'=>
price($object->total_ttc, 0, $outputlangs),
462 $array_key.
'_total_ht'=>
price2num($object->total_ht),
463 $array_key.
'_total_vat'=>(!empty($object->total_vat) ?
price2num($object->total_vat) :
price2num($object->total_tva)),
464 $array_key.
'_total_localtax1'=>
price2num($object->total_localtax1),
465 $array_key.
'_total_localtax2'=>
price2num($object->total_localtax2),
466 $array_key.
'_total_ttc'=>
price2num($object->total_ttc),
468 $array_key.
'_multicurrency_code' =>
price2num($object->multicurrency_code),
469 $array_key.
'_multicurrency_tx' =>
price2num($object->multicurrency_tx),
470 $array_key.
'_multicurrency_total_ht' =>
price2num($object->multicurrency_total_ht),
471 $array_key.
'_multicurrency_total_tva' =>
price2num($object->multicurrency_total_tva),
472 $array_key.
'_multicurrency_total_ttc' =>
price2num($object->multicurrency_total_ttc),
473 $array_key.
'_multicurrency_total_ht_locale' =>
price($object->multicurrency_total_ht, 0, $outputlangs),
474 $array_key.
'_multicurrency_total_tva_locale' =>
price($object->multicurrency_total_tva, 0, $outputlangs),
475 $array_key.
'_multicurrency_total_ttc_locale' =>
price($object->multicurrency_total_ttc, 0, $outputlangs),
477 $array_key.
'_note_private'=>$object->note,
478 $array_key.
'_note_public'=>$object->note_public,
479 $array_key.
'_note'=>$object->note_public,
482 $array_key.
'_already_payed_locale'=>
price($sumpayed, 0, $outputlangs),
483 $array_key.
'_already_payed'=>
price2num($sumpayed),
484 $array_key.
'_already_deposit_locale'=>
price($sumdeposit, 0, $outputlangs),
485 $array_key.
'_already_deposit'=>
price2num($sumdeposit),
486 $array_key.
'_already_creditnote_locale'=>
price($sumcreditnote, 0, $outputlangs),
487 $array_key.
'_already_creditnote'=>
price2num($sumcreditnote),
489 $array_key.
'_already_payed_all_locale'=>
price(
price2num($already_payed_all,
'MT'), 0, $outputlangs),
490 $array_key.
'_already_payed_all'=>
price2num($already_payed_all,
'MT'),
493 $array_key.
'_remain_to_pay_locale'=>
price(
price2num($object->total_ttc - $remain_to_pay,
'MT'), 0, $outputlangs),
494 $array_key.
'_remain_to_pay'=>
price2num($object->total_ttc - $remain_to_pay,
'MT')
497 if (method_exists($object,
'getTotalDiscount')) {
498 $resarray[$array_key.
'_total_discount_ht_locale'] =
price($object->getTotalDiscount(), 0, $outputlangs);
499 $resarray[$array_key.
'_total_discount_ht'] =
price2num($object->getTotalDiscount());
501 $resarray[$array_key.
'_total_discount_ht_locale'] =
'';
502 $resarray[$array_key.
'_total_discount_ht'] =
'';
506 if ($object->element !=
"project" && !empty($object->fk_project) && $object->fk_project > 0)
508 if (!is_object($object->project))
510 $object->fetch_projet();
513 $resarray[$array_key.
'_project_ref'] = $object->project->ref;
514 $resarray[$array_key.
'_project_title'] = $object->project->title;
515 $resarray[$array_key.
'_project_description'] = $object->project->description;
516 $resarray[$array_key.
'_project_date_start'] =
dol_print_date($object->project->date_start,
'day');
517 $resarray[$array_key.
'_project_date_end'] =
dol_print_date($object->project->date_end,
'day');
521 if (is_array($object->lines) && count($object->lines) > 0)
524 foreach ($object->lines as $line)
527 if (empty($resarray[$array_key.
'_total_vat_'.$line->tva_tx])) $resarray[$array_key.
'_total_vat_'.$line->tva_tx] = 0;
528 $resarray[$array_key.
'_total_vat_'.$line->tva_tx] += $line->total_tva;
529 $resarray[$array_key.
'_total_vat_locale_'.$line->tva_tx] =
price($resarray[$array_key.
'_total_vat_'.$line->tva_tx]);
531 $vatformated =
vatrate($line->tva_tx);
532 if (empty($resarray[$array_key.
'_total_vat_'.$vatformated])) $resarray[$array_key.
'_total_vat_'.$vatformated] = 0;
533 $resarray[$array_key.
'_total_vat_'.$vatformated] += $line->total_tva;
534 $resarray[$array_key.
'_total_vat_locale_'.$vatformated] =
price($resarray[$array_key.
'_total_vat_'.$vatformated]);
536 $totalUp += $line->subprice * $line->qty;
541 $resarray[
'object_total_up'] = $totalUp;
542 $resarray[
'object_total_up_locale'] =
price($resarray[
'object_total_up'], 0, $outputlangs);
543 if (method_exists($object,
'getTotalDiscount')) {
544 $totalDiscount = $object->getTotalDiscount();
548 if (!empty($totalUp) && !empty($totalDiscount)) {
549 $resarray[
'object_total_discount'] = round(100 / $totalUp * $totalDiscount, 2);
550 $resarray[
'object_total_discount_locale'] =
price($resarray[
'object_total_discount'], 0, $outputlangs);
552 $resarray[
'object_total_discount'] =
'';
553 $resarray[
'object_total_discount_locale'] =
'';
558 if (is_array($object->array_options) && count($object->array_options))
560 $object->fetch_optionals();
583 'line_pos' => $linenumber,
586 'line_product_ref'=>(empty($line->product_ref) ?
'' : $line->product_ref),
587 'line_product_ref_fourn'=>(empty($line->ref_fourn) ?
'' : $line->ref_fourn),
588 'line_product_label'=>(empty($line->product_label) ?
'' : $line->product_label),
589 'line_product_type'=>(empty($line->product_type) ?
'' : $line->product_type),
590 'line_product_barcode'=>(empty($line->product_barcode) ?
'' : $line->product_barcode),
592 'line_desc'=>$line->desc,
593 'line_vatrate'=>
vatrate($line->tva_tx,
true, $line->info_bits),
594 'line_localtax1_rate'=>
vatrate($line->localtax1_tx),
595 'line_localtax2_rate'=>
vatrate($line->localtax1_tx),
597 'line_up_locale'=>
price($line->subprice, 0, $outputlangs),
598 'line_total_up'=>
price2num($line->subprice * $line->qty),
599 'line_total_up_locale'=>
price($line->subprice * $line->qty, 0, $outputlangs),
600 'line_qty'=>$line->qty,
601 'line_discount_percent'=>($line->remise_percent ? $line->remise_percent.
'%' :
''),
602 'line_price_ht'=>
price2num($line->total_ht),
603 'line_price_ttc'=>
price2num($line->total_ttc),
604 'line_price_vat'=>
price2num($line->total_tva),
605 'line_price_ht_locale'=>
price($line->total_ht, 0, $outputlangs),
606 'line_price_ttc_locale'=>
price($line->total_ttc, 0, $outputlangs),
607 'line_price_vat_locale'=>
price($line->total_tva, 0, $outputlangs),
610 'line_date_start_locale'=>
dol_print_date($line->date_start,
'day',
'tzserver', $outputlangs),
611 'line_date_start_rfc'=>
dol_print_date($line->date_start,
'dayrfc'),
613 'line_date_end_locale'=>
dol_print_date($line->date_end,
'day',
'tzserver', $outputlangs),
616 'line_multicurrency_code' =>
price2num($line->multicurrency_code),
617 'line_multicurrency_subprice' =>
price2num($line->multicurrency_subprice),
618 'line_multicurrency_total_ht' =>
price2num($line->multicurrency_total_ht),
619 'line_multicurrency_total_tva' =>
price2num($line->multicurrency_total_tva),
620 'line_multicurrency_total_ttc' =>
price2num($line->multicurrency_total_ttc),
621 'line_multicurrency_subprice_locale' =>
price($line->multicurrency_subprice, 0, $outputlangs),
622 'line_multicurrency_total_ht_locale' =>
price($line->multicurrency_total_ht, 0, $outputlangs),
623 'line_multicurrency_total_tva_locale' =>
price($line->multicurrency_total_tva, 0, $outputlangs),
624 'line_multicurrency_total_ttc_locale' =>
price($line->multicurrency_total_ttc, 0, $outputlangs),
628 if (!empty($conf->global->PRODUCT_USE_UNITS))
630 $resarray[
'line_unit'] = $outputlangs->trans($line->getLabelOfUnit(
'long'));
631 $resarray[
'line_unit_short'] = $outputlangs->trans($line->getLabelOfUnit(
'short'));
635 $extrafieldkey = $line->table_element;
637 require_once DOL_DOCUMENT_ROOT.
'/core/class/extrafields.class.php';
639 $extrafields->fetch_name_optionals_label($extrafieldkey,
true);
640 $line->fetch_optionals();
645 if (get_class($line) ==
'CommandeFournisseurLigne')
648 $extrafields->fetch_name_optionals_label(
"product_fournisseur_price");
649 $extralabels = $extrafields->attributes[
"product_fournisseur_price"][
'label'];
651 if (!empty($extralabels) && is_array($extralabels))
655 foreach ($extralabels as $key => $label)
657 $columns .=
"$key, ";
662 $columns = substr($columns, 0, strlen($columns) - 2);
663 $resql = $this->
db->query(
"SELECT ".$columns.
" FROM ".MAIN_DB_PREFIX.
"product_fournisseur_price_extrafields AS ex INNER JOIN ".MAIN_DB_PREFIX.
"product_fournisseur_price AS f ON ex.fk_object = f.rowid WHERE f.ref_fourn = '".$this->db->escape($line->ref_supplier).
"'");
665 if ($this->
db->num_rows(
$resql) > 0)
669 foreach ($extralabels as $key => $label)
671 $resarray[
'line_product_supplier_'.$key] =
$resql->{$key};
679 if (isset($line->fk_product) && $line->fk_product > 0)
682 $result = $tmpproduct->fetch($line->fk_product);
683 foreach ($tmpproduct->array_options as $key=>$label)
684 $resarray[
"line_product_".$key] = $label;
702 global $conf, $extrafields;
704 $object->list_delivery_methods($object->shipping_method_id);
705 $calculatedVolume = ($object->trueWidth * $object->trueHeight * $object->trueDepth);
707 $array_shipment = array(
708 $array_key.
'_id'=>$object->id,
709 $array_key.
'_ref'=>$object->ref,
710 $array_key.
'_ref_ext'=>$object->ref_ext,
711 $array_key.
'_ref_customer'=>$object->ref_customer,
712 $array_key.
'_date_delivery'=>
dol_print_date($object->date_delivery,
'day'),
713 $array_key.
'_hour_delivery'=>
dol_print_date($object->date_delivery,
'hour'),
714 $array_key.
'_date_creation'=>
dol_print_date($object->date_creation,
'day'),
715 $array_key.
'_total_ht'=>
price($object->total_ht),
716 $array_key.
'_total_vat'=>
price($object->total_tva),
717 $array_key.
'_total_ttc'=>
price($object->total_ttc),
718 $array_key.
'_total_discount_ht' =>
price($object->getTotalDiscount()),
719 $array_key.
'_note_private'=>$object->note_private,
720 $array_key.
'_note'=>$object->note_public,
721 $array_key.
'_tracking_number'=>$object->tracking_number,
722 $array_key.
'_tracking_url'=>$object->tracking_url,
723 $array_key.
'_shipping_method'=>$object->listmeths[0][
'libelle'],
724 $array_key.
'_weight'=>$object->trueWeight.
' '.
measuringUnitString(0,
'weight', $object->weight_units),
725 $array_key.
'_width'=>$object->trueWidth.
' '.
measuringUnitString(0,
'size', $object->width_units),
726 $array_key.
'_height'=>$object->trueHeight.
' '.
measuringUnitString(0,
'size', $object->height_units),
727 $array_key.
'_depth'=>$object->trueDepth.
' '.
measuringUnitString(0,
'size', $object->depth_units),
732 foreach ($object->lines as $line)
734 if (empty($array_shipment[$array_key.
'_total_vat_'.$line->tva_tx])) $array_shipment[$array_key.
'_total_vat_'.$line->tva_tx] = 0;
735 $array_shipment[$array_key.
'_total_vat_'.$line->tva_tx] += $line->total_tva;
739 if (is_array($object->array_options) && count($object->array_options))
741 $object->fetch_optionals();
743 $array_shipment = $this->fill_substitutionarray_with_extrafields($object, $array_shipment, $extrafields, $array_key, $outputlangs);
747 if (!empty($object->commande) && is_object($object->commande)) {
748 $array_shipment[
'order_ref'] = $object->commande->ref;
749 $array_shipment[
'order_ref_customer'] = $object->commande->ref_customer;
752 return $array_shipment;
772 'line_product_ref'=>$line->product_ref,
773 'line_product_label'=>$line->product_label,
774 'line_desc'=>$line->desc,
775 'line_vatrate'=>
vatrate($line->tva_tx,
true, $line->info_bits),
776 'line_up'=>
price($line->subprice),
777 'line_total_up'=>
price($line->subprice * $line->qty),
778 'line_qty'=>$line->qty,
779 'line_qty_shipped'=>$line->qty_shipped,
780 'line_qty_asked'=>$line->qty_asked,
781 'line_discount_percent'=>($line->remise_percent ? $line->remise_percent.
'%' :
''),
782 'line_price_ht'=>
price($line->total_ht),
783 'line_price_ttc'=>
price($line->total_ttc),
784 'line_price_vat'=>
price($line->total_tva),
785 'line_weight'=>empty($line->weight) ?
'' : $line->weight * $line->qty_shipped.
' '.
measuringUnitString(0,
'weight', $line->weight_units),
786 'line_length'=>empty($line->length) ?
'' : $line->length * $line->qty_shipped.
' '.
measuringUnitString(0,
'size', $line->length_units),
787 'line_surface'=>empty($line->surface) ?
'' : $line->surface * $line->qty_shipped.
' '.
measuringUnitString(0,
'surface', $line->surface_units),
788 'line_volume'=>empty($line->volume) ?
'' : $line->volume * $line->qty_shipped.
' '.
measuringUnitString(0,
'volume', $line->volume_units),
792 $extrafieldkey = $line->element;
794 require_once DOL_DOCUMENT_ROOT.
'/core/class/extrafields.class.php';
796 $extrafields->fetch_name_optionals_label($extrafieldkey,
true);
797 $line->fetch_optionals();
799 $resarray = $this->fill_substitutionarray_with_extrafields($line, $resarray, $extrafields, $array_key, $outputlangs);
802 if (isset($line->fk_product) && $line->fk_product > 0)
805 $result = $tmpproduct->fetch($line->fk_product);
806 foreach ($tmpproduct->array_options as $key=>$label)
807 $resarray[
"line_product_".$key] = $label;
826 $array_other = array();
827 if (!empty($object)) {
828 foreach ($object as $key => $value) {
829 if (!empty($value)) {
830 if (!is_array($value) && !is_object($value)) {
831 $array_other[
'object_'.$key] = $value;
833 if (is_array($value) && $recursive) {
834 $array_other[
'object_'.$key] = $this->get_substitutionarray_each_var_object($value, $outputlangs,
false);
859 if (is_array($extrafields->attributes[$object->table_element][
'label'])) {
860 foreach ($extrafields->attributes[$object->table_element][
'label'] as $key=>$label)
862 if ($extrafields->attributes[$object->table_element][
'type'][$key] ==
'price')
864 $object->array_options[
'options_'.$key] =
price2num($object->array_options[
'options_'.$key]);
865 $object->array_options[
'options_'.$key.
'_currency'] =
price($object->array_options[
'options_'.$key], 0, $outputlangs, 0, 0, -1, $conf->currency);
867 $array_to_fill = array_merge($array_to_fill, array($array_key.
'_options_'.$key.
'_currency' => $object->array_options[
'options_'.$key.
'_currency']));
868 } elseif ($extrafields->attributes[$object->table_element][
'type'][$key] ==
'select')
870 $object->array_options[
'options_'.$key] = $extrafields->attributes[$object->table_element][
'param'][$key][
'options'][$object->array_options[
'options_'.$key]];
871 } elseif ($extrafields->attributes[$object->table_element][
'type'][$key] ==
'checkbox') {
872 $valArray = explode(
',', $object->array_options[
'options_'.$key]);
874 foreach ($extrafields->attributes[$object->table_element][
'param'][$key][
'options'] as $keyopt=>$valopt) {
875 if (in_array($keyopt, $valArray)) {
879 $object->array_options[
'options_'.$key] = implode(
', ', $output);
880 } elseif ($extrafields->attributes[$object->table_element][
'type'][$key] ==
'date')
882 if (strlen($object->array_options[
'options_'.$key]) > 0)
884 $date = $object->array_options[
'options_'.$key];
885 $object->array_options[
'options_'.$key] =
dol_print_date($date,
'day');
886 $object->array_options[
'options_'.$key.
'_locale'] =
dol_print_date($date,
'day',
'tzserver', $outputlangs);
887 $object->array_options[
'options_'.$key.
'_rfc'] =
dol_print_date($date,
'dayrfc');
889 $object->array_options[
'options_'.$key] =
'';
890 $object->array_options[
'options_'.$key.
'_locale'] =
'';
891 $object->array_options[
'options_'.$key.
'_rfc'] =
'';
893 $array_to_fill = array_merge($array_to_fill, array($array_key.
'_options_'.$key.
'_locale' => $object->array_options[
'options_'.$key.
'_locale']));
894 $array_to_fill = array_merge($array_to_fill, array($array_key.
'_options_'.$key.
'_rfc' => $object->array_options[
'options_'.$key.
'_rfc']));
895 } elseif ($extrafields->attributes[$object->table_element][
'label'][$key] ==
'datetime')
897 $datetime = $object->array_options[
'options_'.$key];
898 $object->array_options[
'options_'.$key] = ($datetime !=
"0000-00-00 00:00:00" ?
dol_print_date($object->array_options[
'options_'.$key],
'dayhour') :
'');
899 $object->array_options[
'options_'.$key.
'_locale'] = ($datetime !=
"0000-00-00 00:00:00" ?
dol_print_date($object->array_options[
'options_'.$key],
'dayhour',
'tzserver', $outputlangs) :
'');
900 $object->array_options[
'options_'.$key.
'_rfc'] = ($datetime !=
"0000-00-00 00:00:00" ?
dol_print_date($object->array_options[
'options_'.$key],
'dayhourrfc') :
'');
901 $array_to_fill = array_merge($array_to_fill, array($array_key.
'_options_'.$key.
'_locale' => $object->array_options[
'options_'.$key.
'_locale']));
902 $array_to_fill = array_merge($array_to_fill, array($array_key.
'_options_'.$key.
'_rfc' => $object->array_options[
'options_'.$key.
'_rfc']));
903 } elseif ($extrafields->attributes[$object->table_element][
'type'][$key] ==
'link')
905 $id = $object->array_options[
'options_'.$key];
908 $param = $extrafields->attributes[$object->table_element][
'param'][$key];
909 $param_list = array_keys($param[
'options']);
910 $InfoFieldList = explode(
":", $param_list[0]);
911 $classname = $InfoFieldList[0];
912 $classpath = $InfoFieldList[1];
913 if (!empty($classpath))
916 if ($classname && class_exists($classname))
918 $tmpobject =
new $classname($this->
db);
919 $tmpobject->fetch($id);
921 $object->array_options[
'options_'.$key] = $tmpobject->name;
927 $array_to_fill = array_merge($array_to_fill, array($array_key.
'_options_'.$key => $object->array_options[
'options_'.$key]));
931 return $array_to_fill;
947 public function printRect($pdf, $x, $y, $l, $h, $hidetop = 0, $hidebottom = 0)
949 if (empty($hidetop) || $hidetop == -1) $pdf->line($x, $y, $x + $l, $y);
950 $pdf->line($x + $l, $y, $x + $l, $y + $h);
951 if (empty($hidebottom)) $pdf->line($x + $l, $y + $h, $x, $y + $h);
952 $pdf->line($x, $y + $h, $x, $y);
965 if (empty($a[
'rank'])) { $a[
'rank'] = 0; }
966 if (empty($b[
'rank'])) { $b[
'rank'] = 0; }
967 if ($a[
'rank'] == $b[
'rank']) {
970 return ($a[
'rank'] > $b[
'rank']) ? -1 : 1;
987 $this->defineColumnField($object, $outputlangs, $hidedetails, $hidedesc, $hideref);
991 uasort($this->cols, array($this,
'columnSort'));
994 $curX = $this->page_largeur - $this->marge_droite;
997 $arrayWidth = $this->page_largeur - $this->marge_droite - $this->marge_gauche;
1000 $totalDefinedColWidth = 0;
1002 foreach ($this->cols as $colKey =>& $colDef)
1004 if (!$this->getColumnStatus($colKey))
continue;
1006 if (!empty($colDef[
'scale'])) {
1008 $colDef[
'width'] = abs($arrayWidth * $colDef[
'scale'] / 100);
1011 if (empty($colDef[
'width'])) {
1014 $totalDefinedColWidth += $colDef[
'width'];
1018 foreach ($this->cols as $colKey =>& $colDef)
1021 if (!empty($colDef[
'title'])) {
1022 $colDef[
'title'] = array_replace($this->defaultTitlesFieldsStyle, $colDef[
'title']);
1024 $colDef[
'title'] = $this->defaultTitlesFieldsStyle;
1028 if (!empty($colDef[
'content'])) {
1029 $colDef[
'content'] = array_replace($this->defaultContentsFieldsStyle, $colDef[
'content']);
1031 $colDef[
'content'] = $this->defaultContentsFieldsStyle;
1034 if ($this->getColumnStatus($colKey))
1037 if (empty($colDef[
'width'])) {
1038 $colDef[
'width'] = abs(($arrayWidth - $totalDefinedColWidth)) / $countFlexCol;
1043 $curX = $lastX - $colDef[
'width'];
1044 $colDef[
'xStartPos'] = $curX;
1045 $colDef[
'xEndPos'] = $lastX;
1058 $colDef = $this->cols[$colKey];
1059 return $colDef[
'width'] - $colDef[
'content'][
'padding'][3] - $colDef[
'content'][
'padding'][1];
1071 $colDef = $this->cols[$colKey];
1072 return $colDef[
'xStartPos'] + $colDef[
'content'][
'padding'][3];
1083 if (!isset($this->cols[$colKey][
'rank']))
return -1;
1084 return $this->cols[$colKey][
'rank'];
1096 public function insertNewColumnDef($newColKey, $defArray, $targetCol =
false, $insertAfterTarget =
false)
1102 if (!empty($targetCol)) {
1103 $rank = $this->getColumnRank($targetCol);
1104 if ($rank >= 0 && $insertAfterTarget) { $rank++; }
1108 if ($rank < 0 && !empty($defArray[
'rank'])) {
1109 $rank = $defArray[
'rank'];
1113 if ($rank < 0) {
return -1; }
1115 foreach ($this->cols as $colKey =>& $colDef)
1117 if ($rank <= $colDef[
'rank'])
1119 $colDef[
'rank'] = $colDef[
'rank'] + 1;
1123 $defArray[
'rank'] = $rank;
1124 $this->cols[$newColKey] = $defArray;
1141 global $hookmanager;
1143 $parameters = array(
1145 'columnText' => $columnText,
1146 'colKey' => $colKey,
1149 $reshook = $hookmanager->executeHooks(
'printStdColumnContent', $parameters, $this);
1150 if ($reshook < 0)
setEventMessages($hookmanager->error, $hookmanager->errors,
'errors');
1153 if (empty($columnText))
return;
1154 $pdf->SetXY($this->getColumnContentXStart($colKey), $curY);
1155 $colDef = $this->cols[$colKey];
1157 $curentCellPaddinds = $pdf->getCellPaddings();
1159 $pdf->setCellPaddings($colDef[
'content'][
'padding'][3], $colDef[
'content'][
'padding'][0], $colDef[
'content'][
'padding'][1], $colDef[
'content'][
'padding'][2]);
1160 $pdf->writeHTMLCell($colDef[
'width'], 2, $colDef[
'xStartPos'], $curY, $columnText, 0, 1, 0,
true, $colDef[
'content'][
'align']);
1163 $pdf->setCellPaddings($curentCellPaddinds[
'L'], $curentCellPaddinds[
'T'], $curentCellPaddinds[
'R'], $curentCellPaddinds[
'B']);
1182 public function printColDescContent($pdf, &$curY, $colKey, $object, $i, $outputlangs, $hideref = 0, $hidedesc = 0, $issupplierline = 0)
1185 $colDef = $this->cols[$colKey];
1187 $curentCellPaddinds = $pdf->getCellPaddings();
1189 $pdf->setCellPaddings($colDef[
'content'][
'padding'][3], $colDef[
'content'][
'padding'][0], $colDef[
'content'][
'padding'][1], $colDef[
'content'][
'padding'][2]);
1192 pdf_writelinedesc($pdf, $object, $i, $outputlangs, $colDef[
'width'], 3, $colDef[
'xStartPos'], $curY, $hideref, $hidedesc, $issupplierline);
1193 $posYAfterDescription = $pdf->GetY() - $colDef[
'content'][
'padding'][0];
1196 $pdf->setCellPaddings($curentCellPaddinds[
'L'], $curentCellPaddinds[
'T'], $curentCellPaddinds[
'R'], $curentCellPaddinds[
'B']);
1200 'display' =>
'list',
1201 'printableEnable' => array(3),
1202 'printableEnableNotEmpty' => array(4)
1204 $extrafieldDesc = $this->getExtrafieldsInHtml($object->lines[$i], $outputlangs, $params);
1205 if (!empty($extrafieldDesc)) {
1206 $this->printStdColumnContent($pdf, $posYAfterDescription, $colKey, $extrafieldDesc);
1220 global $hookmanager;
1222 if (empty($object->table_element)) {
return; }
1224 $extrafieldsKeyPrefix =
"options_";
1227 $pos = strpos($extrafieldKey, $extrafieldsKeyPrefix);
1229 $extrafieldKey = substr($extrafieldKey, strlen($extrafieldsKeyPrefix));
1232 $extrafieldOptionsKey = $extrafieldsKeyPrefix.$extrafieldKey;
1236 if (empty($this->extrafieldsCache)) { $this->extrafieldsCache =
new ExtraFields($this->
db); }
1237 if (empty($this->extrafieldsCache->attributes[$object->table_element])) { $this->extrafieldsCache->fetch_name_optionals_label($object->table_element); }
1238 $extrafields = $this->extrafieldsCache;
1240 $extrafieldOutputContent = $extrafields->showOutputField($extrafieldKey, $object->array_options[$extrafieldOptionsKey],
'', $object->table_element);
1243 if ($extrafields->attributes[$object->table_element][
'type'][$extrafieldKey] ==
'link') {
1248 $parameters = array(
1249 'object' => $object,
1250 'extrafields' => $extrafields,
1251 'extrafieldKey' => $extrafieldKey,
1252 'extrafieldOutputContent' =>& $extrafieldOutputContent
1254 $reshook = $hookmanager->executeHooks(
'getPDFExtrafieldContent', $parameters, $this);
1255 if ($reshook < 0)
setEventMessages($hookmanager->error, $hookmanager->errors,
'errors');
1258 $extrafieldOutputContent = $hookmanager->resPrint;
1261 return $extrafieldOutputContent;
1273 public function getExtrafieldsInHtml($object, $outputlangs, $params = array())
1275 global $hookmanager;
1277 if (empty($object->table_element)) {
1282 if (empty($this->extrafieldsCache)) { $this->extrafieldsCache =
new ExtraFields($this->
db); }
1283 if (empty($this->extrafieldsCache->attributes[$object->table_element])) { $this->extrafieldsCache->fetch_name_optionals_label($object->table_element); }
1284 $extrafields = $this->extrafieldsCache;
1286 $defaultParams = array(
1288 'display' =>
'auto',
1289 'printableEnable' => array(1),
1290 'printableEnableNotEmpty' => array(2),
1293 'maxItemsInRow' => 2,
1297 'labelcolwidth' =>
'25%',
1298 'arrayOfLineBreakType' => array(
'text',
'html')
1302 'separator' =>
'<br/>'
1311 $params = $params + $defaultParams;
1321 if (!empty($extrafields->attributes[$object->table_element][
'label']) && is_array($extrafields->attributes[$object->table_element][
'label'])) {
1322 foreach ($extrafields->attributes[$object->table_element][
'label'] as $key => $label)
1326 $disableOnEmpty = 0;
1327 if (!empty($extrafields->attributes[$object->table_element][
'printable'][$key])) {
1328 $printable = intval($extrafields->attributes[$object->table_element][
'printable'][$key]);
1329 if (in_array($printable, $params[
'printableEnable']) || in_array($printable, $params[
'printableEnableNotEmpty'])) {
1333 if (in_array($printable, $params[
'printableEnableNotEmpty'])) {
1334 $disableOnEmpty = 1;
1338 if (empty($enabled)) {
1342 $field =
new stdClass();
1343 $field->rank = intval($extrafields->attributes[$object->table_element][
'pos'][$key]);
1344 $field->content = $this->getExtrafieldContent($object, $key);
1345 $field->label = $outputlangs->transnoentities($label);
1346 $field->type = $extrafields->attributes[$object->table_element][
'type'][$key];
1349 if ($disableOnEmpty && empty($field->content)) {
1357 if (!empty($fields))
1360 uasort($fields,
function ($a, $b) {
1361 return ($a->rank > $b->rank) ? 1 : -1;
1365 $html .= !empty($params[
'style']) ?
'<style>'.$params[
'style'].
'</style>' :
'';
1368 if ($params[
'display'] ==
'auto') {
1369 $lastNnumbItems = 0;
1370 foreach ($params[
'auto'] as $display => $numbItems) {
1371 if ($lastNnumbItems <= $numbItems && count($fields) > $numbItems) {
1372 $lastNnumbItems = $numbItems;
1373 $params[
'display'] = $display;
1378 if ($params[
'display'] ==
'list') {
1381 foreach ($fields as $field) {
1382 $html .= !empty($i) ? $params[
'list'][
'separator'] :
'';
1383 $html .=
'<strong>'.$field->label.
' : </strong>';
1384 $html .= $field->content;
1387 } elseif ($params[
'display'] ==
'table') {
1389 $html .=
'<table class="extrafield-table" cellspacing="'.$params[
'table'][
'cellspacing'].
'" cellpadding="'.$params[
'table'][
'cellpadding'].
'" border="'.$params[
'table'][
'border'].
'">';
1393 $maxItemsInRow = $params[
'table'][
'maxItemsInRow'];
1394 foreach ($fields as $field) {
1396 if ($itemsInRow >= $maxItemsInRow) {
1398 $html .=
"</tr><tr>";
1403 if (in_array($field->type, $params[
'table'][
'arrayOfLineBreakType'])) {
1404 if ($itemsInRow > 0) {
1406 for ($i = $itemsInRow; $i <= $maxItemsInRow; $i++) {
1407 $html .=
"<td></td><td></td>";
1415 $itemsInRow = $maxItemsInRow;
1416 $html .=
'<td colspan="'.($maxItemsInRow * 2 - 1).
'">';
1417 $html .=
'<strong>'.$field->label.
' :</strong> ';
1418 $html .= $field->content;
1422 $html .=
'<td width="'.$params[
'table'][
'labelcolwidth'].
'" class="extrafield-label">';
1423 $html .=
'<strong>'.$field->label.
' :</strong>';
1427 $html .=
'<td class="extrafield-content">';
1428 $html .= $field->content;
1434 $html .=
'</table>';
1450 if (!empty($this->cols[$colKey][
'status'])) {
1452 }
else return false;
1465 public function pdfTabTitles(&$pdf, $tab_top, $tab_height, $outputlangs, $hidetop = 0)
1467 global $hookmanager, $conf;
1469 foreach ($this->cols as $colKey => $colDef) {
1470 $parameters = array(
1471 'colKey' => $colKey,
1473 'outputlangs' => $outputlangs,
1474 'tab_top' => $tab_top,
1475 'tab_height' => $tab_height,
1476 'hidetop' => $hidetop
1479 $reshook = $hookmanager->executeHooks(
'pdfTabTitles', $parameters, $this);
1482 } elseif (empty($reshook)) {
1483 if (!$this->getColumnStatus($colKey))
continue;
1486 $colDef[
'title'][
'label'] = !empty($colDef[
'title'][
'label']) ? $colDef[
'title'][
'label'] : $outputlangs->transnoentities($colDef[
'title'][
'textkey']);
1489 if (!empty($colDef[
'border-left'])) {
1490 $pdf->line($colDef[
'xStartPos'], $tab_top, $colDef[
'xStartPos'], $tab_top + $tab_height);
1493 if (empty($hidetop)) {
1495 $curentCellPaddinds = $pdf->getCellPaddings();
1498 global $outputlangsbis;
1499 if (is_object($outputlangsbis)) {
1501 $pdf->setCellPaddings($colDef[
'title'][
'padding'][3], $colDef[
'title'][
'padding'][0], $colDef[
'title'][
'padding'][1], 0.5);
1504 $pdf->setCellPaddings($colDef[
'title'][
'padding'][3], $colDef[
'title'][
'padding'][0], $colDef[
'title'][
'padding'][1], $colDef[
'title'][
'padding'][2]);
1507 $pdf->SetXY($colDef[
'xStartPos'], $tab_top);
1508 $textWidth = $colDef[
'width'];
1509 $pdf->MultiCell($textWidth, 2, $colDef[
'title'][
'label'],
'', $colDef[
'title'][
'align']);
1512 if (is_object($outputlangsbis) && trim($colDef[
'title'][
'label'])) {
1513 $pdf->setCellPaddings($colDef[
'title'][
'padding'][3], 0, $colDef[
'title'][
'padding'][1], $colDef[
'title'][
'padding'][2]);
1514 $pdf->SetXY($colDef[
'xStartPos'], $pdf->GetY());
1515 $textbis = $outputlangsbis->transnoentities($colDef[
'title'][
'textkey']);
1516 $pdf->MultiCell($textWidth, 2, $textbis,
'', $colDef[
'title'][
'align']);
1519 $this->tabTitleHeight = max($pdf->GetY() - $tab_top, $this->tabTitleHeight);
1522 $pdf->setCellPaddings($curentCellPaddinds[
'L'], $curentCellPaddinds[
'T'], $curentCellPaddinds[
'R'], $curentCellPaddinds[
'B']);
1527 return $this->tabTitleHeight;
1544 if (!empty($hidedetails)) {
1548 if (empty($object->table_element)) {
1553 if (empty($this->extrafieldsCache)) { $this->extrafieldsCache =
new ExtraFields($this->
db); }
1554 if (empty($this->extrafieldsCache->attributes[$object->table_element])) { $this->extrafieldsCache->fetch_name_optionals_label($object->table_element); }
1555 $extrafields = $this->extrafieldsCache;
1558 if (!empty($extrafields->attributes[$object->table_element]) && is_array($extrafields->attributes[$object->table_element][
'label'])) {
1559 foreach ($extrafields->attributes[$object->table_element][
'label'] as $key => $label)
1562 if ($extrafields->attributes[$object->table_element][
'type'][$key] ==
'separate')
1569 if (!empty($extrafields->attributes[$object->table_element][
'printable'][$key])) {
1570 $printable = intval($extrafields->attributes[$object->table_element][
'printable'][$key]);
1571 if ($printable === 1 || $printable === 2) {
1577 if (!$enabled) {
continue; }
1580 if (!empty($extrafields->attributes[$object->table_element][
'langfile'][$key])) $outputlangs->load($extrafields->attributes[$object->table_element][
'langfile'][$key]);
1586 'rank' => intval($extrafields->attributes[$object->table_element][
'pos'][$key]),
1588 'status' => boolval($enabled),
1590 'label' => $outputlangs->transnoentities($label)
1595 'border-left' =>
true,
1598 $alignTypeRight = array(
'double',
'int',
'price');
1599 if (in_array($extrafields->attributes[$object->table_element][
'type'][$key], $alignTypeRight)) {
1600 $def[
'content'][
'align'] =
'R';
1603 $alignTypeLeft = array(
'text',
'html');
1604 if (in_array($extrafields->attributes[$object->table_element][
'type'][$key], $alignTypeLeft)) {
1605 $def[
'content'][
'align'] =
'L';
1610 $this->insertNewColumnDef(
"options_".$key, $def);
if(!function_exists('dol_getprefix')) dol_include_once($relpath, $classname= '')
Make an include_once using default root and alternate root if it fails.
getExtrafieldContent($object, $extrafieldKey)
get extrafield content for pdf writeHtmlCell compatibility usage for PDF line columns and object note...
dol_string_nohtmltag($stringtoclean, $removelinefeed=1, $pagecodeto= 'UTF-8', $strip_tags=0, $removedoublespaces=1)
Clean a string from all HTML tags and entities.
prepareArrayColumnField($object, $outputlangs, $hidedetails=0, $hidedesc=0, $hideref=0)
Prepare Array Column Field.
insertNewColumnDef($newColKey, $defArray, $targetCol=false, $insertAfterTarget=false)
get column position rank from column key
getColumnRank($colKey)
get column position rank from column key
get_substitutionarray_each_var_object(&$object, $outputlangs, $recursive=true)
Define array with couple substitution key => substitution value.
Class to manage products or services.
printColDescContent($pdf, &$curY, $colKey, $object, $i, $outputlangs, $hideref=0, $hidedesc=0, $issupplierline=0)
print description column content
dol_now($mode= 'auto')
Return date for now.
__construct($db)
Constructor.
get_substitutionarray_user($user, $outputlangs)
Define array with couple substitution key => substitution value.
isASecretKey($keyname)
Return if string has a name dedicated to store a secret.
get_substitutionarray_shipment($object, $outputlangs, $array_key= 'object')
Define array with couple substitution key => substitution value.
defineColumnExtrafield($object, $outputlangs, $hidedetails=0)
Define Array Column Field for extrafields.
printStdColumnContent($pdf, &$curY, $colKey, $columnText= '')
print standard column content
get_substitutionarray_object($object, $outputlangs, $array_key= 'object')
Define array with couple substitution key => substitution value.
doc_getlinedesc($line, $outputlangs, $hideref=0, $hidedesc=0, $issupplierline=0)
Return line description translated in outputlangs and encoded into UTF8.
$conf db
API class for accounts.
Class to manage bank accounts.
get_substitutionarray_shipment_lines($line, $outputlangs)
Define array with couple substitution key => substitution value.
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...
getColumnStatus($colKey)
get column status from column key
get_substitutionarray_contact($object, $outputlangs, $array_key= 'object')
Define array with couple substitution key => substitution value.
setEventMessages($mesg, $mesgs, $style= 'mesgs', $messagekey= '')
Set event messages in dol_events session object.
getFormeJuridiqueLabel($code)
Retourne le nom traduit de la forme juridique.
pdfTabTitles(&$pdf, $tab_top, $tab_height, $outputlangs, $hidetop=0)
Print standard column content.
price2num($amount, $rounding= '', $option=0)
Function that return a number with universal decimal format (decimal separator is '...
get_substitutionarray_thirdparty($object, $outputlangs, $array_key= 'company')
Define array with couple substitution key => substitution value.
getColumnContentXStart($colKey)
get column content X (abscissa) left position from column key
get_exdir($num, $level, $alpha, $withoutslash, $object, $modulepart= '')
Return a path to have a the directory according to object where files are stored. ...
get_substitutionarray_mysoc($mysoc, $outputlangs)
Define array with couple substitution key => substitution value.
getState($id, $withcode= '', $dbtouse=0, $withregion=0, $outputlangs= '', $entconv=1)
Return state translated from an id.
printRect($pdf, $x, $y, $l, $h, $hidetop=0, $hidebottom=0)
Rect pdf.
columnSort($a, $b)
uasort callback function to Sort columns fields
vatrate($rate, $addpercent=false, $info_bits=0, $usestarfornpr=0)
Return a string with VAT rate label formated for view output Used into pdf and HTML pages...
getSubstitutionarrayMember($member, $outputlangs)
Define array with couple substitution key => substitution value.
dol_print_date($time, $format= '', $tzoutput= 'auto', $outputlangs= '', $encodetooutput=false)
Output date in a string format according to outputlangs (or langs if not defined).
pdf_writelinedesc(&$pdf, $object, $i, $outputlangs, $w, $h, $posx, $posy, $hideref=0, $hidedesc=0, $issupplierline=0)
Output line description into PDF.
fill_substitutionarray_with_extrafields($object, $array_to_fill, $extrafields, $array_key, $outputlangs)
Fill array with couple extrafield key => extrafield value.
if(!empty($conf->facture->enabled)&&$user->rights->facture->lire) if((!empty($conf->fournisseur->enabled)&&empty($conf->global->MAIN_USE_NEW_SUPPLIERMOD)||!empty($conf->supplier_invoice->enabled))&&$user->rights->fournisseur->facture->lire) if(!empty($conf->don->enabled)&&$user->rights->don->lire) if(!empty($conf->tax->enabled)&&$user->rights->tax->charges->lire) if(!empty($conf->facture->enabled)&&!empty($conf->commande->enabled)&&$user->rights->commande->lire &&empty($conf->global->WORKFLOW_DISABLE_CREATE_INVOICE_FROM_ORDER)) if(!empty($conf->facture->enabled)&&$user->rights->facture->lire) if((!empty($conf->fournisseur->enabled)&&empty($conf->global->MAIN_USE_NEW_SUPPLIERMOD)||!empty($conf->supplier_invoice->enabled))&&$user->rights->fournisseur->facture->lire) $resql
Social contributions to pay.
Parent class for documents generators.
get_substitutionarray_other($outputlangs)
Define array with couple substitution key => substitution value.
Class to manage invoices.
get_substitutionarray_lines($line, $outputlangs, $linenumber=0)
Define array with couple substitution key => substitution value.
getColumnContentWidth($colKey)
get column content width from column key
measuringUnitString($unit, $measuring_style= '', $scale= '', $use_short_label=0, $outputlangs=null)
Return translation label of a unit key.