From a48f9abb5d6cd9b1f5f3104e9e75af702d9952aa Mon Sep 17 00:00:00 2001 From: Hystepik Date: Fri, 6 Dec 2024 15:01:42 +0100 Subject: [PATCH] New Add setup to enable OVH_DEBUG --- htdocs/ovh/admin/ovh_other.php | 111 ++++++++++++++++++++++++++++++++ htdocs/ovh/langs/en_US/ovh.lang | 1 + htdocs/ovh/lib/ovh.lib.php | 5 ++ 3 files changed, 117 insertions(+) create mode 100644 htdocs/ovh/admin/ovh_other.php diff --git a/htdocs/ovh/admin/ovh_other.php b/htdocs/ovh/admin/ovh_other.php new file mode 100644 index 000000000..c36ca2e7a --- /dev/null +++ b/htdocs/ovh/admin/ovh_other.php @@ -0,0 +1,111 @@ + + */ + +/** + * \file htdocs/ovh/admin/ovh_other.php + * \ingroup ovh + * \brief Setup page for ovh module (Other) + */ + +// Load Dolibarr environment +$res=0; +// Try main.inc.php into web root known defined into CONTEXT_DOCUMENT_ROOT (not always defined) +if (! $res && ! empty($_SERVER["CONTEXT_DOCUMENT_ROOT"])) $res=@include $_SERVER["CONTEXT_DOCUMENT_ROOT"]."/main.inc.php"; +// Try main.inc.php into web root detected using web root caluclated from SCRIPT_FILENAME +$tmp=empty($_SERVER['SCRIPT_FILENAME'])?'':$_SERVER['SCRIPT_FILENAME'];$tmp2=realpath(__FILE__); $i=strlen($tmp)-1; $j=strlen($tmp2)-1; +while ($i > 0 && $j > 0 && isset($tmp[$i]) && isset($tmp2[$j]) && $tmp[$i]==$tmp2[$j]) { $i--; $j--; } +if (! $res && $i > 0 && file_exists(substr($tmp, 0, ($i+1))."/main.inc.php")) $res=@include substr($tmp, 0, ($i+1))."/main.inc.php"; +if (! $res && $i > 0 && file_exists(dirname(substr($tmp, 0, ($i+1)))."/main.inc.php")) $res=@include dirname(substr($tmp, 0, ($i+1)))."/main.inc.php"; +// Try main.inc.php using relative path +if (! $res && file_exists("../../main.inc.php")) $res=@include "../../main.inc.php"; +if (! $res && file_exists("../../../main.inc.php")) $res=@include "../../../main.inc.php"; +if (! $res) die("Include of main fails"); + +require_once DOL_DOCUMENT_ROOT."/core/lib/admin.lib.php"; +require_once DOL_DOCUMENT_ROOT.'/core/class/html.formadmin.class.php'; +require_once DOL_DOCUMENT_ROOT.'/core/class/html.formother.class.php'; +dol_include_once("/ovh/lib/ovh.lib.php"); + +if (!$user->admin) accessforbidden(); + +$langs->load("admin"); +$langs->load("companies"); +$langs->load("ovh@ovh"); +$langs->load("sms"); + +$def = array(); +$actiontest = GETPOST("test"); +$actionsave = GETPOST("save"); + + + +/* + * Actions + */ + + + + + +/* + * View + */ + + +$form=new Form($db); +$formadmin=new FormAdmin($db); +$formother=new FormOther($db); + +llxHeader('', $langs->trans('OvhSmsSetup'), '', ''); + +$linkback=''.$langs->trans("BackToModuleList").''; +print_fiche_titre($langs->trans("OvhSmsSetup"), $linkback, 'setup'); +print '
'; + + +print '
'; +print ''; + +$head=ovhadmin_prepare_head(); + +dol_fiche_head($head, 'other', '', -1); + +print '
'; + +print '
'; + +print '
'; +print ''; + +print ''; +print '"; +print ""; +print ""; + +// Google debug +print ''; +print ''; +print ''; + +print "
'.$langs->trans("Parameter")."".$langs->trans("Value")."
'.$langs->trans("OVH_DEBUG").''; +print ajax_constantonoff('OVH_DEBUG', array(), $conf->entity, 0, 0, 1); +print '
"; +print '
'; + +print '
'; + +dol_fiche_end(); + +print '
'; +//print ''; +print "
"; + +print "
\n"; + + +dol_htmloutput_mesg($mesg); + +llxFooter(); + +$db->close(); diff --git a/htdocs/ovh/langs/en_US/ovh.lang b/htdocs/ovh/langs/en_US/ovh.lang index 39f19cc26..40519ea56 100755 --- a/htdocs/ovh/langs/en_US/ovh.lang +++ b/htdocs/ovh/langs/en_US/ovh.lang @@ -87,3 +87,4 @@ InvalidMobilePhoneNumberForContact=Phone number %s is invalid : %s (must have in SendSMS=Send SMS OVH_USE_LAST_INVOCIE_VALIDATED_DATE=Suggest last supplier invoice date from supplier on import invoice tools ValidImportedInvoice=Valid imported invoices +OVH_DEBUG=Enable additional logs specific to the OVH module (dolibarr_ovh.* files) diff --git a/htdocs/ovh/lib/ovh.lib.php b/htdocs/ovh/lib/ovh.lib.php index 859ac6df5..4897515f6 100755 --- a/htdocs/ovh/lib/ovh.lib.php +++ b/htdocs/ovh/lib/ovh.lib.php @@ -60,6 +60,11 @@ function ovhadmin_prepare_head() $head[$h][2] = 'sms'; $h++; + $head[$h][0] = dol_buildpath("/ovh/admin/ovh_other.php", 1); + $head[$h][1] = $langs->trans("Other"); + $head[$h][2] = 'other'; + $h++; + $head[$h][0] = 'about.php'; $head[$h][1] = $langs->trans("About"); $head[$h][2] = 'tababout';