*
* Generated from xml/schema/CRM/Contact/DashboardContact.xml
* DO NOT EDIT. Generated by CRM_Core_CodeGen
- * (GenCodeChecksum:73ab6a9a4f5d372c85b888aae2abe826)
+ * (GenCodeChecksum:2b31333980964ba3394f0c71cc764a9d)
*/
/**
/**
* Is this widget active?
*
- * @var bool|string|null
+ * @var bool|string
* (SQL type: tinyint)
* Note that values will be retrieved from the database as a string.
*/
'type' => CRM_Utils_Type::T_BOOLEAN,
'title' => ts('Dashlet is Active?'),
'description' => ts('Is this widget active?'),
+ 'required' => TRUE,
'usage' => [
'import' => FALSE,
'export' => FALSE,
$this->addTask('Update civicrm_managed.name', 'alterColumn', 'civicrm_managed', 'name', "varchar(255) NOT NULL COMMENT 'Symbolic name used by the module to identify the object'");
$this->addTask('Update civicrm_managed.cleanup', 'alterColumn', 'civicrm_managed', 'cleanup', "varchar(16) NOT NULL DEFAULT 'always' COMMENT 'Policy on when to cleanup entity (always, never, unused)'");
$this->addTask('Update civicrm_acl.is_active', 'alterColumn', 'civicrm_acl', 'is_active', "tinyint NOT NULL DEFAULT 1 COMMENT 'Is this property active?'");
+ $this->addTask('Update civicrm_dashboard_contact.is_active', 'alterColumn', 'civicrm_dashboard_contact', 'is_active', "tinyint NOT NULL DEFAULT 0 COMMENT 'Is this widget active?'");
}
}
{* file to handle db changes in 5.68.alpha1 during upgrade *}
UPDATE `civicrm_acl` SET `is_active` = 0 WHERE `is_active` IS NULL;
+UPDATE `civicrm_dashboard_contact` SET `is_active` = 0 WHERE `is_active` IS NULL;
UPDATE `civicrm_tag` SET `label` = `name` WHERE `label` = '';
--- /dev/null
+<?php
+
+/*
+ +--------------------------------------------------------------------+
+ | Copyright CiviCRM LLC. All rights reserved. |
+ | |
+ | This work is published under the GNU AGPLv3 license with some |
+ | permitted exceptions and without any warranty. For full license |
+ | and copyright information, see https://civicrm.org/licensing |
+ +--------------------------------------------------------------------+
+ */
+
+namespace Civi\Api4\Service\Spec\Provider;
+
+use Civi\Api4\Service\Spec\RequestSpec;
+
+/**
+ * @service
+ * @internal
+ */
+class DashboardCreationSpecProvider extends \Civi\Core\Service\AutoService implements Generic\SpecProviderInterface {
+
+ /**
+ * @inheritDoc
+ */
+ public function modifySpec(RequestSpec $spec) {
+ // Arguably this is a bad default in the schema
+ $spec->getFieldByName('is_active')->setRequired(FALSE)->setDefaultValue(TRUE);
+ }
+
+ /**
+ * @inheritDoc
+ */
+ public function applies($entity, $action) {
+ return in_array($entity, ['Dashboard', 'DashboardContact'], TRUE) && $action === 'create';
+ }
+
+}
$spec->getFieldByName('title')->setRequiredIf('empty($values.is_template)');
$spec->getFieldByName('start_date')->setRequiredIf('empty($values.is_template)');
$spec->getFieldByName('template_title')->setRequiredIf('!empty($values.is_template)');
+ // Arguably this is a bad default in the schema
+ $spec->getFieldByName('is_active')->setRequired(FALSE)->setDefaultValue(TRUE);
$template_id = (new FieldSpec('template_id', 'Event', 'Integer'))
->setTitle(ts('Event Template'))
<field>
<name>is_active</name>
<type>boolean</type>
+ <required>true</required>
<title>Dashlet is Active?</title>
<comment>Is this widget active?</comment>
+ <!-- FIXME - nonstandard default for is_active -->
<default>0</default>
<html>
<type>CheckBox</type>
<type>boolean</type>
<title>Is Dashlet Active?</title>
<comment>Is this dashlet active?</comment>
+ <!-- FIXME - nonstandard default for is_active -->
<default>0</default>
<html>
<type>CheckBox</type>
<title>Is Active</title>
<type>boolean</type>
<required>true</required>
+ <!-- FIXME - nonstandard default for is_active -->
<default>0</default>
<comment>Is this Event enabled or disabled/cancelled?</comment>
<add>1.7</add>