Skip to content

Commit

Permalink
Multilingual fixes
Browse files Browse the repository at this point in the history
  • Loading branch information
aembler committed Jul 29, 2016
1 parent f23ba78 commit 1bbaf52
Show file tree
Hide file tree
Showing 2 changed files with 15 additions and 10 deletions.
15 changes: 9 additions & 6 deletions web/concrete/controllers/panel/detail/page/composer.php
Expand Up @@ -122,14 +122,17 @@ protected function save() {
$c = $c->getVersionToModify();
$this->page = $c;

if ($c->isPageDraft()) {
/// set the target
$configuredTarget = $pagetype->getPageTypePublishTargetObject();
$targetPageID = $configuredTarget->getPageTypePublishTargetConfiguredTargetParentPageID();
if (!$targetPageID) {
$targetPageID = $_POST['cParentID'];
}
$configuredTarget = $pagetype->getPageTypePublishTargetObject();
$targetPageID = $configuredTarget->getPageTypePublishTargetConfiguredTargetParentPageID();
if (!$targetPageID) {
$targetPageID = $_POST['cParentID'];
}


$c->setPageDraftTargetParentPageID($targetPageID);
$c->setPageDraftTargetParentPageID($targetPageID);
}
$outputControls = $pagetype->savePageTypeComposerForm($c);
}
$ptr->setError($e);
Expand Down
10 changes: 6 additions & 4 deletions web/concrete/src/Multilingual/Page/Section/Section.php
Expand Up @@ -446,14 +446,16 @@ public static function relatePage($oldPage, $newPage, $locale)
$db = Database::get();
$mpRelationID = self::getMultilingualPageRelationID($oldPage->getCollectionID());

if ($mpRelationID) {
$v = array($mpRelationID, $newPage->getCollectionID(), $locale);
$section = Section::getByLocale($locale);

if ($mpRelationID && $section) {
$v = array($mpRelationID, $newPage->getCollectionID(), $section->getLocale(), $section->getLanguage());
$db->Execute(
'delete from MultilingualPageRelations where mpRelationID = ? and mpLocale = ?',
array($mpRelationID, $locale)
array($mpRelationID, $section->getLocale())
);
$db->Execute('delete from MultilingualPageRelations where cID = ?', array($newPage->getCollectionID()));
$db->Execute('insert into MultilingualPageRelations (mpRelationID, cID, mpLocale) values (?, ?, ?)', $v);
$db->Execute('insert into MultilingualPageRelations (mpRelationID, cID, mpLocale, mpLanguage) values (?, ?, ?, ?)', $v);
$pde = new Event($newPage);
$pde->setLocale($locale);
\Events::dispatch('on_multilingual_page_relate', $pde);
Expand Down

0 comments on commit 1bbaf52

Please sign in to comment.