payments.lib.php 5.1 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158
  1. <?php
  2. /**
  3. * Copyright (C) 2013 Marcos García <marcosgdf@gmail.com>
  4. *
  5. * This program is free software; you can redistribute it and/or modify
  6. * it under the terms of the GNU General Public License as published by
  7. * the Free Software Foundation; either version 3 of the License, or
  8. * (at your option) any later version.
  9. *
  10. * This program is distributed in the hope that it will be useful,
  11. * but WITHOUT ANY WARRANTY; without even the implied warranty of
  12. * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
  13. * GNU General Public License for more details.
  14. *
  15. * You should have received a copy of the GNU General Public License
  16. * along with this program. If not, see <http://www.gnu.org/licenses/>.
  17. * or see http://www.gnu.org/
  18. */
  19. /**
  20. * Returns an array with the tabs for the "Payment" section
  21. * It loads tabs from modules looking for the entity payment
  22. *
  23. * @param Paiement $object Current payment object
  24. * @return array Tabs for the payment section
  25. */
  26. function payment_prepare_head(Paiement $object) {
  27. global $langs, $conf;
  28. $h = 0;
  29. $head = array();
  30. $head[$h][0] = DOL_URL_ROOT.'/compta/paiement/card.php?id='.$object->id;
  31. $head[$h][1] = $langs->trans("Card");
  32. $head[$h][2] = 'payment';
  33. $h++;
  34. // Show more tabs from modules
  35. // Entries must be declared in modules descriptor with line
  36. // $this->tabs = array('entity:+tabname:Title:@mymodule:/mymodule/mypage.php?id=__ID__'); to add new tab
  37. // $this->tabs = array('entity:-tabname); to remove a tab
  38. complete_head_from_modules($conf,$langs,$object,$head,$h,'payment');
  39. $head[$h][0] = DOL_URL_ROOT.'/compta/paiement/info.php?id='.$object->id;
  40. $head[$h][1] = $langs->trans("Info");
  41. $head[$h][2] = 'info';
  42. $h++;
  43. complete_head_from_modules($conf,$langs,$object,$head,$h,'payment', 'remove');
  44. return $head;
  45. }
  46. /**
  47. * Returns an array with the tabs for the "Supplier payment" section
  48. * It loads tabs from modules looking for the entity payment_supplier
  49. *
  50. * @param Paiement $object Current payment object
  51. * @return array Tabs for the payment section
  52. */
  53. function payment_supplier_prepare_head(Paiement $object) {
  54. global $langs, $conf;
  55. $h = 0;
  56. $head = array();
  57. $head[$h][0] = DOL_URL_ROOT.'/fourn/paiement/card.php?id='.$object->id;
  58. $head[$h][1] = $langs->trans("Card");
  59. $head[$h][2] = 'payment';
  60. $h++;
  61. // Show more tabs from modules
  62. // Entries must be declared in modules descriptor with line
  63. // $this->tabs = array('entity:+tabname:Title:@mymodule:/mymodule/mypage.php?id=__ID__'); to add new tab
  64. // $this->tabs = array('entity:-tabname); to remove a tab
  65. complete_head_from_modules($conf,$langs,$object,$head,$h,'payment_supplier');
  66. $head[$h][0] = DOL_URL_ROOT.'/fourn/paiement/info.php?id='.$object->id;
  67. $head[$h][1] = $langs->trans('Info');
  68. $head[$h][2] = 'info';
  69. $h++;
  70. complete_head_from_modules($conf,$langs,$object,$head,$h,'payment_supplier', 'remove');
  71. return $head;
  72. }
  73. /**
  74. * Show footer of company in HTML pages
  75. *
  76. * @param Societe $fromcompany Third party
  77. * @param Translate $langs Output language
  78. * @return void
  79. */
  80. function htmlPrintOnlinePaymentFooter($fromcompany,$langs)
  81. {
  82. global $conf;
  83. // Juridical status
  84. $line1="";
  85. if ($fromcompany->forme_juridique_code)
  86. {
  87. $line1.=($line1?" - ":"").getFormeJuridiqueLabel($fromcompany->forme_juridique_code);
  88. }
  89. // Capital
  90. if ($fromcompany->capital)
  91. {
  92. $line1.=($line1?" - ":"").$langs->transnoentities("CapitalOf",$fromcompany->capital)." ".$langs->transnoentities("Currency".$conf->currency);
  93. }
  94. // Prof Id 1
  95. if ($fromcompany->idprof1 && ($fromcompany->country_code != 'FR' || ! $fromcompany->idprof2))
  96. {
  97. $field=$langs->transcountrynoentities("ProfId1",$fromcompany->country_code);
  98. if (preg_match('/\((.*)\)/i',$field,$reg)) $field=$reg[1];
  99. $line1.=($line1?" - ":"").$field.": ".$fromcompany->idprof1;
  100. }
  101. // Prof Id 2
  102. if ($fromcompany->idprof2)
  103. {
  104. $field=$langs->transcountrynoentities("ProfId2",$fromcompany->country_code);
  105. if (preg_match('/\((.*)\)/i',$field,$reg)) $field=$reg[1];
  106. $line1.=($line1?" - ":"").$field.": ".$fromcompany->idprof2;
  107. }
  108. // Second line of company infos
  109. $line2="";
  110. // Prof Id 3
  111. if ($fromcompany->idprof3)
  112. {
  113. $field=$langs->transcountrynoentities("ProfId3",$fromcompany->country_code);
  114. if (preg_match('/\((.*)\)/i',$field,$reg)) $field=$reg[1];
  115. $line2.=($line2?" - ":"").$field.": ".$fromcompany->idprof3;
  116. }
  117. // Prof Id 4
  118. if ($fromcompany->idprof4)
  119. {
  120. $field=$langs->transcountrynoentities("ProfId4",$fromcompany->country_code);
  121. if (preg_match('/\((.*)\)/i',$field,$reg)) $field=$reg[1];
  122. $line2.=($line2?" - ":"").$field.": ".$fromcompany->idprof4;
  123. }
  124. // IntraCommunautary VAT
  125. if ($fromcompany->tva_intra != '')
  126. {
  127. $line2.=($line2?" - ":"").$langs->transnoentities("VATIntraShort").": ".$fromcompany->tva_intra;
  128. }
  129. print '<br><br><hr>'."\n";
  130. print '<div class="center"><font style="font-size: 10px;">'."\n";
  131. print $fromcompany->name.'<br>';
  132. print $line1.'<br>';
  133. print $line2;
  134. print '</font></div>'."\n";
  135. }