dolibarr 25.0.0-alpha
setup.php
Go to the documentation of this file.
1<?php
2/* Copyright (C) 2004-2017 Laurent Destailleur <eldy@users.sourceforge.net>
3 * Copyright (C) 2021 Dorian Laurent <i.merraha@sofimedmaroc.com>
4 * Copyright (C) 2024-2026 Frédéric France <frederic.france@free.fr>
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
26// Load Dolibarr environment
27require '../../main.inc.php';
35require_once DOL_DOCUMENT_ROOT."/core/lib/admin.lib.php";
36require_once '../lib/partnership.lib.php';
37//require_once "../class/myclass.class.php";
38
39// Translations
40$langs->loadLangs(array("admin", "partnership"));
41
42$action = GETPOST('action', 'aZ09');
43$value = GETPOST('value', 'alpha');
44
45$error = 0;
46
47// Security check
48if (!$user->admin) {
50}
51
52
53/*
54 * Actions
55 */
56
57$nomessageinsetmoduleoptions = 1;
58include DOL_DOCUMENT_ROOT.'/core/actions_setmoduleoptions.inc.php';
59
60
61if ($action == 'setting') {
62 require_once DOL_DOCUMENT_ROOT."/core/modules/modPartnership.class.php";
63
64 $modulemenu = (GETPOST('PARTNERSHIP_IS_MANAGED_FOR', 'alpha') == 'member') ? 'member' : 'thirdparty';
65 $res = dolibarr_set_const($db, "PARTNERSHIP_IS_MANAGED_FOR", $modulemenu, 'chaine', 0, '', $conf->entity);
66
67 $partnership = new modPartnership($db);
68
69 $error += $partnership->delete_tabs();
70 $error += $partnership->insert_tabs();
71
72 $error += $partnership->delete_menus();
73 $error += $partnership->insert_menus();
74
75 if (GETPOSTISSET("PARTNERSHIP_NBDAYS_AFTER_MEMBER_EXPIRATION_BEFORE_CANCEL")) {
76 dolibarr_set_const($db, "PARTNERSHIP_NBDAYS_AFTER_MEMBER_EXPIRATION_BEFORE_CANCEL", GETPOSTINT("PARTNERSHIP_NBDAYS_AFTER_MEMBER_EXPIRATION_BEFORE_CANCEL"), 'chaine', 0, '', $conf->entity);
77 }
78
79 dolibarr_set_const($db, "PARTNERSHIP_BACKLINKS_TO_CHECK", GETPOST("PARTNERSHIP_BACKLINKS_TO_CHECK"), 'chaine', 0, '', $conf->entity);
80}
81
82if ($action) {
83 if (!$error) {
84 setEventMessages($langs->trans("SetupSaved"), null, 'mesgs');
85 } else {
86 setEventMessages($langs->trans("SetupNotError"), null, 'errors');
87 }
88 header("Location: ".$_SERVER['PHP_SELF']);
89 exit;
90}
91
92
93/*
94 * View
95 */
96
97$help_url = '';
98$title = $langs->trans('PartnershipSetup');
99
100llxHeader('', $title, $help_url, '', 0, 0, '', '', '', 'mod-partnership page-admin-setup');
101
102$linkback = '<a href="'.dolBuildUrl(DOL_URL_ROOT.'/admin/modules.php', ['restore_lastsearch_values' => 1]).'">'.img_picto($langs->trans("BackToModuleList"), 'back', 'class="pictofixedwidth"').'<span class="hideonsmartphone">'.$langs->trans("BackToModuleList").'</span></a>';
103print load_fiche_titre($title, $linkback, 'title_setup');
104
106print dol_get_fiche_head($head, 'settings', $title, -1, 'partnership');
107
108$form = new Form($db);
109
110// Module to manage partnership / services code
111$dirpartnership = array('/core/modules/partnership/');
112$dirmodels = array_merge(array('/'), (array) $conf->modules_parts['models']);
113
114print '<br>';
115
116/*
117 * Other conf
118 */
119
120print '<form method="POST" action="'.$_SERVER['PHP_SELF'].'">';
121print '<input type="hidden" name="token" value="'.newToken().'">';
122print '<input type="hidden" name="action" value="setting">';
123print '<input type="hidden" name="page_y" value="">';
124
125print '<div class="div-table-responsive-no-min">'; // You can use div-table-responsive-no-min if you don't need reserved height for your table
126print '<table class="noborder centpercent">';
127
128print '<tr class="liste_titre">';
129print '<td>'.$langs->trans("Setting").'</td>';
130print '<td>'.$langs->trans("Value").'</td>';
131print '<td>'.$langs->trans("Examples").'</td>';
132print '</tr>';
133
134print '<tr class="oddeven"><td>'.$langs->trans("PARTNERSHIP_IS_MANAGED_FOR").'</td>';
135print '<td>';
136print '<select class="flat minwidth100" id="select_PARTNERSHIP_IS_MANAGED_FOR" name="PARTNERSHIP_IS_MANAGED_FOR">';
137print '<option value="thirdparty" '.((getDolGlobalString('PARTNERSHIP_IS_MANAGED_FOR', 'thirdparty') == 'thirdparty') ? 'selected' : '').'>'.$langs->trans("ThirdParty").'</option>';
138print '<option value="member" '.((getDolGlobalString('PARTNERSHIP_IS_MANAGED_FOR', 'thirdparty') == 'member') ? 'selected' : '').'>'.$langs->trans("Members").'</option>';
139print '</select>';
140print ajax_combobox('select_PARTNERSHIP_IS_MANAGED_FOR');
141print '</td>';
142print '<td><span class="opacitymedium">'.$langs->trans("partnershipforthirdpartyormember").'</span></td>';
143print '</tr>';
144
145
146//if (getDolGlobalString('PARTNERSHIP_IS_MANAGED_FOR') == 'member') {
147print '<tr class="oddeven"><td>'.$langs->trans("PARTNERSHIP_NBDAYS_AFTER_MEMBER_EXPIRATION_BEFORE_CANCEL").'</td>';
148print '<td>';
149$dnbdays = '30';
150$backlinks = getDolGlobalString('PARTNERSHIP_NBDAYS_AFTER_MEMBER_EXPIRATION_BEFORE_CANCEL', $dnbdays);
151print '<input class="maxwidth50" type="text" name="PARTNERSHIP_NBDAYS_AFTER_MEMBER_EXPIRATION_BEFORE_CANCEL" value="'.$backlinks.'">';
152print '</td>';
153print '<td><span class="opacitymedium">'.$dnbdays.'</span></td>';
154print '</tr>';
155//}
156
157print '</table>';
158print '</div>';
159
160print '<br>';
161
162
163print load_fiche_titre($langs->trans("ReferingWebsiteCheck"), '', '');
164
165print '<span class="opacitymedium">'.$langs->trans("ReferingWebsiteCheckDesc").'</span><br>';
166print '<br>';
167
168print '<div class="div-table-responsive-no-min">'; // You can use div-table-responsive-no-min if you don't need reserved height for your table
169print '<table class="noborder centpercent">';
170
171print '<tr class="liste_titre">';
172print '<td>'.$langs->trans("Setting").'</td>';
173print '<td>'.$langs->trans("Value").'</td>';
174print '<td>'.$langs->trans("Examples").'</td>';
175print '</tr>';
176
177print '<tr class="oddeven"><td>'.$langs->trans("PARTNERSHIP_BACKLINKS_TO_CHECK").'</td>';
178print '<td>';
179$backlinks = getDolGlobalString('PARTNERSHIP_BACKLINKS_TO_CHECK');
180print '<input class="minwidth400" type="text" name="PARTNERSHIP_BACKLINKS_TO_CHECK" value="'.$backlinks.'">';
181print '</td>';
182print '<td><span class="opacitymedium">dolibarr.org|dolibarr.fr|dolibarr.es</span></td>';
183print '</tr>';
184
185print '</table>';
186print '</div>';
187
188
189print '<div class="center">';
190print '<input type="submit" class="button reposition" value="'.$langs->trans("Modify").'">';
191print '</div>';
192
193print '</form>';
194
195// End of page
196llxFooter();
197$db->close();
dolibarr_set_const($db, $name, $value, $type='chaine', $visible=0, $note='', $entity=1)
Insert a parameter (key,value) into database (delete old key then insert it again).
ajax_combobox($htmlname, $events=array(), $minLengthToAutocomplete=0, $forcefocus=0, $widthTypeOfAutocomplete='resolve', $idforemptyvalue='-1', $morecss='', $placeholder='')
Convert a html select field into an ajax combobox.
Definition ajax.lib.php:488
llxFooter($comment='', $zone='private', $disabledoutputofmessages=0)
Empty footer.
Definition wrapper.php:91
if(!defined('NOREQUIRESOC')) if(!defined( 'NOREQUIRETRAN')) if(!defined('NOTOKENRENEWAL')) if(!defined( 'NOREQUIREMENU')) if(!defined('NOREQUIREHTML')) if(!defined( 'NOREQUIREAJAX')) llxHeader($head='', $title='', $help_url='', $target='', $disablejs=0, $disablehead=0, $arrayofjs='', $arrayofcss='', $morequerystring='', $morecssonbody='', $replacemainareaby='', $disablenofollow=0, $disablenoindex=0)
Empty header.
Definition wrapper.php:73
if(!isModEnabled('ai')||!getDolGlobalString('AI_ASSISTANT_ENABLED')) global $conf
The main.inc.php has been included so the following variable are now defined:
Class to manage generation of HTML components Only common components must be here.
Description and activation class for module Partnership This module is base on this specification : h...
GETPOST($paramname, $check='alphanohtml', $method=0, $filter=null, $options=null, $noreplace=0, $nodefault=0)
Return value of a param into GET or POST supervariable.
GETPOSTINT($paramname, $method=0, $nodefault=0)
Return the value of a $_GET or $_POST supervariable, converted into integer.
GETPOSTISSET($paramname)
Return true if we are in a context of submitting the parameter $paramname from a POST of a form.
getDolGlobalString($key, $default='')
Return a Dolibarr global constant string value.
dol_get_fiche_head($links=array(), $active='', $title='', $notab=0, $picto='', $pictoisfullpath=0, $morehtmlright='', $morecss='', $limittoshow=0, $moretabssuffix='', $dragdropfile=0, $morecssdiv='')
Show tabs of a record.
Definition html.lib.php:542
load_fiche_titre($title, $morehtmlright='', $picto='generic', $pictoisfullpath=0, $id='', $morecssontable='', $morehtmlcenter='', $morecssonpicto='widthpictotitle')
Load a title with picto.
partnershipAdminPrepareHead()
Prepare admin pages header.
accessforbidden($message='', $printheader=1, $printfooter=1, $showonlymessage=0, $params=null)
Show a message to say access is forbidden and stop program.