...
 
Commits (7)
# CHANGELOG HOSTING FOR <a href="https://www.dolibarr.org">DOLIBARR ERP CRM</a>
# 2.0.13
FIX : avoid errors for category list
NEW : add buttons to create host and domain from hosting list
# 2.0.12
FIX : bad hook name for host dao for element link
......
......@@ -100,13 +100,12 @@ dol_fiche_head(
$langs->trans("Module110100Name"),
0,
"hosting@hosting"
);
);
//print '<p>'. $langs->trans("HostingSetupPage").'</p>';
if ($action == 'migrate_ref') {
$sql = "SELECT rowid";
$sql.= " FROM ".MAIN_DB_PREFIX."host";
$sql.= " WHERE ref IS NULL";
......@@ -126,14 +125,17 @@ if ($action == 'migrate_ref') {
$hostStatic->ref = $hostStatic->getDefaultRef();
$result=$hostStatic->update($user);
if ($result < 0) {
$error++; dol_print_error($db, $hostStatic->error);
$error++;
dol_print_error($db, $hostStatic->error);
} else {
print "Host with id ".$hostStatic->id." updated<br />";
}
}
$i++;
}
} else print $langs->trans('NothingToMigrate');
} else {
print $langs->trans('NothingToMigrate');
}
} else {
$error++;
dol_print_error($db);
......
This diff is collapsed.
This diff is collapsed.
......@@ -47,7 +47,7 @@ if (!defined('NOREQUIRETRAN')) {
$res = 0;
if (file_exists('../../../main.inc.php')) {
$res = include '../../../main.inc.php';
} else if (!$res && file_exists('../../../../main.inc.php')) {
} elseif (!$res && file_exists('../../../../main.inc.php')) {
$res = include '../../../../main.inc.php';
} else {
die('Include of main.inc.php failed');
......
......@@ -142,7 +142,6 @@ class box_hosts extends ModeleBoxes
if ($num == 0) {
$this->info_box_contents[$i][0] = array('td' => 'align="center"', 'text' => $langs->trans("NoRecordedHosts"));
}
} else {
dol_print_error($db);
}
......@@ -165,5 +164,4 @@ class box_hosts extends ModeleBoxes
{
parent::showBox($this->info_box_head, $this->info_box_contents, $nooutput);
}
}
......@@ -37,15 +37,14 @@ include_once DOL_DOCUMENT_ROOT . "/core/modules/DolibarrModules.class.php";
*
* Description and activation class for module Hosting
*
* @package modHosting
*
* @package modHosting
*/
class modHosting extends DolibarrModules
{
/**
* Constructor.
*
* @param DoliDB $db Database handler
* @param DoliDB $db Database handler
*/
public function __construct($db)
{
......@@ -79,7 +78,7 @@ class modHosting extends DolibarrModules
$this->editor_url = "https://librethic.io";
// Possible values for version are: 'development', 'experimental', 'dolibarr' or version
$this->version = '2.0.12+8';
$this->version = '2.0.13+9';
// Key used in llx_const table to save module status enabled/disabled (where MYMODULE is value of property name of module in uppercase)
$this->const_name = 'MAIN_MODULE_' . strtoupper($this->name);
......@@ -154,8 +153,7 @@ class modHosting extends DolibarrModules
// 'member' to add a tab in fundation member view
// Dictionnaries
if (! isset($conf->hosting) || ! isset($conf->hosting->enabled))
{
if (! isset($conf->hosting) || ! isset($conf->hosting->enabled)) {
$conf->hosting=new stdClass();
$conf->hosting->enabled=0;
}
......
......@@ -78,9 +78,9 @@ $pageprev = $page - 1;
$pagenext = $page + 1;
// Filters
$search_company = GETPOST("search_company",'alpha');
$search_hostname = GETPOST("search_hostname",'alpha');
$search_category = GETPOST("search_category",'alpha');
$search_company = GETPOST("search_company", 'alpha');
$search_hostname = GETPOST("search_hostname", 'alpha');
$search_category = GETPOST("search_category", 'alpha');
$search_actif = GETPOST("search_actif", 'int');
$filter = array();
......@@ -99,25 +99,27 @@ if (!empty($search_actif)) {
}
// Initialize context for list
$contextpage=GETPOST('contextpage','aZ')?GETPOST('contextpage','aZ'):'hostlist';
$contextpage=GETPOST('contextpage', 'aZ')?GETPOST('contextpage', 'aZ'):'hostlist';
// Add $param from extra fields
foreach ($search_array_options as $key => $val)
{
foreach ($search_array_options as $key => $val) {
$crit=$val;
$tmpkey=preg_replace('/search_options_/','',$key);
$tmpkey=preg_replace('/search_options_/', '', $key);
$typ=$extrafields->attribute_type[$tmpkey];
if ($val != '') {
$param.='&search_options_'.$tmpkey.'='.urlencode($val);
}
$mode=0;
if (in_array($typ, array('int','double'))) $mode=1; // Search on a numeric
if ($val && ( ($crit != '' && ! in_array($typ, array('select'))) || ! empty($crit)))
{
if (in_array($typ, array('int','double'))) {
$mode=1; // Search on a numeric
}
if ($val && ( ($crit != '' && ! in_array($typ, array('select'))) || ! empty($crit))) {
$filter['ef.'.$tmpkey]=natural_search('ef.'.$tmpkey, $crit, $mode, 1);
}
}
if (! empty($contextpage) && $contextpage != $_SERVER["PHP_SELF"]) $param.='&contextpage='.$contextpage;
if (! empty($contextpage) && $contextpage != $_SERVER["PHP_SELF"]) {
$param.='&contextpage='.$contextpage;
}
// Definition of fields for list
$arrayfields = array(
......@@ -130,7 +132,7 @@ $arrayfields = array(
// Extra fields
if (is_array($extrafields->attribute_label) && count($extrafields->attribute_label)) {
foreach ( $extrafields->attribute_label as $key => $val ) {
foreach ($extrafields->attribute_label as $key => $val) {
$typeofextrafield=$extrafields->attribute_type[$key];
if ($typeofextrafield!='separate') {
$arrayfields["ef." . $key] = array(
......@@ -173,9 +175,7 @@ if (GETPOST("button_removefilter_x")) {
* Liste des hôtes
*
*/
if ($user->rights->hosting->read)
{
if ($user->rights->hosting->read) {
if ($socid) {
$soc = new Societe($db);
$result = $soc->fetch($socid);
......@@ -184,7 +184,7 @@ if ($user->rights->hosting->read)
exit;
}
$head = societe_prepare_head($soc);
dol_fiche_head($head, 'tabHosting',$langs->trans("ThirdParty"), 0, 'company');
dol_fiche_head($head, 'tabHosting', $langs->trans("ThirdParty"), 0, 'company');
dol_banner_tab($soc, 'socid', '', ($user->societe_id?0:1), 'rowid', 'nom');
......@@ -196,7 +196,7 @@ if ($user->rights->hosting->read)
$nbtotalofrecords = 0;
if (empty($conf->global->MAIN_DISABLE_FULL_SCANLIST)) {
$num_total = $object->fetch_all($sortorder, $sortfield, -1, $offset, 2,$filter);
$num_total = $object->fetch_all($sortorder, $sortfield, -1, $offset, 2, $filter);
}
$res = $object->fetch_all($sortorder, $sortfield, $limit, $offset, 2, $filter);
......@@ -204,12 +204,11 @@ if ($user->rights->hosting->read)
$total = 0;
if ($res > 0) {
if($socid > 0) {
if ($socid > 0) {
$param.= '&socid='.$socid;
}
print_barre_liste($langs->trans('HostsList'), $page, 'list.php', $param, $sortfield, $sortorder, '', $res, $num_total,'../img/host_32.png', 1);
print_barre_liste($langs->trans('HostsList'), $page, 'list.php', $param, $sortfield, $sortorder, '', $res, $num_total, '../img/host_32.png', 1);
$varpage = empty($contextpage) ? $_SERVER["PHP_SELF"] : $contextpage;
$selectedfields=$form->multiSelectArrayWithCheckbox('selectedfields', $arrayfields, $varpage);
......@@ -286,22 +285,22 @@ if ($user->rights->hosting->read)
print '</td>';
}
if (is_array($extrafields->attribute_label) && count($extrafields->attribute_label))
{
foreach($extrafields->attribute_label as $key => $val)
{
if (! empty($arrayfields["ef.".$key]['checked']))
{
if (is_array($extrafields->attribute_label) && count($extrafields->attribute_label)) {
foreach ($extrafields->attribute_label as $key => $val) {
if (! empty($arrayfields["ef.".$key]['checked'])) {
$align=$extrafields->getAlignFlag($key);
$typeofextrafield=$extrafields->attribute_type[$key];
print '<td class="liste_titre'.($align?' '.$align:'').'">';
if (in_array($typeofextrafield, array('varchar', 'int', 'double', 'select')))
{
if (in_array($typeofextrafield, array('varchar', 'int', 'double', 'select'))) {
$crit=$val;
$tmpkey=preg_replace('/search_options_/','',$key);
$tmpkey=preg_replace('/search_options_/', '', $key);
$searchclass='';
if (in_array($typeofextrafield, array('varchar', 'select'))) $searchclass='searchstring';
if (in_array($typeofextrafield, array('int', 'double'))) $searchclass='searchnum';
if (in_array($typeofextrafield, array('varchar', 'select'))) {
$searchclass='searchstring';
}
if (in_array($typeofextrafield, array('int', 'double'))) {
$searchclass='searchnum';
}
print '<input class="flat'.($searchclass?' '.$searchclass:'').'" size="4" type="text" name="search_options_'.$tmpkey.'" value="'.dol_escape_htmltag($search_array_options['search_options_'.$tmpkey]).'">';
}
print '</td>';
......@@ -315,11 +314,9 @@ if ($user->rights->hosting->read)
print '</tr>';
if(count($object->line)>0)
{
if (count($object->line)>0) {
// Tableau des journées
foreach($object->line as $line)
{
foreach ($object->line as $line) {
$societe = new Societe($db);
$societe->fetch($line->fk_soc);
$var = !$var;
......@@ -376,15 +373,13 @@ if ($user->rights->hosting->read)
print '<div class="tabsAction">';
if ($user->rights->hosting->write) {
print '<div class="inline-block divButAction">';
print '<a class="butAction" href="'.dol_buildpath('/hosting/host.php',1).'?action=add' . ($socid ? "&socid=$socid" : "") . '">' . $langs->trans("HostAdd") . '</a>';
print '<a class="butAction" href="'.dol_buildpath('/hosting/host.php', 1).'?action=add' . ($socid ? "&socid=$socid" : "") . '">' . $langs->trans("HostAdd") . '</a>';
print '</div>';
}
print '</div>';
}
} else {
setEventMessage($object->error,'errors');
setEventMessage($object->error, 'errors');
}
}
......
......@@ -55,7 +55,7 @@ foreach ($linkedObjectBlock as $object) {
</td>
<td align="center"><?php echo dol_print_date($object->date_creation, 'day'); ?></td>
<?php
$object->socid = $object->fk_soc;
$object->socid = $object->fk_soc;
$object->fetch_thirdparty();
?>
<td align="center"><?php echo $object->thirdparty->getNomUrl(1); ?></td>
......
This diff is collapsed.
This diff is collapsed.
......@@ -25,17 +25,37 @@
// 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");
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");
$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 && file_exists("../../../main.inc.php")) $res=@include("../../../main.inc.php");
if (! $res) die("Include of main fails");
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 && file_exists("../../../main.inc.php")) {
$res=@include("../../../main.inc.php");
}
if (! $res) {
die("Include of main fails");
}
require_once DOL_DOCUMENT_ROOT.'/core/lib/company.lib.php';
require_once DOL_DOCUMENT_ROOT.'/core/lib/files.lib.php';
......@@ -48,9 +68,9 @@ dol_include_once('/hosting/lib/hosting.lib.php');
$langs->loadLangs(array("hosting@hosting","companies","other"));
$action=GETPOST('action','aZ09');
$action=GETPOST('action', 'aZ09');
$confirm=GETPOST('confirm');
$id=(GETPOST('socid','int') ? GETPOST('socid','int') : GETPOST('id','int'));
$id=(GETPOST('socid', 'int') ? GETPOST('socid', 'int') : GETPOST('id', 'int'));
$ref = GETPOST('ref', 'alpha');
// Security check - Protection if external user
......@@ -59,15 +79,21 @@ $ref = GETPOST('ref', 'alpha');
//$result = restrictedArea($user, 'hosting', $id);
// Get parameters
$sortfield = GETPOST("sortfield",'alpha');
$sortorder = GETPOST("sortorder",'alpha');
$page = GETPOST("page",'int');
if (empty($page) || $page == -1) { $page = 0; } // If $page is not defined, or '' or -1
$sortfield = GETPOST("sortfield", 'alpha');
$sortorder = GETPOST("sortorder", 'alpha');
$page = GETPOST("page", 'int');
if (empty($page) || $page == -1) {
$page = 0;
} // If $page is not defined, or '' or -1
$offset = $conf->liste_limit * $page;
$pageprev = $page - 1;
$pagenext = $page + 1;
if (! $sortorder) $sortorder="ASC";
if (! $sortfield) $sortfield="name";
if (! $sortorder) {
$sortorder="ASC";
}
if (! $sortfield) {
$sortfield="name";
}
// Initialize technical objects
$object=new Host($db);
......@@ -80,7 +106,9 @@ $extralabels = $extrafields->fetch_name_optionals_label('host');
// Load object
include DOL_DOCUMENT_ROOT.'/core/actions_fetchobject.inc.php'; // Must be include, not include_once // Must be include, not include_once. Include fetch and fetch_thirdparty but not fetch_optionals
if ($id > 0 || ! empty($ref)) $upload_dir = $conf->hosting->multidir_output[$object->entity] . "/host/" . dol_sanitizeFileName($object->id);
if ($id > 0 || ! empty($ref)) {
$upload_dir = $conf->hosting->multidir_output[$object->entity] . "/host/" . dol_sanitizeFileName($object->id);
}
......@@ -102,32 +130,32 @@ $help_url='';
//$help_url='EN:Module_Third_Parties|FR:Module_Tiers|ES:Empresas';
llxHeader('', $title, $help_url);
if ($object->id)
{
if ($object->id) {
/*
* Show tabs
*/
if (! empty($conf->notification->enabled)) $langs->load("mails");
if (! empty($conf->notification->enabled)) {
$langs->load("mails");
}
$head = hostPrepareHead($object);
dol_fiche_head($head, 'document', $langs->trans("Host"), -1, 'host@hosting');
// Construit liste des fichiers
$filearray=dol_dir_list($upload_dir,"files",0,'','(\.meta|_preview.*\.png)$',$sortfield,(strtolower($sortorder)=='desc'?SORT_DESC:SORT_ASC),1);
$filearray=dol_dir_list($upload_dir, "files", 0, '', '(\.meta|_preview.*\.png)$', $sortfield, (strtolower($sortorder)=='desc'?SORT_DESC:SORT_ASC), 1);
$totalsize=0;
foreach($filearray as $key => $file)
{
foreach ($filearray as $key => $file) {
$totalsize+=$file['size'];
}
// Object card
// ------------------------------------------------------------
$linkback = '<a href="' .dol_buildpath('/hosting/host_list.php',1) . '?restore_lastsearch_values=1' . (! empty($socid) ? '&socid=' . $socid : '') . '">' . $langs->trans("BackToList") . '</a>';
$linkback = '<a href="' .dol_buildpath('/hosting/host_list.php', 1) . '?restore_lastsearch_values=1' . (! empty($socid) ? '&socid=' . $socid : '') . '">' . $langs->trans("BackToList") . '</a>';
$morehtmlref='<div class="refidno">';
$morehtmlref.=$object->label;
// Thirdparty
if($object->thirdparty->id) {
if ($object->thirdparty->id) {
$morehtmlref.='<br>'.$langs->trans('ThirdParty') . ' : ' . $object->thirdparty->getNomUrl(1);
}
$morehtmlref.='<br />'.$langs->trans('DateCreation').' : '.dol_print_date($object->date_creation);
......@@ -162,10 +190,8 @@ if ($object->id)
$relativepathwithnofile='host/' . dol_sanitizeFileName($object->id).'/';
include_once DOL_DOCUMENT_ROOT . '/core/tpl/document_actions_post_headers.tpl.php';
}
else
{
accessforbidden('',0,0);
} else {
accessforbidden('', 0, 0);
}
......
......@@ -40,17 +40,37 @@
// 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");
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");
$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 && file_exists("../../../main.inc.php")) $res=@include("../../../main.inc.php");
if (! $res) die("Include of main fails");
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 && file_exists("../../../main.inc.php")) {
$res=@include("../../../main.inc.php");
}
if (! $res) {
die("Include of main fails");
}
include_once(DOL_DOCUMENT_ROOT.'/core/class/html.formcompany.class.php');
include_once(DOL_DOCUMENT_ROOT.'/core/class/html.formfile.class.php');
......@@ -74,21 +94,28 @@ $diroutputmassaction=$conf->hosting->dir_output . '/temp/massgeneration/'.$user-
$hookmanager->initHooks(array('hostcard')); // Note that conf->hooks_modules contains array
// Fetch optionals attributes and labels
$extralabels = $extrafields->fetch_name_optionals_label('host');
$search_array_options=$extrafields->getOptionalsFromPost($extralabels,'','search_');
$search_array_options=$extrafields->getOptionalsFromPost($extralabels, '', 'search_');
// Initialize array of search criterias
$search_all=trim(GETPOST("search_all",'alpha'));
$search_all=trim(GETPOST("search_all", 'alpha'));
$search=array();
foreach($object->fields as $key => $val)
{
if (GETPOST('search_'.$key,'alpha')) $search[$key]=GETPOST('search_'.$key,'alpha');
foreach ($object->fields as $key => $val) {
if (GETPOST('search_'.$key, 'alpha')) {
$search[$key]=GETPOST('search_'.$key, 'alpha');
}
}
if (empty($action) && empty($id) && empty($ref)) $action='view';
if (empty($action) && empty($id) && empty($ref)) {
$action='view';
}
// Security check - Protection if external user
if ($user->societe_id > 0) access_forbidden();
if ($user->societe_id > 0) $socid = $user->societe_id;
if ($user->societe_id > 0) {
access_forbidden();
}
if ($user->societe_id > 0) {
$socid = $user->societe_id;
}
$return = restrictedArea($user, 'hosting', $id, 'host');
// fetch optionals attributes and labels
......@@ -106,18 +133,19 @@ include DOL_DOCUMENT_ROOT.'/core/actions_fetchobject.inc.php'; // Must be inclu
*/
$parameters=array();
$reshook=$hookmanager->executeHooks('doActions',$parameters,$object,$action); // Note that $action and $object may have been modified by some hooks
if ($reshook < 0) setEventMessages($hookmanager->error, $hookmanager->errors, 'errors');
$reshook=$hookmanager->executeHooks('doActions', $parameters, $object, $action); // Note that $action and $object may have been modified by some hooks
if ($reshook < 0) {
setEventMessages($hookmanager->error, $hookmanager->errors, 'errors');
}
if (empty($reshook))
{
if (empty($reshook)) {
$error=0;
$permissiontoadd = $user->rights->hosting->write;
$permissiontodelete = $user->rights->hosting->delete;
$permissiondellink = $user->rights->hosting->write;
$backurlforlist = dol_buildpath('/hosting/host_list.php',1);
$backurlforlist = dol_buildpath('/hosting/host_list.php', 1);
$ret = $extrafields->setOptionalsFromPost($extralabels,$object);
$ret = $extrafields->setOptionalsFromPost($extralabels, $object);
......@@ -144,7 +172,6 @@ if (empty($reshook))
if ($element == "monitor") {
$rep = "monitoring";
}
if (dol_include_once('/' . $rep . '/class/' . $element . '.class.php')) {
Header("Location: ../$rep/$element_page.php?action=create&hostid=$id&typeid=$typeid");
......@@ -169,24 +196,22 @@ if (empty($reshook))
$form=new Form($db);
$formfile=new FormFile($db);
llxHeader('','Host','');
llxHeader('', 'Host', '');
// Part to show record
if ((empty($action) || ($action != 'edit' && $action != 'create')))
{
if ((empty($action) || ($action != 'edit' && $action != 'create'))) {
$head = hostPrepareHead($object);
dol_fiche_head($head, 'extensions', $langs->trans("Host"), -1, 'host@hosting');
// Object card
// ------------------------------------------------------------
$linkback = '<a href="' .dol_buildpath('/hosting/host_list.php',1) . '?restore_lastsearch_values=1' . (! empty($socid) ? '&socid=' . $socid : '') . '">' . $langs->trans("BackToList") . '</a>';
$linkback = '<a href="' .dol_buildpath('/hosting/host_list.php', 1) . '?restore_lastsearch_values=1' . (! empty($socid) ? '&socid=' . $socid : '') . '">' . $langs->trans("BackToList") . '</a>';
$morehtmlref='<div class="refidno">';
$morehtmlref.=$object->label;
// Thirdparty
if($object->thirdparty->id) {
if ($object->thirdparty->id) {
$morehtmlref.='<br>'.$langs->trans('ThirdParty') . ' : ' . $object->thirdparty->getNomUrl(1);
}
$morehtmlref.='<br />'.$langs->trans('DateCreation').' : '.dol_print_date($object->date_creation);
......@@ -207,7 +232,6 @@ if ((empty($action) || ($action != 'edit' && $action != 'create')))
$soc->id = $socid;
if ($soc->fetch($soc->id) && count($object->getListOfManagedType()) > 0) {
print '<form action="' . $_SERVER['PHP_SELF'] . '" method="post">';
print '<input type="hidden" name="token" value="' . $_SESSION['newtoken'] . '" />';
print '<input type="hidden" name="socid" value="' . $soc->id . '" />';
......@@ -327,7 +351,6 @@ if ((empty($action) || ($action != 'edit' && $action != 'create')))
print '<div class="clearboth"></div><br>';
dol_fiche_end();
}
......
This diff is collapsed.
......@@ -25,17 +25,37 @@
// 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");
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");
$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 && file_exists("../../../main.inc.php")) $res=@include("../../../main.inc.php");
if (! $res) die("Include of main fails");
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 && file_exists("../../../main.inc.php")) {
$res=@include("../../../main.inc.php");
}
if (! $res) {
die("Include of main fails");
}
dol_include_once('/hosting/class/host.class.php');
dol_include_once('/hosting/lib/hosting.lib.php');
......@@ -65,7 +85,9 @@ $extralabels = $extrafields->fetch_name_optionals_label('host');
// Load object
include DOL_DOCUMENT_ROOT.'/core/actions_fetchobject.inc.php'; // Must be include, not include_once // Must be include, not include_once. Include fetch and fetch_thirdparty but not fetch_optionals
if ($id > 0 || ! empty($ref)) $upload_dir = $conf->hosting->multidir_output[$object->entity] . "/" . $object->id;
if ($id > 0 || ! empty($ref)) {
$upload_dir = $conf->hosting->multidir_output[$object->entity] . "/" . $object->id;
}
$permissionnote=1;
//$permissionnote=$user->rights->hosting->creer; // Used by the include of actions_setnotes.inc.php
......@@ -86,10 +108,9 @@ $form = new Form($db);
//$help_url='EN:Customers_Orders|FR:Commandes_Clients|ES:Pedidos de clientes';
$help_url='';
llxHeader('',$langs->trans('Host'),$help_url);
llxHeader('', $langs->trans('Host'), $help_url);
if ($id > 0 || ! empty($ref))
{
if ($id > 0 || ! empty($ref)) {
$object->fetch_thirdparty();
$head = hostPrepareHead($object);
......@@ -98,12 +119,12 @@ if ($id > 0 || ! empty($ref))
// Object card
// ------------------------------------------------------------
$linkback = '<a href="' .dol_buildpath('/hosting/host_list.php',1) . '?restore_lastsearch_values=1' . (! empty($socid) ? '&socid=' . $socid : '') . '">' . $langs->trans("BackToList") . '</a>';
$linkback = '<a href="' .dol_buildpath('/hosting/host_list.php', 1) . '?restore_lastsearch_values=1' . (! empty($socid) ? '&socid=' . $socid : '') . '">' . $langs->trans("BackToList") . '</a>';
$morehtmlref='<div class="refidno">';
$morehtmlref.=$object->label;
// Thirdparty
if($object->thirdparty->id) {
if ($object->thirdparty->id) {
$morehtmlref.='<br>'.$langs->trans('ThirdParty') . ' : ' . $object->thirdparty->getNomUrl(1);
}
$morehtmlref.='<br />'.$langs->trans('DateCreation').' : '.dol_print_date($object->date_creation);
......
......@@ -114,7 +114,6 @@ if ($result) {
$i = 0;
if ($num > 0) {
$host_static = new Host($db);
$transRecordedType = $langs->trans("LastCreateHosts", $max);
......@@ -160,7 +159,6 @@ if ($result) {
print "</table>";
} else {
print '<div class="info">' . $langs->trans('NoHost') . '</div>';
}
} else {
......
......@@ -52,7 +52,7 @@ HostingSetup=Hosting Modul Setup
HostAddSuccess=Hosts erfolgreich hinzugefügt
HostDeleteSuccess=Hosts erfolgreich gelöscht
HostUpdateSuccess=Hosts erfolgreich aktualisiert
RelatedHosts=Related host(s)
RelatedHosts=verbundene Host(s)
HostSingular=Host
HostCard=Host Karte
HostCategoryFormLabel=Host Kategorie
......
# Dolibarr language file - fr_FR - hosting
CHARSET=UTF-8
Module110100Name=Hosting module
Module110100Desc=Hosting administrative management into Dolibarr ERP/CRM
Permission110101=See hosts
Permission110102=Add / edit hosts
Permission110103=Delete hosts
HostingModulesFamily=Hosting family
HostingDictCategory=Hosts categories
HostCategoryShortWEBSITE=Website
HostCategoryShortDEDICATED=Dedicated hosting
HostCategoryShortSHAREDHOSTING=Shared hosting
HostCategoryShortVIRTUALMACHINE=Virtual Machine
HostingNumberingModules=Hosting numbering modules
HostingMigrateRefExplanation=Migrate to new reference system (generate a reference for existing hosts)
HostingMigrateRefLaunchMigration = Launch migration of new references
# About page
HostingAbout=Hosting module - About
HostingAboutPage=About hosting module
HostingAboutLibrethic=This module is maintained by Libr&thic. For more information, please visit website https://librethic.io.
ConfirmDeleteHost=Confirm delete host?
DeleteHost=Delete host
ErrorBadHostName=Incorrect hostname
Host=Host
Hosts=Hosts list
HostsMinOnly=hosts
HostAdd=Add host
HostsList=Hosts lists
HostName=Hostname
HostDetail=Host details
NoHost=None host
HostingBack=Back to hosting
AddNewHostExtension=add a new extension
ListOfHostExtension=Host extension list
ListOfLatestHostExtension=Latest extensions list
HostExtensions=Extensions
SeeAllExtensions=See all extensions
Active=Active
HostDateC=Creation date
NbOfHosts=Number of hosts
BoxLasthosts=last hosts
BoxTitleLasthosts=%s latest added hosts
LastCreateHosts=Latest added hosts
HostDeleted=Host deleted
HostingSetup=Hosting module setup
HostAddSuccess=Hosts added successfully
HostDeleteSuccess=Hosts deleted successfully
HostUpdateSuccess=Hosts updated successfully
RelatedHosts=Related host(s)
HostSingular=Host
HostCard=Host card
HostCategoryFormLabel=Host category
HostCategory=Category
HostIsUsed=L'hôte est utilisé par d'autres objets
GetIpFromHostname=Get IP address from hostname
ActionsOnHost=Events about host
NoRecordedHosts=No host recorded
SelectHost=Select host
LinkedHost=Linked host
NoHostLinked=No host linked
LinkToExistingHost=Link to an existing host
#Export
HostId=Host ID