Skip to content

Commit

Permalink
Merge branch '4.0-dev' into 4.0-dev-fix-todo
Browse files Browse the repository at this point in the history
  • Loading branch information
wilsonge committed Feb 4, 2019
2 parents 9b438ed + b701566 commit 4749bb1
Show file tree
Hide file tree
Showing 6 changed files with 34 additions and 36 deletions.
8 changes: 2 additions & 6 deletions administrator/components/com_content/Model/ArticleModel.php
Original file line number Diff line number Diff line change
Expand Up @@ -137,9 +137,6 @@ protected function batchCopy($value, $pks, $contexts)
// Reset hits because we are making a copy
$this->table->hits = 0;

// Unpublish because we are making a copy
$this->table->state = 0;

// New category ID
$this->table->catid = $categoryId;

Expand Down Expand Up @@ -429,12 +426,12 @@ protected function canEditState($record)
protected function prepareTable($table)
{
// Set the publish date to now
if ($table->state == 1 && (int) $table->publish_up == 0)
if ($table->state == Workflow::CONDITION_PUBLISHED && (int) $table->publish_up == 0)
{
$table->publish_up = Factory::getDate()->toSql();
}

if ($table->state == 1 && intval($table->publish_down) == 0)
if ($table->state == Workflow::CONDITION_PUBLISHED && intval($table->publish_down) == 0)
{
$table->publish_down = $this->getDbo()->getNullDate();
}
Expand Down Expand Up @@ -960,7 +957,6 @@ public function save($data)
}

$data['state'] = (int) $stage->condition;

}

// Automatic handling of alias for empty fields
Expand Down
5 changes: 3 additions & 2 deletions administrator/components/com_content/Service/HTML/Icon.php
Original file line number Diff line number Diff line change
Expand Up @@ -18,6 +18,7 @@
use Joomla\CMS\Layout\LayoutHelper;
use Joomla\CMS\Router\Route;
use Joomla\CMS\Uri\Uri;
use Joomla\CMS\Workflow\Workflow;
use Joomla\Component\Mailto\Site\Helper\MailtoHelper;
use Joomla\Registry\Registry;

Expand Down Expand Up @@ -146,7 +147,7 @@ public function edit($article, $params, $attribs = array(), $legacy = false)
}

// Ignore if the state is negative (trashed).
if ($article->state < 0)
if (!in_array($article->state, [Workflow::CONDITION_UNPUBLISHED, Workflow::CONDITION_PUBLISHED]))
{
return;
}
Expand Down Expand Up @@ -175,7 +176,7 @@ public function edit($article, $params, $attribs = array(), $legacy = false)
$contentUrl = \ContentHelperRoute::getArticleRoute($article->slug, $article->catid, $article->language);
$url = $contentUrl . '&task=article.edit&a_id=' . $article->id . '&return=' . base64_encode($uri);

