FIX Backto link
This commit is contained in:
parent
43763771a6
commit
aa1f601528
@ -21,7 +21,6 @@
|
|||||||
* \brief Library for website module
|
* \brief Library for website module
|
||||||
*/
|
*/
|
||||||
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Remove PHP code part from a string.
|
* Remove PHP code part from a string.
|
||||||
*
|
*
|
||||||
|
|||||||
@ -113,6 +113,7 @@ function dolSavePageContent($filetpl, Website $object, WebsitePage $objectpage)
|
|||||||
// Now create the .tpl file (duplicate code with actions updatesource or updatecontent but we need this to save new header)
|
// Now create the .tpl file (duplicate code with actions updatesource or updatecontent but we need this to save new header)
|
||||||
dol_syslog("We regenerate the tpl page filetpl=".$filetpl);
|
dol_syslog("We regenerate the tpl page filetpl=".$filetpl);
|
||||||
|
|
||||||
|
include_once DOL_DOCUMENT_ROOT.'/core/lib/files.lib.php';
|
||||||
dol_delete_file($filetpl);
|
dol_delete_file($filetpl);
|
||||||
|
|
||||||
$shortlangcode = '';
|
$shortlangcode = '';
|
||||||
|
|||||||
@ -3642,10 +3642,20 @@ if ($action == 'preview' || $action == 'createfromclone' || $action == 'createpa
|
|||||||
// If mode WEBSITE_SUBCONTAINERSINLINE is on
|
// If mode WEBSITE_SUBCONTAINERSINLINE is on
|
||||||
if (!empty($conf->global->WEBSITE_SUBCONTAINERSINLINE))
|
if (!empty($conf->global->WEBSITE_SUBCONTAINERSINLINE))
|
||||||
{
|
{
|
||||||
|
// TODO Check file $filephp exists, if not create it.
|
||||||
|
|
||||||
//var_dump($filetpl);
|
//var_dump($filetpl);
|
||||||
$filephp = $filetpl;
|
$filephp = $filetpl;
|
||||||
ob_start();
|
ob_start();
|
||||||
include $filephp;
|
try {
|
||||||
|
$res = include $filephp;
|
||||||
|
if (empty($res)) {
|
||||||
|
print "ERROR: Failed to include file '".$filephp."'. Try to edit and save page.";
|
||||||
|
}
|
||||||
|
} catch(Exception $e)
|
||||||
|
{
|
||||||
|
print $e->getMessage();
|
||||||
|
}
|
||||||
$newcontent = ob_get_contents();
|
$newcontent = ob_get_contents();
|
||||||
ob_end_clean();
|
ob_end_clean();
|
||||||
}
|
}
|
||||||
|
|||||||
@ -54,6 +54,8 @@ if (empty($argv[3]) || !in_array($argv[1], array('test', 'confirm')) || empty($w
|
|||||||
|
|
||||||
require $path."../../htdocs/master.inc.php";
|
require $path."../../htdocs/master.inc.php";
|
||||||
include_once DOL_DOCUMENT_ROOT.'/website/class/website.class.php';
|
include_once DOL_DOCUMENT_ROOT.'/website/class/website.class.php';
|
||||||
|
include_once DOL_DOCUMENT_ROOT.'/website/class/websitepage.class.php';
|
||||||
|
include_once DOL_DOCUMENT_ROOT.'/core/lib/website2.lib.php';
|
||||||
|
|
||||||
$langs->load('main');
|
$langs->load('main');
|
||||||
|
|
||||||
@ -95,7 +97,7 @@ if (! $resql) {
|
|||||||
|
|
||||||
$db->begin();
|
$db->begin();
|
||||||
|
|
||||||
$i = 0;
|
$i = 0; $nbimported = 0; $nbalreadyexists = 0;
|
||||||
while ($obj = $dbjoomla->fetch_object($resql)) {
|
while ($obj = $dbjoomla->fetch_object($resql)) {
|
||||||
if ($obj) {
|
if ($obj) {
|
||||||
$i++;
|
$i++;
|
||||||
@ -129,10 +131,23 @@ while ($obj = $dbjoomla->fetch_object($resql)) {
|
|||||||
print 'ERROR: '.$db->lasterrno.": ".$sqlinsert."\n";
|
print 'ERROR: '.$db->lasterrno.": ".$sqlinsert."\n";
|
||||||
if ($db->lasterrno != 'DB_ERROR_RECORD_ALREADY_EXISTS') {
|
if ($db->lasterrno != 'DB_ERROR_RECORD_ALREADY_EXISTS') {
|
||||||
$error++;
|
$error++;
|
||||||
|
} else {
|
||||||
|
$nbalreadyexists++;
|
||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
$pageid = $db->last_insert_id(MAIN_DB_PREFIX.'website_page');
|
$pageid = $db->last_insert_id(MAIN_DB_PREFIX.'website_page');
|
||||||
|
|
||||||
|
if ($pageid > 0) { // We must also regenerate page on disk
|
||||||
|
global $dolibarr_main_data_root;
|
||||||
|
$pathofwebsite = $dolibarr_main_data_root.'/website/'.$websiteref;
|
||||||
|
$filetpl = $pathofwebsite.'/page'.$pageid.'.tpl.php';
|
||||||
|
$websitepage = new WebsitePage($db);
|
||||||
|
$websitepage->fetch($pageid);
|
||||||
|
dolSavePageContent($filetpl, $website, $websitepage);
|
||||||
|
}
|
||||||
|
|
||||||
print "Insert done - pageid = ".$pageid."\n";
|
print "Insert done - pageid = ".$pageid."\n";
|
||||||
|
$nbimported++;
|
||||||
}
|
}
|
||||||
|
|
||||||
if ($max && $i >= $max) {
|
if ($max && $i >= $max) {
|
||||||
@ -144,6 +159,8 @@ while ($obj = $dbjoomla->fetch_object($resql)) {
|
|||||||
|
|
||||||
if ($mode == 'confirm' && ! $error) {
|
if ($mode == 'confirm' && ! $error) {
|
||||||
print "Commit\n";
|
print "Commit\n";
|
||||||
|
print $nbalreadyexists." page(s) already exists.\n";
|
||||||
|
print $nbimported." page(s) imported with importid=".$importid."\n";
|
||||||
$db->commit();
|
$db->commit();
|
||||||
} else {
|
} else {
|
||||||
print "Rollback\n";
|
print "Rollback\n";
|
||||||
|
|||||||
Loading…
Reference in New Issue
Block a user