Fix cloning website switch on new web site
This commit is contained in:
parent
6a8ed56c3d
commit
5e762fe712
@ -493,9 +493,10 @@ class Website extends CommonObject
|
|||||||
* @param User $user User making the clone
|
* @param User $user User making the clone
|
||||||
* @param int $fromid Id of object to clone
|
* @param int $fromid Id of object to clone
|
||||||
* @param string $newref New ref
|
* @param string $newref New ref
|
||||||
|
* @param string $newlang New language
|
||||||
* @return mixed New object created, <0 if KO
|
* @return mixed New object created, <0 if KO
|
||||||
*/
|
*/
|
||||||
public function createFromClone($user, $fromid, $newref)
|
public function createFromClone($user, $fromid, $newref, $newlang='')
|
||||||
{
|
{
|
||||||
global $hookmanager, $langs;
|
global $hookmanager, $langs;
|
||||||
global $dolibarr_main_data_root;
|
global $dolibarr_main_data_root;
|
||||||
@ -572,7 +573,7 @@ class Website extends CommonObject
|
|||||||
dol_delete_file($filetplold);
|
dol_delete_file($filetplold);
|
||||||
|
|
||||||
// Create new file
|
// Create new file
|
||||||
$objectpagenew = $objectpageold->createFromClone($user, $pageid, $objectpageold->pageurl, '', 0, $object->id);
|
$objectpagenew = $objectpageold->createFromClone($user, $pageid, $objectpageold->pageurl, '', 0, $object->id, 1);
|
||||||
//print $pageid.' = '.$objectpageold->pageurl.' -> '.$objectpagenew->id.' = '.$objectpagenew->pageurl.'<br>';
|
//print $pageid.' = '.$objectpageold->pageurl.' -> '.$objectpagenew->id.' = '.$objectpagenew->pageurl.'<br>';
|
||||||
if (is_object($objectpagenew) && $objectpagenew->pageurl)
|
if (is_object($objectpagenew) && $objectpagenew->pageurl)
|
||||||
{
|
{
|
||||||
|
|||||||
@ -362,10 +362,11 @@ class WebsitePage extends CommonObject
|
|||||||
* @param string $newref New ref/alias of page
|
* @param string $newref New ref/alias of page
|
||||||
* @param string $newlang New language
|
* @param string $newlang New language
|
||||||
* @param int $istranslation 1=New page is a translation of the cloned page.
|
* @param int $istranslation 1=New page is a translation of the cloned page.
|
||||||
* @param int $newwebsite 0=Same web site, 1=New web site
|
* @param int $newwebsite 0=Same web site, >0=Id of new website
|
||||||
|
* @param int $keeptitleunchanged 1=Keep title unchanged
|
||||||
* @return mixed New object created, <0 if KO
|
* @return mixed New object created, <0 if KO
|
||||||
*/
|
*/
|
||||||
public function createFromClone(User $user, $fromid, $newref, $newlang='', $istranslation=0, $newwebsite=0)
|
public function createFromClone(User $user, $fromid, $newref, $newlang='', $istranslation=0, $newwebsite=0, $keeptitleunchanged=0)
|
||||||
{
|
{
|
||||||
global $hookmanager, $langs;
|
global $hookmanager, $langs;
|
||||||
$error = 0;
|
$error = 0;
|
||||||
@ -385,7 +386,7 @@ class WebsitePage extends CommonObject
|
|||||||
$object->ref = $newref;
|
$object->ref = $newref;
|
||||||
$object->pageurl = $newref;
|
$object->pageurl = $newref;
|
||||||
$object->aliasalt = '';
|
$object->aliasalt = '';
|
||||||
$object->title = $langs->trans("CopyOf").' '.$object->title;
|
$object->title = ($keeptitleunchanged ? '' : $langs->trans("CopyOf").' ').$object->title;
|
||||||
if (! empty($newlang)) $object->lang=$newlang;
|
if (! empty($newlang)) $object->lang=$newlang;
|
||||||
if ($istranslation) $object->fk_page = $fromid;
|
if ($istranslation) $object->fk_page = $fromid;
|
||||||
else $object->fk_page = 0;
|
else $object->fk_page = 0;
|
||||||
|
|||||||
@ -1115,6 +1115,7 @@ if (($action == 'updatesource' || $action == 'updatecontent' || $action == 'conf
|
|||||||
$object = $objectnew;
|
$object = $objectnew;
|
||||||
$id = $object->id;
|
$id = $object->id;
|
||||||
$pageid = $object->fk_default_home;
|
$pageid = $object->fk_default_home;
|
||||||
|
$websitekey = GETPOST('siteref','aZ09');
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
Loading…
Reference in New Issue
Block a user