Skip to content

Commit

Permalink
Merge remote-tracking branch 'refs/remotes/origin/feature_channel_edu…
Browse files Browse the repository at this point in the history
…thek-neu'
  • Loading branch information
prowebat committed Aug 4, 2024
2 parents 31f6397 + 0bbf88f commit 0b49d82
Showing 1 changed file with 9 additions and 15 deletions.
24 changes: 9 additions & 15 deletions classes/package.php
Original file line number Diff line number Diff line change
Expand Up @@ -838,22 +838,16 @@ public function store_package($data) {
'eta' => 'etapas'
];
if (empty($this->get('id'))) {
$id = $DB->insert_record('block_edupublisher_packages', $this->get_channel('_'));
$this->set($id, 'id');
foreach ($subtables as $subtable => $channel) {
if (!$DB->record_exists("block_edupublisher_md_{$subtable}", [ 'package' => $data->package ])) {
$this->set($data->id, 'package', $channel);
$id = $DB->insert_record("block_edupublisher_md_{$subtable}", $this->get_channel($channel, true));
$this->set($id, 'id', $channel);
}
}
$packageid = $DB->insert_record('block_edupublisher_packages', $this->get_channel('_'));
$this->set($packageid, 'id');
} else {
foreach ($subtables as $subtable => $channel) {
if ($DB->record_exists("block_edupublisher_md_{$subtable}", [ 'package' => $data->package ])) {
$this->set($data->id, 'package', $channel);
$id = $DB->insert_record("block_edupublisher_md_{$subtable}", $this->get_channel($channel, true));
$this->set($id, 'id', $channel);
}
$packageid = $this->get('id');
}
foreach ($subtables as $subtable => $channel) {
if (!$DB->record_exists("block_edupublisher_md_{$subtable}", [ 'package' => $packageid ])) {
$this->set($packageid, 'package', $channel);
$id = $DB->insert_record("block_edupublisher_md_{$subtable}", $this->get_channel($channel, true));
$this->set($id, 'id', $channel);
}
}

Expand Down

0 comments on commit 0b49d82

Please sign in to comment.