dolibarr 21.0.0-beta
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 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';
28require_once DOL_DOCUMENT_ROOT."/core/lib/admin.lib.php";
29require_once '../lib/partnership.lib.php';
30//require_once "../class/myclass.class.php";
31
40// Translations
41$langs->loadLangs(array("admin", "partnership"));
42
43$action = GETPOST('action', 'aZ09');
44$value = GETPOST('value', 'alpha');
45
46$error = 0;
47
48// Security check
49if (!$user->admin) {
51}
52
53
54/*
55 * Actions
56 */
57
58$nomessageinsetmoduleoptions = 1;
59include DOL_DOCUMENT_ROOT.'/core/actions_setmoduleoptions.inc.php';
60
61
62if ($action == 'setting') {
63 require_once DOL_DOCUMENT_ROOT."/core/modules/modPartnership.class.php";
64
65 $modulemenu = (GETPOST('PARTNERSHIP_IS_MANAGED_FOR', 'alpha') == 'member') ? 'member' : 'thirdparty';
66 $res = dolibarr_set_const($db, "PARTNERSHIP_IS_MANAGED_FOR", $modulemenu, 'chaine', 0, '', $conf->entity);
67
68 $partnership = new modPartnership($db);
69
70 $error += $partnership->delete_tabs();
71 $error += $partnership->insert_tabs();
72
73 $error += $partnership->delete_menus();
74 $error += $partnership->insert_menus();
75
76 if (GETPOSTISSET("PARTNERSHIP_NBDAYS_AFTER_MEMBER_EXPIRATION_BEFORE_CANCEL")) {
77 dolibarr_set_const($db, "PARTNERSHIP_NBDAYS_AFTER_MEMBER_EXPIRATION_BEFORE_CANCEL", GETPOSTINT("PARTNERSHIP_NBDAYS_AFTER_MEMBER_EXPIRATION_BEFORE_CANCEL"), 'chaine', 0, '', $conf->entity);
78 }
79
80 dolibarr_set_const($db, "PARTNERSHIP_BACKLINKS_TO_CHECK", GETPOST("PARTNERSHIP_BACKLINKS_TO_CHECK"), 'chaine', 0, '', $conf->entity);
81}
82
83if ($action) {
84 if (!$error) {
85 setEventMessages($langs->trans("SetupSaved"), null, 'mesgs');
86 } else {
87 setEventMessages($langs->trans("SetupNotError"), null, 'errors');
88 }
89 header("Location: ".$_SERVER['PHP_SELF']);
90 exit;
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="'.DOL_URL_ROOT.'/admin/modules.php?restore_lastsearch_values=1">'.$langs->trans("BackToModuleList").'</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
114
115/*
116 * Other conf
117 */
118
119print '<form method="POST" action="'.$_SERVER['PHP_SELF'].'">';
120print '<input type="hidden" name="token" value="'.newToken().'">';
121print '<input type="hidden" name="action" value="setting">';
122print '<input type="hidden" name="page_y" value="">';
123
124print '<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
125print '<table class="noborder centpercent">';
126
127print '<tr class="liste_titre">';
128print '<td>'.$langs->trans("Setting").'</td>';
129print '<td>'.$langs->trans("Value").'</td>';
130print '<td>'.$langs->trans("Examples").'</td>';
131print '</tr>';
132
133print '<tr class="oddeven"><td>'.$langs->trans("PARTNERSHIP_IS_MANAGED_FOR").'</td>';
134print '<td>';
135print '<select class="flat minwidth100" id="select_PARTNERSHIP_IS_MANAGED_FOR" name="PARTNERSHIP_IS_MANAGED_FOR">';
136print '<option value="thirdparty" '.((getDolGlobalString('PARTNERSHIP_IS_MANAGED_FOR', 'thirdparty') == 'thirdparty') ? 'selected' : '').'>'.$langs->trans("ThirdParty").'</option>';
137print '<option value="member" '.((getDolGlobalString('PARTNERSHIP_IS_MANAGED_FOR', 'thirdparty') == 'member') ? 'selected' : '').'>'.$langs->trans("Members").'</option>';
138print '</select>';
139print ajax_combobox('select_PARTNERSHIP_IS_MANAGED_FOR');
140print '</td>';
141print '<td><span class="opacitymedium">'.$langs->trans("partnershipforthirdpartyormember").'</span></td>';
142print '</tr>';
143
144
145//if (getDolGlobalString('PARTNERSHIP_IS_MANAGED_FOR') == 'member') {
146print '<tr class="oddeven"><td>'.$langs->trans("PARTNERSHIP_NBDAYS_AFTER_MEMBER_EXPIRATION_BEFORE_CANCEL").'</td>';
147print '<td>';
148$dnbdays = '30';
149$backlinks = (getDolGlobalString('PARTNERSHIP_NBDAYS_AFTER_MEMBER_EXPIRATION_BEFORE_CANCEL')) ? $conf->global->PARTNERSHIP_NBDAYS_AFTER_MEMBER_EXPIRATION_BEFORE_CANCEL : $dnbdays;
150print '<input class="maxwidth50" type="text" name="PARTNERSHIP_NBDAYS_AFTER_MEMBER_EXPIRATION_BEFORE_CANCEL" value="'.$backlinks.'">';
151print '</td>';
152print '<td><span class="opacitymedium">'.$dnbdays.'</span></td>';
153print '</tr>';
154//}
155
156print '</table>';
157print '</div>';
158
159print '<br>';
160
161
162print load_fiche_titre($langs->trans("ReferingWebsiteCheck"), '', '');
163
164print '<span class="opacitymedium">'.$langs->trans("ReferingWebsiteCheckDesc").'</span><br>';
165print '<br>';
166
167print '<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
168print '<table class="noborder centpercent">';
169
170print '<tr class="liste_titre">';
171print '<td>'.$langs->trans("Setting").'</td>';
172print '<td>'.$langs->trans("Value").'</td>';
173print '<td>'.$langs->trans("Examples").'</td>';
174print '</tr>';
175
176print '<tr class="oddeven"><td>'.$langs->trans("PARTNERSHIP_BACKLINKS_TO_CHECK").'</td>';
177print '<td>';
178$backlinks = getDolGlobalString('PARTNERSHIP_BACKLINKS_TO_CHECK');
179print '<input class="minwidth400" type="text" name="PARTNERSHIP_BACKLINKS_TO_CHECK" value="'.$backlinks.'">';
180print '</td>';
181print '<td><span class="opacitymedium">dolibarr.org|dolibarr.fr|dolibarr.es</span></td>';
182print '</tr>';
183
184print '</table>';
185print '</div>';
186
187
188print '<div class="center">';
189print '<input type="submit" class="button reposition" value="'.$langs->trans("Modify").'">';
190print '</div>';
191
192print '</form>';
193
194// End of page
195llxFooter();
196$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='')
Convert a html select field into an ajax combobox.
Definition ajax.lib.php:459
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:71
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...
llxFooter()
Footer empty.
Definition document.php:107
load_fiche_titre($title, $morehtmlright='', $picto='generic', $pictoisfullpath=0, $id='', $morecssontable='', $morehtmlcenter='')
Load a title with picto.
setEventMessages($mesg, $mesgs, $style='mesgs', $messagekey='', $noduplicate=0, $attop=0)
Set event messages in dol_events session object.
GETPOSTINT($paramname, $method=0)
Return the value of a $_GET or $_POST supervariable, converted into integer.
dol_get_fiche_head($links=array(), $active='', $title='', $notab=0, $picto='', $pictoisfullpath=0, $morehtmlright='', $morecss='', $limittoshow=0, $moretabssuffix='', $dragdropfile=0)
Show tabs of a record.
GETPOST($paramname, $check='alphanohtml', $method=0, $filter=null, $options=null, $noreplace=0)
Return value of a param into GET or POST supervariable.
getDolGlobalString($key, $default='')
Return a Dolibarr global constant string value.
global $conf
The following vars must be defined: $type2label $form $conf, $lang, The following vars may also be de...
Definition member.php:79
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.