PageRenderTime 44ms CodeModel.GetById 19ms RepoModel.GetById 0ms app.codeStats 0ms

/htdocs/core/class/commondocgenerator.class.php

https://github.com/asterix14/dolibarr
PHP | 142 lines | 80 code | 16 blank | 46 comment | 2 complexity | a28d80e2c4e0b64d6c2e1216243335cf MD5 | raw file
Possible License(s): LGPL-2.0
  1. <?php
  2. /* Copyright (C) 2003-2005 Rodolphe Quiedeville <rodolphe@quiedeville.org>
  3. * Copyright (C) 2004-2010 Laurent Destailleur <eldy@users.sourceforge.net>
  4. * Copyright (C) 2004 Eric Seigne <eric.seigne@ryxeo.com>
  5. * Copyright (C) 2005-2007 Regis Houssin <regis@dolibarr.fr>
  6. *
  7. * This program is free software; you can redistribute it and/or modify
  8. * it under the terms of the GNU General Public License as published by
  9. * the Free Software Foundation; either version 2 of the License, or
  10. * (at your option) any later version.
  11. *
  12. * This program is distributed in the hope that it will be useful,
  13. * but WITHOUT ANY WARRANTY; without even the implied warranty of
  14. * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
  15. * GNU General Public License for more details.
  16. *
  17. * You should have received a copy of the GNU General Public License
  18. * along with this program. If not, see <http://www.gnu.org/licenses/>.
  19. * or see http://www.gnu.org/
  20. */
  21. /**
  22. * \file htdocs/core/class/commondocgenerator.class.php
  23. * \ingroup core
  24. * \brief File of parent class for documents generators
  25. */
  26. /**
  27. * \class CommonDocGenerator
  28. * \brief Parent class for documents generators
  29. */
  30. abstract class CommonDocGenerator
  31. {
  32. var $error='';
  33. /**
  34. * Define array with couple subtitution key => subtitution value
  35. *
  36. * @param $user User
  37. * @param $outputlangs Language object for output
  38. */
  39. function get_substitutionarray_user($user,$outputlangs)
  40. {
  41. global $conf;
  42. return array(
  43. 'myuser_lastname'=>$user->lastname,
  44. 'myuser_firstname'=>$user->firstname,
  45. 'myuser_login'=>$user->login,
  46. 'myuser_phone'=>$user->officephone,
  47. 'myuser_fax'=>$user->officefax,
  48. 'myuser_mobile'=>$user->user_mobile,
  49. 'myuser_email'=>$user->user_email,
  50. 'myuser_web'=>$user->url
  51. );
  52. }
  53. /**
  54. * Define array with couple subtitution key => subtitution value
  55. *
  56. * @param $mysoc
  57. * @param $outputlangs Language object for output
  58. */
  59. function get_substitutionarray_mysoc($mysoc,$outputlangs)
  60. {
  61. global $conf;
  62. if (empty($mysoc->forme_juridique) && ! empty($mysoc->forme_juridique_code))
  63. {
  64. $mysoc->forme_juridique=getFormeJuridiqueLabel($mysoc->forme_juridique_code);
  65. }
  66. $logotouse=$conf->mycompany->dir_output.'/logos/thumbs/'.$mysoc->logo_small;
  67. return array(
  68. 'mycompany_logo'=>$logotouse,
  69. 'mycompany_name'=>$mysoc->name,
  70. 'mycompany_email'=>$mysoc->email,
  71. 'mycompany_phone'=>$mysoc->phone,
  72. 'mycompany_fax'=>$mysoc->fax,
  73. 'mycompany_address'=>$mysoc->address,
  74. 'mycompany_zip'=>$mysoc->zip,
  75. 'mycompany_town'=>$mysoc->town,
  76. 'mycompany_country'=>$outputlangs->transnoentitiesnoconv("Country".$mysoc->pays_code),
  77. 'mycompany_country_code'=>$mysoc->pays_code,
  78. 'mycompany_web'=>$mysoc->url,
  79. 'mycompany_juridicalstatus'=>$mysoc->forme_juridique,
  80. 'mycompany_capital'=>$mysoc->capital,
  81. 'mycompany_barcode'=>$mysoc->gencod,
  82. 'mycompany_idprof1'=>$mysoc->idprof1,
  83. 'mycompany_idprof2'=>$mysoc->idprof2,
  84. 'mycompany_idprof3'=>$mysoc->idprof3,
  85. 'mycompany_idprof4'=>$mysoc->idprof4,
  86. 'mycompany_vatnumber'=>$mysoc->tva_intra,
  87. 'mycompany_note'=>$mysoc->note
  88. );
  89. }
  90. /**
  91. * Define array with couple subtitution key => subtitution value
  92. *
  93. * @param $object
  94. * @param $outputlangs Language object for output
  95. */
  96. function get_substitutionarray_thirdparty($object,$outputlangs)
  97. {
  98. global $conf;
  99. return array(
  100. 'company_name'=>$object->name,
  101. 'company_email'=>$object->email,
  102. 'company_phone'=>$object->phone,
  103. 'company_fax'=>$object->fax,
  104. 'company_address'=>$object->address,
  105. 'company_zip'=>$object->zip,
  106. 'company_town'=>$object->town,
  107. 'company_country_code'=>$object->country_code,
  108. 'company_country'=>$outputlangs->transnoentitiesnoconv("Country".$object->country_code),
  109. 'company_web'=>$object->url,
  110. 'company_barcode'=>$object->gencod,
  111. 'company_vatnumber'=>$object->tva_intra,
  112. 'company_customercode'=>$object->code_client,
  113. 'company_suppliercode'=>$object->code_fournisseur,
  114. 'company_customeraccountancycode'=>$object->code_compta,
  115. 'company_supplieraccountancycode'=>$object->code_compta_fournisseur,
  116. 'company_juridicalstatus'=>$object->forme_juridique,
  117. 'company_capital'=>$object->capital,
  118. 'company_idprof1'=>$object->idprof1,
  119. 'company_idprof2'=>$object->idprof2,
  120. 'company_idprof3'=>$object->idprof3,
  121. 'company_idprof4'=>$object->idprof4,
  122. 'company_note'=>$object->note
  123. );
  124. }
  125. }
  126. ?>