Fix use of alternative aliases is ok now
This commit is contained in:
parent
b37f7a6953
commit
25d656025a
@ -89,10 +89,19 @@ if (empty($pageid))
|
||||
if ($pageref)
|
||||
{
|
||||
$result=$objectpage->fetch(0, $object->id, $pageref);
|
||||
if ($result > 0)
|
||||
if ($result > 0)
|
||||
{
|
||||
$pageid = $objectpage->id;
|
||||
}
|
||||
elseif($result == 0)
|
||||
{
|
||||
// Page not found from ref=pageurl, we try using alternative alias
|
||||
$result=$objectpage->fetch(0, $object->id, null, $pageref);
|
||||
if ($result > 0)
|
||||
{
|
||||
$pageid = $objectpage->id;
|
||||
}
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
|
||||
@ -109,6 +109,12 @@ if ($pageid < 0) $pageid = 0;
|
||||
if (($pageid > 0 || $pageref) && $action != 'addcontainer')
|
||||
{
|
||||
$res = $objectpage->fetch($pageid, ($object->id > 0 ? $object->id : null), $pageref);
|
||||
//var_dump($res);exit;
|
||||
//if ($res == 0) // Page ref not found, we check in alias
|
||||
//{
|
||||
// $res = $objectpage->fetch($pageid, ($object->id > 0 ? $object->id : null), $pageref);
|
||||
//}
|
||||
|
||||
// Check if pageid is inside the new website, if not we reset param pageid
|
||||
if ($object->id > 0 && ($objectpage->fk_website != $object->id))
|
||||
{
|
||||
@ -1009,17 +1015,43 @@ if ($action == 'updatemeta')
|
||||
|
||||
if (! $result) setEventMessages('Failed to write file '.$filemaster, null, 'errors');
|
||||
|
||||
|
||||
// Now generate the alias.php page
|
||||
// Now delete the alias.php page
|
||||
if (! empty($fileoldalias))
|
||||
{
|
||||
dol_syslog("We regenerate alias page new name=".$filealias.", old name=".$fileoldalias);
|
||||
dol_syslog("We delete old alias page name=".$fileoldalias." to build a new alias page=".$filealias);
|
||||
dol_delete_file($fileoldalias);
|
||||
}
|
||||
// Now delete the alternative alias.php pages
|
||||
if (! empty($objectpage->old_object->aliasalt))
|
||||
{
|
||||
$tmpaltaliases=explode(',', $objectpage->old_object->aliasalt);
|
||||
if (is_array($tmpaltaliases))
|
||||
{
|
||||
foreach($tmpaltaliases as $tmpaliasalt)
|
||||
{
|
||||
dol_syslog("We delete old alt alias pages name=".trim($tmpaliasalt));
|
||||
dol_delete_file($pathofwebsite.'/'.trim($tmpaliasalt).'.php');
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
// Save page alias
|
||||
$result=dolSavePageAlias($filealias, $object, $objectpage);
|
||||
if (! $result) setEventMessages('Failed to write file '.$filealias, null, 'errors');
|
||||
// Save alt aliases
|
||||
if (! empty($objectpage->aliasalt))
|
||||
{
|
||||
$tmpaltaliases=explode(',', $objectpage->aliasalt);
|
||||
if (is_array($tmpaltaliases))
|
||||
{
|
||||
foreach($tmpaltaliases as $tmpaliasalt)
|
||||
{
|
||||
$result=dolSavePageAlias($pathofwebsite.'/'.trim($tmpaliasalt).'.php', $object, $objectpage);
|
||||
if (! $result) setEventMessages('Failed to write file '.$pathofwebsite.'/'.trim($tmpaliasalt).'.php', null, 'errors');
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
// Save page of content
|
||||
$result=dolSavePageContent($filetpl, $object, $objectpage);
|
||||
|
||||
Loading…
Reference in New Issue
Block a user