26 require
'../main.inc.php';
27 require_once DOL_DOCUMENT_ROOT.
"/core/lib/admin.lib.php";
28 require_once DOL_DOCUMENT_ROOT.
'/webhook/lib/webhook.lib.php';
31 $langs->loadLangs(array(
"admin",
"webhook"));
34 $hookmanager->initHooks(array(
'webhooksetup',
'globalsetup'));
42 $action =
GETPOST(
'action',
'aZ09');
43 $backtopage =
GETPOST(
'backtopage',
'alpha');
44 $modulepart =
GETPOST(
'modulepart',
'aZ09');
46 $value =
GETPOST(
'value',
'alpha');
47 $label =
GETPOST(
'label',
'alpha');
48 $scandir =
GETPOST(
'scan_dir',
'alpha');
58 if (!class_exists(
'FormSetup')) {
59 require_once DOL_DOCUMENT_ROOT.
'/core/class/html.formsetup.class.php';
65 $setupnotempty = count($formSetup->items);
68 $dirmodels = array_merge(array(
'/'), (array) $conf->modules_parts[
'models']);
75 include DOL_DOCUMENT_ROOT.
'/core/actions_setmoduleoptions.inc.php';
77 if ($action ==
'updateMask') {
78 $maskconst =
GETPOST(
'maskconst',
'aZ09');
79 $maskvalue =
GETPOST(
'maskvalue',
'alpha');
81 if ($maskconst && preg_match(
'/_MASK$/', $maskconst)) {
82 $res =
dolibarr_set_const($db, $maskconst, $maskvalue,
'chaine', 0,
'', $conf->entity);
93 } elseif ($action ==
'setmod') {
95 $tmpobjectkey =
GETPOST(
'object',
'aZ09');
96 if (!empty($tmpobjectkey)) {
97 $constforval =
'WEBHOOK_'.strtoupper($tmpobjectkey).
"_ADDON";
100 } elseif ($action ==
'set') {
103 } elseif ($action ==
'del') {
106 $tmpobjectkey =
GETPOST(
'object',
'aZ09');
107 if (!empty($tmpobjectkey)) {
108 $constforval =
'WEBHOOK_'.strtoupper($tmpobjectkey).
'_ADDON_PDF';
114 } elseif ($action ==
'setdoc') {
116 $tmpobjectkey =
GETPOST(
'object',
'aZ09');
117 if (!empty($tmpobjectkey)) {
118 $constforval =
'WEBHOOK_'.strtoupper($tmpobjectkey).
'_ADDON_PDF';
122 $conf->global->$constforval = $value;
131 } elseif ($action ==
'unsetdoc') {
132 $tmpobjectkey =
GETPOST(
'object',
'aZ09');
133 if (!empty($tmpobjectkey)) {
134 $constforval =
'WEBHOOK_'.strtoupper($tmpobjectkey).
'_ADDON_PDF';
148 $page_name =
"WebhookSetup";
153 $linkback =
'<a href="'.($backtopage ? $backtopage : DOL_URL_ROOT.
'/admin/modules.php?restore_lastsearch_values=1').
'">'.$langs->trans(
"BackToModuleList").
'</a>';
155 print
load_fiche_titre($langs->trans($page_name), $linkback,
'title_setup');
159 print
dol_get_fiche_head($head,
'settings', $langs->trans($page_name), -1,
"webhook");
162 echo
'<span class="opacitymedium">'.$langs->trans(
"WebhookSetupPage", $langs->transnoentitiesnoconv(
"Targets")).
'</span><br><br>';
165 if ($action ==
'edit') {
166 if ($useFormSetup && (
float) DOL_VERSION >= 15) {
167 print $formSetup->generateOutput(
true);
169 print
'<form method="POST" action="'.$_SERVER[
"PHP_SELF"].
'">';
170 print
'<input type="hidden" name="token" value="'.newToken().
'">';
171 print
'<input type="hidden" name="action" value="update">';
173 print
'<table class="noborder centpercent">';
174 print
'<tr class="liste_titre"><td class="titlefield">'.$langs->trans(
"Parameter").
'</td><td>'.$langs->trans(
"Value").
'</td></tr>';
176 foreach ($arrayofparameters as $constname => $val) {
177 if ($val[
'enabled'] == 1) {
179 print
'<tr class="oddeven"><td>';
180 $tooltiphelp = (($langs->trans($constname .
'Tooltip') != $constname .
'Tooltip') ? $langs->trans($constname .
'Tooltip') :
'');
181 print
'<span id="helplink'.$constname.
'" class="spanforparamtooltip">'.
$form->textwithpicto($langs->trans($constname), $tooltiphelp, 1,
'info',
'', 0, 3,
'tootips'.$constname).
'</span>';
184 if ($val[
'type'] ==
'textarea') {
185 print
'<textarea class="flat" name="'.$constname.
'" id="'.$constname.
'" cols="50" rows="5" wrap="soft">' .
"\n";
187 print
"</textarea>\n";
188 } elseif ($val[
'type'] ==
'html') {
189 require_once DOL_DOCUMENT_ROOT .
'/core/class/doleditor.class.php';
190 $doleditor =
new DolEditor($constname,
getDolGlobalString($constname),
'', 160,
'dolibarr_notes',
'',
false,
false,
isModEnabled(
'fckeditor'), ROWS_5,
'90%');
191 $doleditor->Create();
192 } elseif ($val[
'type'] ==
'yesno') {
194 } elseif (preg_match(
'/emailtemplate:/', $val[
'type'])) {
195 include_once DOL_DOCUMENT_ROOT .
'/core/class/html.formmail.class.php';
198 $tmp = explode(
':', $val[
'type']);
199 $nboftemplates = $formmail->fetchAllEMailTemplate($tmp[1], $user,
null, 1);
201 $arrayofmessagename = array();
202 if (is_array($formmail->lines_model)) {
203 foreach ($formmail->lines_model as $modelmail) {
206 if (!empty($arrayofmessagename[$modelmail->label])) {
207 $moreonlabel =
' <span class="opacitymedium">(' . $langs->trans(
"SeveralLangugeVariatFound") .
')</span>';
210 $arrayofmessagename[$modelmail->id] = $langs->trans(preg_replace(
'/\(|\)/',
'', $modelmail->label)) . $moreonlabel;
213 print
$form->selectarray($constname, $arrayofmessagename,
getDolGlobalString($constname),
'None', 0, 0,
'', 0, 0, 0,
'',
'', 1);
214 } elseif (preg_match(
'/category:/', $val[
'type'])) {
215 require_once DOL_DOCUMENT_ROOT.
'/categories/class/categorie.class.php';
216 require_once DOL_DOCUMENT_ROOT.
'/core/class/html.formother.class.php';
219 $tmp = explode(
':', $val[
'type']);
220 print
img_picto(
'',
'category',
'class="pictofixedwidth"');
221 print $formother->select_categories($tmp[1],
getDolGlobalString($constname), $constname, 0, $langs->trans(
'CustomersProspectsCategoriesShort'));
222 } elseif (preg_match(
'/thirdparty_type/', $val[
'type'])) {
223 require_once DOL_DOCUMENT_ROOT.
'/core/class/html.formcompany.class.php';
225 print $formcompany->selectProspectCustomerType(
getDolGlobalString($constname), $constname);
226 } elseif ($val[
'type'] ==
'securekey') {
227 print
'<input required="required" type="text" class="flat" id="'.$constname.
'" name="'.$constname.
'" value="'.(
GETPOST($constname,
'alpha') ?
GETPOST($constname,
'alpha') :
getDolGlobalString($constname)).
'" size="40">';
228 if (!empty($conf->use_javascript_ajax)) {
229 print
' '.img_picto($langs->trans(
'Generate'),
'refresh',
'id="generate_token'.$constname.
'" class="linkobject"');
233 include_once DOL_DOCUMENT_ROOT.
'/core/lib/security2.lib.php';
235 } elseif ($val[
'type'] ==
'product') {
238 $form->select_produits($selected, $constname,
'', 0);
241 print
'<input name="'.$constname.
'" class="flat '.(empty($val[
'css']) ?
'minwidth200' : $val[
'css']).
'" value="'.
getDolGlobalString($constname).
'">';
248 print
'<br><div class="center">';
249 print
'<input class="button button-save" type="submit" value="'.$langs->trans(
"Save").
'">';
257 if ($useFormSetup && (
float) DOL_VERSION >= 15) {
258 if (!empty($formSetup->items)) {
259 print $formSetup->generateOutput();
262 if (!empty($arrayofparameters)) {
263 print
'<table class="noborder centpercent">';
264 print
'<tr class="liste_titre"><td class="titlefield">'.$langs->trans(
"Parameter").
'</td><td>'.$langs->trans(
"Value").
'</td></tr>';
266 foreach ($arrayofparameters as $constname => $val) {
267 if ($val[
'enabled'] == 1) {
269 print
'<tr class="oddeven"><td>';
270 $tooltiphelp = (($langs->trans($constname .
'Tooltip') != $constname .
'Tooltip') ? $langs->trans($constname .
'Tooltip') :
'');
271 print
$form->textwithpicto($langs->trans($constname), $tooltiphelp);
274 if ($val[
'type'] ==
'textarea') {
276 } elseif ($val[
'type'] ==
'html') {
278 } elseif ($val[
'type'] ==
'yesno') {
280 } elseif (preg_match(
'/emailtemplate:/', $val[
'type'])) {
281 include_once DOL_DOCUMENT_ROOT .
'/core/class/html.formmail.class.php';
284 $tmp = explode(
':', $val[
'type']);
286 $template = $formmail->getEMailTemplate($db, $tmp[1], $user, $langs,
getDolGlobalString($constname));
290 print $langs->trans($template->label);
291 } elseif (preg_match(
'/category:/', $val[
'type'])) {
296 } elseif ($result > 0) {
297 $ways = $c->print_all_ways(
' >> ',
'none', 0, 1);
299 foreach ($ways as $way) {
300 $toprint[] =
'<li class="select2-search-choice-dolibarr noborderoncategories"' . ($c->color ?
' style="background: #' . $c->color .
';"' :
' style="background: #bbb"') .
'>' . $way .
'</li>';
302 print
'<div class="select2-container-multi-dolibarr" style="width: 90%;"><ul class="select2-choices-dolibarr">' . implode(
' ', $toprint) .
'</ul></div>';
304 } elseif (preg_match(
'/thirdparty_type/', $val[
'type'])) {
306 print $langs->trans(
"Prospect");
308 print $langs->trans(
"ProspectCustomer");
310 print $langs->trans(
"Customer");
312 print $langs->trans(
"NorProspectNorCustomer");
314 } elseif ($val[
'type'] ==
'product') {
319 } elseif ($resprod < 0) {
333 if ($setupnotempty) {
334 print
'<div class="tabsAction">';
335 print
'<a class="butAction" href="'.$_SERVER[
"PHP_SELF"].
'?action=edit&token='.
newToken().
'">'.$langs->trans(
"Modify").
'</a>';
if($user->socid > 0) if(! $user->hasRight('accounting', 'chartofaccount')) $object
if(GETPOST('button_removefilter_x', 'alpha')||GETPOST('button_removefilter.x', 'alpha')||GETPOST('button_removefilter', 'alpha')) if(GETPOST('button_search_x', 'alpha')||GETPOST('button_search.x', 'alpha')||GETPOST('button_search', 'alpha')) if($action=="save" &&empty($cancel)) $help_url
View.
addDocumentModel($name, $type, $label='', $description='')
Add document model used by doc generator.
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).
dolibarr_del_const($db, $name, $entity=1)
Delete a constant.
delDocumentModel($name, $type)
Delete document model used by doc generator.
ajax_constantonoff($code, $input=array(), $entity=null, $revertonoff=0, $strict=0, $forcereload=0, $marginleftonlyshort=2, $forcenoajax=0, $setzeroinsteadofdel=0, $suffix='', $mode='', $morecss='inline-block')
On/off button for constant.
if(!defined('NOREQUIRESOC')) if(!defined('NOREQUIRETRAN')) if(!defined('NOTOKENRENEWAL')) if(!defined('NOREQUIREMENU')) if(!defined('NOREQUIREHTML')) if(!defined('NOREQUIREAJAX')) llxHeader()
Empty header.
Class to manage categories.
Class to manage a WYSIWYG editor.
Class to manage products or services.
if($cancel &&! $id) if($action=='add' &&! $cancel) if($action=='delete') if($id) $form
Actions.
load_fiche_titre($titre, $morehtmlright='', $picto='generic', $pictoisfullpath=0, $id='', $morecssontable='', $morehtmlcenter='')
Load a title with picto.
img_picto($titlealt, $picto, $moreatt='', $pictoisfullpath=0, $srconly=0, $notitle=0, $alt='', $morecss='', $marginleftonlyshort=2)
Show picto whatever it's its name (generic function)
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.
dol_get_fiche_end($notab=0)
Return tab footer of a card.
dol_nl2br($stringtoencode, $nl2brmode=0, $forxml=false)
Replace CRLF in string with a HTML BR tag.
getDolGlobalInt($key, $default=0)
Return a Dolibarr global constant int value.
newToken()
Return the value of token currently saved into session with name 'newtoken'.
GETPOST($paramname, $check='alphanohtml', $method=0, $filter=null, $options=null, $noreplace=0)
Return value of a param into GET or POST supervariable.
setEventMessages($mesg, $mesgs, $style='mesgs', $messagekey='', $noduplicate=0)
Set event messages in dol_events session object.
getDolGlobalString($key, $default='')
Return dolibarr global constant string value.
isModEnabled($module)
Is Dolibarr module enabled.
dolJSToSetRandomPassword($htmlname, $htmlnameofbutton='generate_token', $generic=1)
Output javascript to autoset a generated password using default module into a HTML element.
accessforbidden($message='', $printheader=1, $printfooter=1, $showonlymessage=0, $params=null)
Show a message to say access is forbidden and stop program.
webhookAdminPrepareHead()
Prepare admin pages header.