Skip to content
Code-Schnipsel Gruppen Projekte
Commit 8d8f50ea erstellt von Henning Leutz's avatar Henning Leutz :martial_arts_uniform:
Dateien durchsuchen

fix: patch for brick uid

Übergeordneter 1b231a55
No related branches found
No related tags found
Keine zugehörigen Merge Requests gefunden
......@@ -828,6 +828,10 @@ define('package/quiqqer/bricks/bin/Site/Area', [
data = QUIFormUtils.getFormData(Form),
brickId = Select.getParent().get('id');
if (typeof self.$brickCustomData[brickId] === 'undefined') {
self.$brickCustomData[brickId] = {};
}
self.$brickCustomData[brickId].customfields = JSON.encode(data);
Win.close();
......
<?php
define('QUIQQER_SYSTEM', true);
define('SYSTEM_INTERN', true);
require dirname(dirname(dirname(dirname(__FILE__)))).'/header.php';
// workaround for older patch
......@@ -11,7 +12,7 @@
));
// if unique ids already exist, the pages no longer have to be passed through
if (isset($result[0]) && isset($result[0]['count']) && $result[0]['count']) {
if (false && isset($result[0]) && isset($result[0]['count']) && $result[0]['count']) {
echo 'Already executed'.PHP_EOL;
return;
......@@ -44,7 +45,7 @@
$id = $id['id'];
try {
$Site = $Project->get($id);
$Site = new QUI\Projects\Site\Edit($Project, $id);
$areas = $Site->getAttribute('quiqqer.bricks.areas');
if ($areas === false) {
......@@ -59,10 +60,11 @@
echo $Project->getName().'-'.$Project->getLang().'-'.$id.PHP_EOL;
$Edit = $Site->getEdit();
$Edit->load();
$Edit->save(QUI::getUsers()->getSystemUser());
$Site->unlockWithRights();
$Site->load();
$Site->save(QUI::getUsers()->getSystemUser());
} catch (QUI\Exception $Exception) {
echo $Exception->getMessage().PHP_EOL;
continue;
}
}
......@@ -70,3 +72,23 @@
unset($Edit);
unset($Project);
}
echo 'Bricks saving...';
// alle bausteine speichern
$bricks = QUI::getDataBase()->fetch(array(
'from' => $Bricks->getTable()
));
foreach ($bricks as $brick) {
try {
$Brick = $Bricks->getBrickById($brick['id']);
$Bricks->saveBrick($brick['id'], $Brick->getAttributes());
} catch (QUI\Exception $Exception) {
QUI\System\Log::writeException($Exception);
echo $Exception->getMessage().PHP_EOL;
}
}
echo '[done]';
echo PHP_EOL;
......@@ -17,6 +17,8 @@
*/
class Events
{
protected static $saved = array();
/**
* Event : on site save
* Create site brick cache, for inheritance
......@@ -25,6 +27,10 @@ class Events
*/
public static function onSiteSave($Site)
{
if (isset(self::$saved[$Site->getId()])) {
return;
}
QUI\Permissions\Permission::checkPermission('quiqqer.bricks.assign');
$areas = $Site->getAttribute('quiqqer.bricks.areas');
......@@ -146,6 +152,8 @@ public static function onSiteSave($Site)
));
}
self::$saved[$Site->getId()] = true;
// save bricks with unique ids
$Site->setAttribute('quiqqer.bricks.areas', json_encode($areas));
$Site->save();
......
......@@ -470,7 +470,15 @@ public function getBrickByUID($uid)
$attributes = $data['attributes'];
$attributes = json_decode($attributes, true);
$Original = new Brick($attributes);
$real = QUI::getDataBase()->fetch(array(
'from' => $this->getTable(),
'where' => array(
'id' => (int)$brickId
),
'limit' => 1
));
$Original = new Brick($real[0]);
$Original->setAttribute('id', $brickId);
$Clone = clone $Original;
......@@ -838,7 +846,7 @@ public function saveBrick($brickId, array $brickData)
*
* @return String
*/
protected function getTable()
public static function getTable()
{
return QUI::getDBTableName(self::TABLE);
}
......
0% oder .
You are about to add 0 people to the discussion. Proceed with caution.
Bearbeitung dieser Nachricht zuerst beenden!
Bitte registrieren oder zum Kommentieren