NEW: Add constant MAIN_BUGTRACK_URL to add possibility to redirect to other service

This commit is contained in:
Alexandre SPANGARO 2021-04-14 23:16:30 +02:00
parent 89281d4875
commit 140f098c79
4 changed files with 16 additions and 11 deletions

View File

@ -211,11 +211,12 @@ if ($action == 'update') {
dolibarr_set_const($db, "MAIN_DEFAULT_WORKING_DAYS", GETPOST("MAIN_DEFAULT_WORKING_DAYS", 'alphanohtml'), 'chaine', 0, '', $conf->entity);
dolibarr_set_const($db, "MAIN_DEFAULT_WORKING_HOURS", GETPOST("MAIN_DEFAULT_WORKING_HOURS", 'alphanohtml'), 'chaine', 0, '', $conf->entity);
dolibarr_set_const($db, "MAIN_BUGTRACK_ENABLELINK", GETPOST("MAIN_BUGTRACK_ENABLELINK", 'alpha'), 'chaine', 0, '', $conf->entity);
dolibarr_set_const($db, "MAIN_FIRSTNAME_NAME_POSITION", GETPOST("MAIN_FIRSTNAME_NAME_POSITION", 'aZ09'), 'chaine', 0, '', $conf->entity);
dolibarr_set_const($db, "MAIN_MOTD", dol_htmlcleanlastbr(GETPOST("main_motd", 'restricthtml')), 'chaine', 0, '', $conf->entity);
dolibarr_set_const($db, "MAIN_HOME", dol_htmlcleanlastbr(GETPOST("main_home", 'restricthtml')), 'chaine', 0, '', $conf->entity);
//dolibarr_set_const($db, "MAIN_BUGTRACK_ENABLELINK", GETPOST('MAIN_BUGTRACK_ENABLELINK', 'aZ09'), 'chaine', 0, '', $conf->entity);
//dolibarr_set_const($db, "MAIN_HELP_DISABLELINK", GETPOST("MAIN_HELP_DISABLELINK", 'aZ09'), 'chaine', 0, '', 0); // Param for all entities
$varforimage = 'imagebackground'; $dirforimage = $conf->mycompany->dir_output.'/logos/';
@ -401,8 +402,7 @@ print '</tr>';
// Show bugtrack link
print '<tr class="oddeven"><td>'.$langs->trans("ShowBugTrackLink", $langs->transnoentitiesnoconv("FindBug")).'</td><td>';
print ajax_constantonoff("MAIN_BUGTRACK_ENABLELINK", array(), $conf->entity, 0, 0, 1, 0);
//print $form->selectyesno('MAIN_BUGTRACK_ENABLELINK', $conf->global->MAIN_BUGTRACK_ENABLELINK, 1);
print '<input type="text" name="MAIN_BUGTRACK_ENABLELINK" size="32" value="'.(isset($conf->global->MAIN_BUGTRACK_ENABLELINK) ? $conf->global->MAIN_BUGTRACK_ENABLELINK : '').'">';
print '</td>';
print '<td width="20">&nbsp;</td>';
print '</tr>';

View File

@ -423,4 +423,6 @@ ALTER TABLE llx_facture_fourn ADD COLUMN date_closing datetime DEFAULT NULL afte
ALTER TABLE llx_facture_fourn ADD COLUMN fk_user_closing integer DEFAULT NULL after fk_user_valid;
ALTER TABLE llx_entrepot ADD COLUMN fk_project INTEGER DEFAULT NULL AFTER entity; -- project associated to warehouse if any
ALTER TABLE llx_entrepot ADD COLUMN fk_project INTEGER DEFAULT NULL AFTER entity; -- project associated to warehouse if any
UPDATE llx_const SET value = 'github' WHERE __DECRYPT('name')__ = 'MAIN_BUGTRACK_ENABLELINK' AND __DECRYPT('value')__ = 1;

View File

@ -1159,7 +1159,7 @@ DoNotSuggestPaymentMode=Do not suggest
NoActiveBankAccountDefined=No active bank account defined
OwnerOfBankAccount=Owner of bank account %s
BankModuleNotActive=Bank accounts module not enabled
ShowBugTrackLink=Show link "<strong>%s</strong>"
ShowBugTrackLink=Define link "<strong>%s</strong> (empty to not display the link / 'github' for the link to the Dolibarr project)
Alerts=Alerts
DelaysOfToleranceBeforeWarning=Delay before displaying a warning alert for:
DelaysOfToleranceDesc=Set the delay before an alert icon %s is shown onscreen for the late element.

View File

@ -2743,9 +2743,7 @@ function left_menu($menu_array_before, $helppagename = '', $notused = '', $menu_
if (!empty($conf->global->MAIN_BUGTRACK_ENABLELINK)) {
require_once DOL_DOCUMENT_ROOT.'/core/lib/functions2.lib.php';
if (!empty($conf->global->MAIN_BUGTRACK_URL)) {
$bugbaseurl = $conf->global->MAIN_BUGTRACK_URL;
} else {
if ($conf->global->MAIN_BUGTRACK_ENABLELINK == 'github') {
$bugbaseurl = 'https://github.com/Dolibarr/dolibarr/issues/new?labels=Bug';
$bugbaseurl .= '&title=';
$bugbaseurl .= urlencode("Bug: ");
@ -2777,10 +2775,17 @@ function left_menu($menu_array_before, $helppagename = '', $notused = '', $menu_
$bugbaseurl .= urlencode("## [Attached files](https://help.github.com/articles/issue-attachments) (Screenshots, screencasts, dolibarr.log, debugging informations…)\n");
$bugbaseurl .= urlencode("[*Files*]\n");
$bugbaseurl .= urlencode("\n");
$bugbaseurl .= urlencode("\n");
$bugbaseurl .= urlencode("## Report\n");
} elseif (!empty($conf->global->MAIN_BUGTRACK_ENABLELINK)) {
$bugbaseurl = $conf->global->MAIN_BUGTRACK_ENABLELINK;
} else {
$bugbaseurl = "";
}
// Execute hook printBugtrackInfo
$parameters = array('bugbaseurl'=>$bugbaseurl);
$parameters = array('bugbaseurl' => $bugbaseurl);
$reshook = $hookmanager->executeHooks('printBugtrackInfo', $parameters); // Note that $action and $object may have been modified by some hooks
if (empty($reshook)) {
$bugbaseurl .= $hookmanager->resPrint;
@ -2788,8 +2793,6 @@ function left_menu($menu_array_before, $helppagename = '', $notused = '', $menu_
$bugbaseurl = $hookmanager->resPrint;
}
$bugbaseurl .= urlencode("\n");
$bugbaseurl .= urlencode("## Report\n");
print '<div id="blockvmenuhelpbugreport" class="blockvmenuhelp">';
print '<a class="help" target="_blank" rel="noopener" href="'.$bugbaseurl.'">'.$langs->trans("FindBug").'</a>';
print '</div>';