dolibarr  20.0.0-beta
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  $line1 .= ($line1 ? " - " : "").getFormeJuridiqueLabel($fromcompany->forme_juridique_code);
72  }
73  // Capital
74  if ($fromcompany->capital) {
75  $line1 .= ($line1 ? " - " : "").$langs->transnoentities("CapitalOf", $fromcompany->capital)." ".$langs->transnoentities("Currency".$conf->currency);
76  }
77 
78  $reg = array();
79 
80  // Prof Id 1
81  if ($fromcompany->idprof1 && ($fromcompany->country_code != 'FR' || !$fromcompany->idprof2)) {
82  $field = $langs->transcountrynoentities("ProfId1", $fromcompany->country_code);
83  if (preg_match('/\‍((.*)\‍)/i', $field, $reg)) {
84  $field = $reg[1];
85  }
86  $line1 .= ($line1 ? " - " : "").$field.": ".$fromcompany->idprof1;
87  }
88  // Prof Id 2
89  if ($fromcompany->idprof2) {
90  $field = $langs->transcountrynoentities("ProfId2", $fromcompany->country_code);
91  if (preg_match('/\‍((.*)\‍)/i', $field, $reg)) {
92  $field = $reg[1];
93  }
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  $field = $langs->transcountrynoentities("ProfId3", $fromcompany->country_code);
102  if (preg_match('/\‍((.*)\‍)/i', $field, $reg)) {
103  $field = $reg[1];
104  }
105  $line2 .= ($line2 ? " - " : "").$field.": ".$fromcompany->idprof3;
106  }
107  // Prof Id 4
108  if ($fromcompany->idprof4) {
109  $field = $langs->transcountrynoentities("ProfId4", $fromcompany->country_code);
110  if (preg_match('/\‍((.*)\‍)/i', $field, $reg)) {
111  $field = $reg[1];
112  }
113  $line2 .= ($line2 ? " - " : "").$field.": ".$fromcompany->idprof4;
114  }
115  // IntraCommunautary VAT
116  if ($fromcompany->tva_intra != '') {
117  $line2 .= ($line2 ? " - " : "").$langs->transnoentities("VATIntraShort").": ".$fromcompany->tva_intra;
118  }
119 
120  print '<br><br><hr>'."\n";
121  print '<div class="center"><span style="font-size: 10px;">'."\n";
122  print $fromcompany->name.'<br>';
123  print $line1.'<br>';
124  print $line2;
125  print '</span></div>'."\n";
126 }
if($user->socid > 0) if(! $user->hasRight('accounting', 'chartofaccount')) $object
Definition: card.php:58
getFormeJuridiqueLabel($code)
Return the name translated of juridical status.
complete_head_from_modules($conf, $langs, $object, &$head, &$h, $type, $mode='add', $filterorigmodule='')
Complete or removed entries into a head array (used to build tabs).
stripeadmin_prepare_head()
Define head array for tabs of stripe tools setup pages.
Definition: stripe.lib.php:31
html_print_stripe_footer($fromcompany, $langs)
Show footer of company in HTML pages.
Definition: stripe.lib.php:64