if ($article->state == 0)
if ($article->state == Workflow::CONDITION_UNPUBLISHED)
{
$overlib = Text::_('JUNPUBLISHED');
}
Expand Down
4 changes: 2 additions & 2 deletions administrator/components/com_finder/sql/install.mysql.sql
Original file line number Diff line number Diff line change
Expand Up @@ -74,8 +74,8 @@ CREATE TABLE IF NOT EXISTS `#__finder_logging` (
`searchterm` VARCHAR(255) NOT NULL DEFAULT '',
`md5sum` VARCHAR(32) NOT NULL DEFAULT '',
`query` BLOB NOT NULL,
`hits` INT(11) NOT NULL DEFAULT '1',
`results` INT(11) NOT NULL DEFAULT '0',
`hits` INT(11) NOT NULL DEFAULT 1,
`results` INT(11) NOT NULL DEFAULT 0,
UNIQUE INDEX `md5sum` (`md5sum`),
INDEX `searchterm` (`searchterm`)
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 DEFAULT COLLATE=utf8mb4_general_ci;
Expand Down
7 changes: 4 additions & 3 deletions components/com_content/tmpl/featured/default_item.php
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,7 @@
use Joomla\CMS\Layout\LayoutHelper;
use Joomla\CMS\Router\Route;
use Joomla\CMS\Uri\Uri;
use Joomla\CMS\Workflow\Workflow;

// Create a shortcut for params.
$params = &$this->item->params;
Expand All @@ -31,7 +32,7 @@
<?php endif; ?>

<div class="item-content">
<?php if ($this->item->state == 0 || strtotime($this->item->publish_up) > strtotime(Factory::getDate())
<?php if ($this->item->state == Workflow::CONDITION_UNPUBLISHED || strtotime($this->item->publish_up) > strtotime(Factory::getDate())
|| ((strtotime($this->item->publish_down) < strtotime(Factory::getDate())) && $this->item->publish_down != Factory::getDbo()->getNullDate())) : ?>
<div class="system-unpublished">
<?php endif; ?>
Expand All @@ -48,7 +49,7 @@
</h2>
<?php endif; ?>

<?php if ($this->item->state == 0) : ?>
<?php if ($this->item->state == Workflow::CONDITION_UNPUBLISHED) : ?>
<span class="badge badge-warning"><?php echo Text::_('JUNPUBLISHED'); ?></span>
<?php endif; ?>
<?php if (strtotime($this->item->publish_up) > strtotime(Factory::getDate())) : ?>
Expand Down Expand Up @@ -103,7 +104,7 @@

<?php endif; ?>

<?php if ($this->item->state == 0 || strtotime($this->item->publish_up) > strtotime(Factory::getDate())
<?php if ($this->item->state == Workflow::CONDITION_UNPUBLISHED || strtotime($this->item->publish_up) > strtotime(Factory::getDate())
|| ((strtotime($this->item->publish_down) < strtotime(Factory::getDate())) && $this->item->publish_down != $this->db->getNullDate() )) : ?>
</div>
<?php endif; ?>
Expand Down
34 changes: 17 additions & 17 deletions installation/sql/mysql/joomla.sql
Original file line number Diff line number Diff line change
Expand Up @@ -699,19 +699,19 @@ CREATE TABLE IF NOT EXISTS `#__fields` (
`type` varchar(255) NOT NULL DEFAULT 'text',
`note` varchar(255) NOT NULL DEFAULT '',
`description` text NOT NULL,
`state` tinyint(1) NOT NULL DEFAULT '0',
`required` tinyint(1) NOT NULL DEFAULT '0',
`checked_out` int(11) NOT NULL DEFAULT '0',
`state` tinyint(1) NOT NULL DEFAULT 0,
`required` tinyint(1) NOT NULL DEFAULT 0,
`checked_out` int(11) NOT NULL DEFAULT 0,
`checked_out_time` datetime NOT NULL DEFAULT '0000-00-00 00:00:00',
`ordering` int(11) NOT NULL DEFAULT '0',
`ordering` int(11) NOT NULL DEFAULT 0,
`params` text NOT NULL,
`fieldparams` text NOT NULL,
`language` char(7) NOT NULL DEFAULT '',
`created_time` datetime NOT NULL DEFAULT '0000-00-00 00:00:00',
`created_user_id` int(10) unsigned NOT NULL DEFAULT '0',
`created_user_id` int(10) unsigned NOT NULL DEFAULT 0,
`modified_time` datetime NOT NULL DEFAULT '0000-00-00 00:00:00',
`modified_by` int(10) unsigned NOT NULL DEFAULT '0',
`access` int(11) NOT NULL DEFAULT '1',
`modified_by` int(10) unsigned NOT NULL DEFAULT 0,
`access` int(11) NOT NULL DEFAULT 1,
PRIMARY KEY (`id`),
KEY `idx_checkout` (`checked_out`),
KEY `idx_state` (`state`),
Expand Down Expand Up @@ -746,17 +746,17 @@ CREATE TABLE IF NOT EXISTS `#__fields_groups` (
`title` varchar(255) NOT NULL DEFAULT '',
`note` varchar(255) NOT NULL DEFAULT '',
`description` text NOT NULL,
`state` tinyint(1) NOT NULL DEFAULT '0',
`checked_out` int(11) NOT NULL DEFAULT '0',
`state` tinyint(1) NOT NULL DEFAULT 0,
`checked_out` int(11) NOT NULL DEFAULT 0,
`checked_out_time` datetime NOT NULL DEFAULT '0000-00-00 00:00:00',
`ordering` int(11) NOT NULL DEFAULT '0',
`ordering` int(11) NOT NULL DEFAULT 0,
`params` text NOT NULL,
`language` char(7) NOT NULL DEFAULT '',
`created` datetime NOT NULL DEFAULT '0000-00-00 00:00:00',
`created_by` int(10) unsigned NOT NULL DEFAULT '0',
`created_by` int(10) unsigned NOT NULL DEFAULT 0,
`modified` datetime NOT NULL DEFAULT '0000-00-00 00:00:00',
`modified_by` int(10) unsigned NOT NULL DEFAULT '0',
`access` int(11) NOT NULL DEFAULT '1',
`modified_by` int(10) unsigned NOT NULL DEFAULT 0,
`access` int(11) NOT NULL DEFAULT 1,
PRIMARY KEY (`id`),
KEY `idx_checkout` (`checked_out`),
KEY `idx_state` (`state`),
Expand Down Expand Up @@ -864,8 +864,8 @@ CREATE TABLE IF NOT EXISTS `#__finder_logging` (
`searchterm` VARCHAR(255) NOT NULL DEFAULT '',
`md5sum` VARCHAR(32) NOT NULL DEFAULT '',
`query` BLOB NOT NULL,
`hits` INT(11) NOT NULL DEFAULT '1',
`results` INT(11) NOT NULL DEFAULT '0',
`hits` INT(11) NOT NULL DEFAULT 1,
`results` INT(11) NOT NULL DEFAULT 0,
PRIMARY KEY `md5sum` (`md5sum`),
INDEX `searchterm` (`searchterm`(191))
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 DEFAULT COLLATE=utf8mb4_general_ci;
Expand Down Expand Up @@ -1234,7 +1234,7 @@ CREATE TABLE IF NOT EXISTS `#__menu_types` (
`menutype` varchar(24) NOT NULL,
`title` varchar(48) NOT NULL,
`description` varchar(255) NOT NULL DEFAULT '',
`client_id` int(11) NOT NULL DEFAULT '0',
`client_id` int(11) NOT NULL DEFAULT 0,
PRIMARY KEY (`id`),
UNIQUE KEY `idx_menutype` (`menutype`)
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 DEFAULT COLLATE=utf8mb4_unicode_ci;
Expand Down Expand Up @@ -1440,7 +1440,7 @@ CREATE TABLE IF NOT EXISTS `#__postinstall_messages` (
`description_key` varchar(255) NOT NULL DEFAULT '' COMMENT 'Lang key for description',
`action_key` varchar(255) NOT NULL DEFAULT '',
`language_extension` varchar(255) NOT NULL DEFAULT 'com_postinstall' COMMENT 'Extension holding lang keys',
`language_client_id` tinyint(3) NOT NULL DEFAULT '1',
`language_client_id` tinyint(3) NOT NULL DEFAULT 1,
`type` varchar(10) NOT NULL DEFAULT 'link' COMMENT 'Message type - message, link, action',
`action_file` varchar(255) DEFAULT '' COMMENT 'RAD URI to the PHP file containing action method',
`action` varchar(255) DEFAULT '' COMMENT 'Action method name or URL',
Expand Down
12 changes: 6 additions & 6 deletions installation/sql/postgresql/joomla.sql
Original file line number Diff line number Diff line change
Expand Up @@ -754,17 +754,17 @@ CREATE TABLE IF NOT EXISTS "#__fields_groups" (
"title" varchar(255) DEFAULT '' NOT NULL,
"note" varchar(255) DEFAULT '' NOT NULL,
"description" text NOT NULL,
"state" smallint DEFAULT '0' NOT NULL,
"checked_out" integer DEFAULT '0' NOT NULL,
"state" smallint DEFAULT 0 NOT NULL,
"checked_out" integer DEFAULT 0 NOT NULL,
"checked_out_time" timestamp without time zone DEFAULT '1970-01-01 00:00:00' NOT NULL,
"ordering" integer DEFAULT '0' NOT NULL,
"ordering" integer DEFAULT 0 NOT NULL,
"params" text DEFAULT '' NOT NULL,
"language" varchar(7) DEFAULT '' NOT NULL,
"created" timestamp without time zone DEFAULT '1970-01-01 00:00:00' NOT NULL,
"created_by" bigint DEFAULT '0' NOT NULL,
"created_by" bigint DEFAULT 0 NOT NULL,
"modified" timestamp without time zone DEFAULT '1970-01-01 00:00:00' NOT NULL,
"modified_by" bigint DEFAULT '0' NOT NULL,
"access" bigint DEFAULT '1' NOT NULL,
"modified_by" bigint DEFAULT 0 NOT NULL,
"access" bigint DEFAULT 1 NOT NULL,
PRIMARY KEY ("id")
);
CREATE INDEX "#__fields_groups_idx_checked_out" ON "#__fields_groups" ("checked_out");
Expand Down

0 comments on commit 4749bb1

Please sign in to comment.