dolibarr  13.0.2
stripe.lib.php
Go to the documentation of this file.
1 <?php
2 /* Copyright (C) 2017 Alexandre Spangaro <aspangaro@open-dsi.fr>
3  *
4  * This program is free software; you can redistribute it and/or modify
5  * it under the terms of the GNU General Public License as published by
6  * the Free Software Foundation; either version 3 of the License, or
7  * (at your option) any later version.
8  *
9  * This program is distributed in the hope that it will be useful,
10  * but WITHOUT ANY WARRANTY; without even the implied warranty of
11  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
12  * GNU General Public License for more details.
13  *
14  * You should have received a copy of the GNU General Public License
15  * along with this program. If not, see <https://www.gnu.org/licenses/>.
16  */
17 
24 require_once DOL_DOCUMENT_ROOT.'/core/lib/payments.lib.php';
25 
32 {
33  global $langs, $conf;
34 
35  $h = 0;
36  $head = array();
37 
38  $head[$h][0] = DOL_URL_ROOT."/stripe/admin/stripe.php";
39  $head[$h][1] = $langs->trans("Stripe");
40  $head[$h][2] = 'stripeaccount';
41  $h++;
42 
43  $object = new stdClass();
44 
45  // Show more tabs from modules
46  // Entries must be declared in modules descriptor with line
47  // $this->tabs = array('entity:+tabname:Title:@mymodule:/mymodule/mypage.php?id=__ID__'); to add new tab
48  // $this->tabs = array('entity:-tabname); to remove a tab
49  complete_head_from_modules($conf, $langs, $object, $head, $h, 'stripeadmin');
50 
51  complete_head_from_modules($conf, $langs, $object, $head, $h, 'stripeadmin', 'remove');
52 
53  return $head;
54 }
55 
56 
64 function html_print_stripe_footer($fromcompany, $langs)
65 {
66  global $conf;
67 
68  // Juridical status
69  $line1 = "";
70  if ($fromcompany->forme_juridique_code)
71  {
72  $line1 .= ($line1 ? " - " : "").getFormeJuridiqueLabel($fromcompany->forme_juridique_code);
73  }
74  // Capital
75  if ($fromcompany->capital)
76  {
77  $line1 .= ($line1 ? " - " : "").$langs->transnoentities("CapitalOf", $fromcompany->capital)." ".$langs->transnoentities("Currency".$conf->currency);
78  }
79 
80  $reg = array();
81 
82  // Prof Id 1
83  if ($fromcompany->idprof1 && ($fromcompany->country_code != 'FR' || !$fromcompany->idprof2))
84  {
85  $field = $langs->transcountrynoentities("ProfId1", $fromcompany->country_code);
86  if (preg_match('/\((.*)\)/i', $field, $reg)) $field = $reg[1];
87  $line1 .= ($line1 ? " - " : "").$field.": ".$fromcompany->idprof1;
88  }
89  // Prof Id 2
90  if ($fromcompany->idprof2)
91  {
92  $field = $langs->transcountrynoentities("ProfId2", $fromcompany->country_code);
93  if (preg_match('/\((.*)\)/i', $field, $reg)) $field = $reg[1];
94  $line1 .= ($line1 ? " - " : "").$field.": ".$fromcompany->idprof2;
95  }
96 
97  // Second line of company infos
98  $line2 = "";
99  // Prof Id 3
100  if ($fromcompany->idprof3)
101  {
102  $field = $langs->transcountrynoentities("ProfId3", $fromcompany->country_code);
103  if (preg_match('/\((.*)\)/i', $field, $reg)) $field = $reg[1];
104  $line2 .= ($line2 ? " - " : "").$field.": ".$fromcompany->idprof3;
105  }
106  // Prof Id 4
107  if ($fromcompany->idprof4)
108  {
109  $field = $langs->transcountrynoentities("ProfId4", $fromcompany->country_code);
110  if (preg_match('/\((.*)\)/i', $field, $reg)) $field = $reg[1];
111  $line2 .= ($line2 ? " - " : "").$field.": ".$fromcompany->idprof4;
112  }
113  // IntraCommunautary VAT
114  if ($fromcompany->tva_intra != '')
115  {
116  $line2 .= ($line2 ? " - " : "").$langs->transnoentities("VATIntraShort").": ".$fromcompany->tva_intra;
117  }
118 
119  print '<br><br><hr>'."\n";
120  print '<div class="center"><font style="font-size: 10px;">'."\n";
121  print $fromcompany->name.'<br>';
122  print $line1.'<br>';
123  print $line2;
124  print '</font></div>'."\n";
125 }
stripeadmin_prepare_head()
Define head array for tabs of stripe tools setup pages.
Definition: stripe.lib.php:31
getFormeJuridiqueLabel($code)
Retourne le nom traduit de la forme juridique.
html_print_stripe_footer($fromcompany, $langs)
Show footer of company in HTML pages.
Definition: stripe.lib.php:64
print
Draft customers invoices.
Definition: index.php:89
complete_head_from_modules($conf, $langs, $object, &$head, &$h, $type, $mode= 'add')
Complete or removed entries into a head array (used to build tabs).