dolibarr 18.0.6
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 *
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 <https://www.gnu.org/licenses/>.
17 */
18
26include_once DOL_DOCUMENT_ROOT.'/core/modules/DolibarrModules.class.php';
27
28
33{
39 public function __construct($db)
40 {
41 $this->db = $db;
42
43 // Id for module (must be unique).
44 // Use here a free id (See in Home -> System information -> Dolibarr for list of used modules id).
45 $this->numero = 50300;
46 // Key text used to identify module (for permissions, menus, etc...)
47 $this->rights_class = 'stripe';
48
49 // Family can be 'crm','financial','hr','projects','products','ecm','technic','other'
50 // It is used to group modules in module setup page
51 $this->family = "interface";
52 // Module label (no space allowed), used if translation string 'ModuleXXXName' not found (where XXX is value of numeric property 'numero' of module)
53 $this->name = preg_replace('/^mod/i', '', get_class($this));
54 // Module description, used if translation string 'ModuleXXXDesc' not found (where XXX is value of numeric property 'numero' of module)
55 $this->description = "Module to offer an online payment page by credit card with Stripe";
56 // Possible values for version are: 'development', 'experimental', 'dolibarr' or version
57 $this->version = 'dolibarr';
58 // Key used in llx_const table to save module status enabled/disabled (where MYMODULE is value of property name of module in uppercase)
59 $this->const_name = 'MAIN_MODULE_'.strtoupper($this->name);
60 // Name of image file used for this module.
61 // If file is in theme/yourtheme/img directory under name object_pictovalue.png, use this->picto='pictovalue'
62 // If file is in module/img directory, use this->picto=DOL_URL_ROOT.'/module/img/file.png'
63 $this->picto = 'stripe';
64
65 // Data directories to create when module is enabled.
66 $this->dirs = array();
67
68 // Config pages. Put here list of php page names stored in admin directory used to setup module.
69 $this->config_page_url = array("stripe.php@stripe");
70
71 // Dependencies
72 $this->hidden = false; // A condition to hide module
73 $this->depends = array(); // List of modules id that must be enabled if this module is enabled
74 $this->requiredby = array(); // List of modules id to disable if this one is disabled
75 $this->phpmin = array(7, 0); // Minimum version of PHP required by module
76 $this->need_dolibarr_version = array(5, 0); // Minimum version of Dolibarr required by module
77 $this->langfiles = array("stripe");
78
79 // Constants
80 $this->const = array(); // List of particular constants to add when module is enabled
81
82 // New pages on tabs
83 $this->tabs = array();
84
85 // List of boxes
86 $this->boxes = array();
87 $r = 0;
88
89 // Permissions
90 $this->rights = array(); // Permission array used by this module
91 $r = 0;
92
93 // Main menu entries
94 $r = 0;
95 /* $this->menu[$r]=array(
96 '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
97 'mainmenu'=>'billing',
98 'leftmenu'=>'customers_bills_payment_stripe',
99 'type'=>'left', // This is a Left menu entry
100 'titre'=>'StripeImportPayment',
101 'url'=>'/stripe/importpayments.php',
102 'langs'=>'stripe', // Lang file to use (without .lang) by module. File must be in langs/code_CODE/ directory.
103 'position'=>500,
104 '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.
105 'perms'=>'$user->rights->banque->modifier', // Use 'perms'=>'$user->rights->mymodule->level1->level2' if you want your menu with a permission rules
106 'target'=>'',
107 'user'=>2
108 ); // 0=Menu for internal users, 1=external users, 2=both
109 $r++;*/
110
111 $this->menu[$r] = array(
112 'fk_menu'=>'fk_mainmenu=bank',
113 'type'=>'left',
114 'titre'=>'StripeAccount',
115 'prefix' => img_picto('', $this->picto, 'class="paddingright pictofixedwidth"'),
116 'mainmenu'=>'bank',
117 'leftmenu'=>'stripe',
118 'url' => '',
119 'langs' => 'stripe',
120 'position' => 100,
121 'enabled' => 'isModEnabled("stripe") && isModenabled("banque")',
122 'perms' => '$user->rights->banque->lire',
123 'target' => '',
124 'user' => 0
125 );
126
127 $r++;
128 $this->menu[$r] = array(
129 'fk_menu' => 'fk_mainmenu=bank,fk_leftmenu=stripe',
130 'type' => 'left',
131 'titre' => 'StripeChargeList',
132 'url' => '/stripe/charge.php',
133 'langs' => 'stripe',
134 'position' => 102,
135 'enabled' => 'isModEnabled("stripe") && isModenabled("banque") && getDolGlobalInt("MAIN_FEATURES_LEVEL") >= 1',
136 'perms' => '$user->rights->banque->lire',
137 'target' => '',
138 'user' => 0
139 );
140
141 $r++;
142 $this->menu[$r] = array(
143 'fk_menu' => 'fk_mainmenu=bank,fk_leftmenu=stripe',
144 'type' => 'left',
145 'titre' => 'StripeTransactionList',
146 'url' => '/stripe/transaction.php',
147 'langs' => 'stripe',
148 'position' => 102,
149 'enabled' => 'isModEnabled("stripe") && isModenabled("banque") && getDolGlobalInt("MAIN_FEATURES_LEVEL") >= 2',
150 'perms' => '$user->rights->banque->lire',
151 'target' => '',
152 'user' => 0
153 );
154
155 $r++;
156 $this->menu[$r] = array(
157 'fk_menu' => 'fk_mainmenu=bank,fk_leftmenu=stripe',
158 'type' => 'left',
159 'titre' => 'StripePayoutList',
160 'url' => '/stripe/payout.php',
161 'langs' => 'stripe',
162 'position' => 103,
163 'enabled' => 'isModEnabled("stripe") && isModenabled("banque")',
164 'perms' => '$user->rights->banque->lire',
165 'target' => '',
166 'user' => 0
167 );
168
169 // Exports
170 $r = 1;
171 }
172}
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=false, $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:123