116896b584
Generic: Project CI / Tests (push) Blocked by required conditions
Generic: Repo Health / Scripts governance (push) Blocked by required conditions
Generic: Repo Health / Repository health (push) Blocked by required conditions
Generic: Repo Health / Report Issues (push) Blocked by required conditions
Generic: Repo Health / Site Health (push) Has been skipped
Generic: Repo Health / Access control (push) Successful in 1s
Universal: Auto Version Bump / Version Bump (push) Successful in 3s
Generic: Project CI / Lint & Validate (push) Successful in 11s
Update Server / Update Server (push) Successful in 11s
Completes the MokoJoomCross → MokoSuiteCross rebrand across all language string keys, Joomla event names, documentation, and wiki pages. - 1,151 language key references renamed (COM_, PLG_, PKG_ prefixes) - Event names renamed (onMokoJoomCross* → onMokoSuiteCross*) - CLAUDE.md, CHANGELOG.md, wiki docs updated - Zero mokojoomcross references remaining in codebase Closes #128, closes #138
94 lines
2.4 KiB
PHP
94 lines
2.4 KiB
PHP
<?php
|
|
|
|
/**
|
|
* @package MokoSuiteCross
|
|
* @subpackage com_mokosuitecross
|
|
* @author Moko Consulting <hello@mokoconsulting.tech>
|
|
* @copyright Copyright (C) 2026 Moko Consulting. All rights reserved.
|
|
* @license GNU General Public License version 3 or later; see LICENSE
|
|
* SPDX-License-Identifier: GPL-3.0-or-later
|
|
*/
|
|
|
|
namespace Joomla\Component\MokoSuiteCross\Administrator\Model;
|
|
|
|
defined('_JEXEC') or die;
|
|
|
|
use Joomla\CMS\Factory;
|
|
use Joomla\CMS\MVC\Model\AdminModel;
|
|
|
|
class PostModel extends AdminModel
|
|
{
|
|
public function getForm($data = [], $loadData = true)
|
|
{
|
|
$form = $this->loadForm(
|
|
'com_mokosuitecross.post',
|
|
'post',
|
|
['control' => 'jform', 'load_data' => $loadData]
|
|
);
|
|
|
|
if (empty($form)) {
|
|
return false;
|
|
}
|
|
|
|
// Lock article_id and service_id on existing records
|
|
$id = $this->getState('post.id', 0);
|
|
|
|
if ($id > 0) {
|
|
$form->setFieldAttribute('article_id', 'readonly', 'true');
|
|
$form->setFieldAttribute('service_id', 'readonly', 'true');
|
|
}
|
|
|
|
return $form;
|
|
}
|
|
|
|
protected function loadFormData()
|
|
{
|
|
return $this->getItem();
|
|
}
|
|
|
|
/**
|
|
* Prepare and sanitise the table prior to saving.
|
|
*/
|
|
protected function prepareTable($table)
|
|
{
|
|
$now = Factory::getDate()->toSql();
|
|
|
|
// Validate scheduled_at datetime format
|
|
if (!empty($table->scheduled_at)) {
|
|
try {
|
|
$date = Factory::getDate($table->scheduled_at);
|
|
$table->scheduled_at = $date->toSql();
|
|
} catch (\Throwable $e) {
|
|
$table->scheduled_at = null;
|
|
}
|
|
}
|
|
|
|
if (empty($table->id)) {
|
|
$table->created = $now;
|
|
$table->modified = $now;
|
|
|
|
if (empty($table->status)) {
|
|
$table->status = empty($table->scheduled_at) ? 'queued' : 'scheduled';
|
|
}
|
|
|
|
if (empty($table->retry_count)) {
|
|
$table->retry_count = 0;
|
|
}
|
|
|
|
if (empty($table->platform_post_id)) {
|
|
$table->platform_post_id = '';
|
|
}
|
|
|
|
if (empty($table->platform_response)) {
|
|
$table->platform_response = '';
|
|
}
|
|
|
|
if (empty($table->error_message)) {
|
|
$table->error_message = '';
|
|
}
|
|
} else {
|
|
$table->modified = $now;
|
|
}
|
|
}
|
|
}
|