FIX After import of a website template, home page was not set

This commit is contained in:
Laurent Destailleur 2020-02-06 23:35:04 +01:00
parent fe0d1a81eb
commit 83598a0b53
2 changed files with 16 additions and 2 deletions

View File

@ -1145,7 +1145,21 @@ class Website extends CommonObject
}
}
// Regenerate index page to point to new index page
// Read record of website that has been updated by the run_sql function previously called so we can get the
// value of fk_default_home that is ID of home page
$sql = 'SELECT fk_default_home FROM '.MAIN_DB_PREFIX.'website WHERE rowid = '.$object->id;
$resql = $this->db->query($sql);
if ($resql) {
$obj = $this->db->fetch_object($resql);
if ($obj) {
$object->fk_default_home = $obj->fk_default_home;
} else {
//$this->errors[] = 'Failed to get the Home page';
//$error++;
}
}
// Regenerate index page to point to the new index page
$pathofwebsite = $conf->website->dir_output.'/'.$object->ref;
dolSaveIndexPage($pathofwebsite, $pathofwebsite.'/index.php', $pathofwebsite.'/page'.$object->fk_default_home.'.tpl.php', $pathofwebsite.'/wrapper.php');

View File

@ -2822,7 +2822,7 @@ if ($action == 'createsite')
print '<tr><td class="titlefieldcreate fieldrequired">';
print $langs->trans('Ref');
print '</td><td>';
print '<input type="text" class="flat maxwidth300" name="WEBSITE_REF" value="'.dol_escape_htmltag($siteref).'">';
print '<input type="text" class="flat maxwidth300" name="WEBSITE_REF" value="'.dol_escape_htmltag($siteref).'" autofocus>';
print '</td></tr>';
print '<tr><td>';