dolibarr 21.0.0-alpha
modStripe.class.php
Go to the documentation of this file.
1<?php
2/* Copyright (C) 2017 Alexandre Spangaro <aspangaro@open-dsi.fr>
3 * Copyright (C) 2017 Saasprov <saasprov@gmail.com>
4 * Copyright (C) 2024 MDW <mdeweerd@users.noreply.github.com>
5 *
6 * This program is free software; you can redistribute it and/or modify
7 * it under the terms of the GNU General Public License as published by
8 * the Free Software Foundation; either version 3 of the License, or
9 * (at your option) any later version.
10 *
11 * This program is distributed in the hope that it will be useful,
12 * but WITHOUT ANY WARRANTY; without even the implied warranty of
13 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
14 * GNU General Public License for more details.
15 *
16 * You should have received a copy of the GNU General Public License
17 * along with this program. If not, see <https://www.gnu.org/licenses/>.
18 */
19
27include_once DOL_DOCUMENT_ROOT.'/core/modules/DolibarrModules.class.php';
28
29
34{
40 public function __construct($db)
41 {
42 $this->db = $db;
43
44 // Id for module (must be unique).
45 // Use here a free id (See in Home -> System information -> Dolibarr for list of used modules id).
46 $this->numero = 50300;
47 // Key text used to identify module (for permissions, menus, etc...)
48 $this->rights_class = 'stripe';
49
50 // Family can be 'crm','financial','hr','projects','products','ecm','technic','other'
51 // It is used to group modules in module setup page
52 $this->family = "interface";
53 // Module label (no space allowed), used if translation string 'ModuleXXXName' not found (where XXX is value of numeric property 'numero' of module)
54 $this->name = preg_replace('/^mod/i', '', get_class($this));
55 // Module description, used if translation string 'ModuleXXXDesc' not found (where XXX is value of numeric property 'numero' of module)
56 $this->description = "Module to offer an online payment page by credit card with Stripe";
57 // Possible values for version are: 'development', 'experimental', 'dolibarr' or version
58 $this->version = 'dolibarr';
59 // Key used in llx_const table to save module status enabled/disabled (where MYMODULE is value of property name of module in uppercase)
60 $this->const_name = 'MAIN_MODULE_'.strtoupper($this->name);
61 // Name of image file used for this module.
62 // If file is in theme/yourtheme/img directory under name object_pictovalue.png, use this->picto='pictovalue'
63 // If file is in module/img directory, use this->picto=DOL_URL_ROOT.'/module/img/file.png'
64 $this->picto = 'stripe';
65
66 // Data directories to create when module is enabled.
67 $this->dirs = array();
68
69 // Config pages. Put here list of php page names stored in admin directory used to setup module.
70 $this->config_page_url = array("stripe.php@stripe");
71
72 // Dependencies
73 $this->hidden = false; // A condition to hide module
74 $this->depends = array(); // List of modules id that must be enabled if this module is enabled
75 $this->requiredby = array(); // List of modules id to disable if this one is disabled
76 $this->phpmin = array(7, 0); // Minimum version of PHP required by module
77 $this->need_dolibarr_version = array(5, 0); // Minimum version of Dolibarr required by module
78 $this->langfiles = array("stripe");
79
80 // Constants
81 $this->const = array(); // List of particular constants to add when module is enabled
82
83 // New pages on tabs
84 $this->tabs = array();
85
86 // List of boxes
87 $this->boxes = array();
88 $r = 0;
89
90 // Permissions
91 $this->rights = array(); // Permission array used by this module
92 $r = 0;
93
94 // Main menu entries
95 $r = 0;
96 /* $this->menu[$r]=array(
97 'fk_menu'=>'fk_mainmenu=billing,fk_leftmenu=customers_bills_payment', // Use 'fk_mainmenu=xxx' or 'fk_mainmenu=xxx,fk_leftmenu=yyy' where xxx is mainmenucode and yyy is a leftmenucode
98 'mainmenu'=>'billing',
99 'leftmenu'=>'customers_bills_payment_stripe',
100 'type'=>'left', // This is a Left menu entry
101 'titre'=>'StripeImportPayment',
102 'url'=>'/stripe/importpayments.php',
103 'langs'=>'stripe', // Lang file to use (without .lang) by module. File must be in langs/code_CODE/ directory.
104 'position'=>500,
105 'enabled'=>'$conf->stripe->enabled && isModEnabled("banque") && $conf->global->MAIN_FEATURES_LEVEL >= 2', // Define condition to show or hide menu entry. Use '$conf->mymodule->enabled' if entry must be visible if module is enabled. Use '$leftmenu==\'system\'' to show if leftmenu system is selected.
106 'perms'=>'$user->rights->banque->modifier', // Use 'perms'=>'$user->hasRight("mymodule","level1","level2")' if you want your menu with a permission rules
107 'target'=>'',
108 'user'=>2
109 ); // 0=Menu for internal users, 1=external users, 2=both
110 $r++;*/
111
112 $this->menu[$r] = array(
113 'fk_menu' => 'fk_mainmenu=bank',
114 'type' => 'left',
115 'titre' => 'StripeAccount',
116 'prefix' => img_picto('', $this->picto, 'class="paddingright pictofixedwidth"'),
117 'mainmenu' => 'bank',
118 'leftmenu' => 'stripe',
119 'url' => '',
120 'langs' => 'stripe',
121 'position' => 100,
122 'enabled' => 'isModEnabled("stripe") && isModenabled("banque")',
123 'perms' => '$user->rights->banque->lire',
124 'target' => '',
125 'user' => 0
126 );
127
128 $r++;
129 $this->menu[$r] = array(
130 'fk_menu' => 'fk_mainmenu=bank,fk_leftmenu=stripe',
131 'type' => 'left',
132 'titre' => 'StripeChargeList',
133 'url' => '/stripe/charge.php',
134 'langs' => 'stripe',
135 'position' => 102,
136 'enabled' => 'isModEnabled("stripe") && isModenabled("banque") && getDolGlobalInt("MAIN_FEATURES_LEVEL") >= 1',
137 'perms' => '$user->rights->banque->lire',
138 'target' => '',
139 'user' => 0
140 );
141
142 $r++;
143 $this->menu[$r] = array(
144 'fk_menu' => 'fk_mainmenu=bank,fk_leftmenu=stripe',
145 'type' => 'left',
146 'titre' => 'StripeTransactionList',
147 'url' => '/stripe/transaction.php',
148 'langs' => 'stripe',
149 'position' => 102,
150 'enabled' => 'isModEnabled("stripe") && isModenabled("banque") && getDolGlobalInt("MAIN_FEATURES_LEVEL") >= 2',
151 'perms' => '$user->rights->banque->lire',
152 'target' => '',
153 'user' => 0
154 );
155
156 $r++;
157 $this->menu[$r] = array(
158 'fk_menu' => 'fk_mainmenu=bank,fk_leftmenu=stripe',
159 'type' => 'left',
160 'titre' => 'StripePayoutList',
161 'url' => '/stripe/payout.php',
162 'langs' => 'stripe',
163 'position' => 103,
164 'enabled' => 'isModEnabled("stripe") && isModenabled("banque")',
165 'perms' => '$user->rights->banque->lire',
166 'target' => '',
167 'user' => 0
168 );
169
170 // Exports
171 $r = 1;
172 }
173}
Class DolibarrModules.
Description and activation class for module Paybox.
__construct($db)
Constructor.
print $script_file $mode $langs defaultlang(is_numeric($duration_value) ? " delay=". $duration_value :"").(is_numeric($duration_value2) ? " after cd cd cd description as description
Only used if Module[ID]Desc translation string is not found.
img_picto($titlealt, $picto, $moreatt='', $pictoisfullpath=0, $srconly=0, $notitle=0, $alt='', $morecss='', $marginleftonlyshort=2)
Show picto whatever it's its name (generic function)
$conf db name
Only used if Module[ID]Name translation string is not found.
Definition repair.php:140