В базе есть поле?
Да, есть
action_code enum('adding', 'change', 'remove') utf8_unicode_ci Да NULL
Попробуйте <value id="act_add">adding</value>
заменить на <value id="act_add">act_add</value>
и т.д.
не помогло
Фингя какая-то) Что-то с коннектом к базе может быть? Смотрите логи, у меня пока нет предположений.
Setup ещё раз прогоните что ли.
в логах ничего нету. коннект есть. другие изменения сохраняются…setup прогнал, не помогло
@vladimir в тулките вот такие сообщения…может какая нить вьюшка не создалась?
Class lnkFunctionalCIToTicket
Column 'action_code' in table 'lnkfunctionalcitoticket' is not used
Class RoutineChange
Column 'jira_id' in table 'change_routine' is not used
во вьюшке view_lnkFunctionalCIToTicket поле action_code есть
Конфиг тулкита и айтопа совпадают?
Да, совпадают
Может нужно что-нибудь добавить в класс
class _Ticket extends cmdbAbstractObject
в файле datamodels/2.x/itop-tickets/main.itop-tickets.php ?
Нет.
Выложите целиком свой модуль.
<?xml version="1.0" encoding="UTF-8"?>
<itop_design xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" version="1.0">
<constants>
</constants>
<classes>
<class id="lnkFunctionalCIToTicket">
<parent>cmdbAbstractObject</parent>
<properties>
<is_link>1</is_link>
<category>bizmodel</category>
<abstract>false</abstract>
<key_type>autoincrement</key_type>
<db_table>lnkfunctionalcitoticket</db_table>
<db_key_field>id</db_key_field>
<db_final_class_field/>
<naming>
<attributes>
<attribute id="ticket_id"/>
<attribute id="functionalci_id"/>
</attributes>
</naming>
<display_template/>
<icon/>
<reconciliation>
<attributes>
<attribute id="ticket_id"/>
<attribute id="functionalci_id"/>
</attributes>
</reconciliation>
</properties>
<fields _delta="redefine">
<field id="ticket_id" xsi:type="AttributeExternalKey">
<sql>ticket_id</sql>
<target_class>Ticket</target_class>
<is_null_allowed>false</is_null_allowed>
<on_target_delete>DEL_AUTO</on_target_delete>
</field>
<field id="ticket_ref" xsi:type="AttributeExternalField">
<extkey_attcode>ticket_id</extkey_attcode>
<target_attcode>ref</target_attcode>
</field>
<field id="ticket_title" xsi:type="AttributeExternalField">
<extkey_attcode>ticket_id</extkey_attcode>
<target_attcode>title</target_attcode>
</field>
<field id="functionalci_id" xsi:type="AttributeExternalKey">
<sql>functionalci_id</sql>
<target_class>FunctionalCI</target_class>
<is_null_allowed>false</is_null_allowed>
<on_target_delete>DEL_AUTO</on_target_delete>
</field>
<field id="functionalci_name" xsi:type="AttributeExternalField">
<extkey_attcode>functionalci_id</extkey_attcode>
<target_attcode>name</target_attcode>
</field>
<field id="impact" xsi:type="AttributeString">
<sql>impact</sql>
<default_value/>
<is_null_allowed>true</is_null_allowed>
</field>
<field id="impact_code" xsi:type="AttributeEnum">
<values>
<value id="manual">manual</value>
<value id="computed">computed</value>
<value id="not_impacted">not_impacted</value>
</values>
<sql>impact_code</sql>
<default_value>manual</default_value>
<is_null_allowed>false</is_null_allowed>
<display_style>list</display_style>
</field>
<field id="action_code" xsi:type="AttributeEnum" _delta="define">
<values>
<value id="act_add">act_add</value>
<value id="act_rem">act_rem</value>
<value id="act_chg">act_chg</value>
</values>
<sql>action_code</sql>
<default_value/>
<is_null_allowed>true</is_null_allowed>
<display_style>list</display_style>
</field>
</fields>
<methods/>
<presentation _delta="redefine">
<details>
<items>
<item id="ticket_id">
<rank>10</rank>
</item>
<item id="functionalci_id">
<rank>20</rank>
</item>
<item id="impact_code">
<rank>30</rank>
</item>
<item id="action_code">
<rank>40</rank>
</item>
</items>
</details>
<search>
<items>
<item id="ticket_id">
<rank>10</rank>
</item>
<item id="functionalci_id">
<rank>20</rank>
</item>
<item id="impact_code">
<rank>30</rank>
</item>
<item id="action_code">
<rank>40</rank>
</item>
</items>
</search>
<list>
<items>
<item id="ticket_id">
<rank>10</rank>
</item>
<item id="functionalci_id">
<rank>20</rank>
</item>
<item id="impact_code">
<rank>30</rank>
</item>
<item id="action_code">
<rank>40</rank>
</item>
</items>
</list>
</presentation>
</class>
</classes>
<menus>
</menus>
<user_rights>
<groups>
</groups>
<profiles>
</profiles>
</user_rights>
</itop_design>
Целиком модуль, все файлы в одной папке в одном архиве, а не только модель данных.
argadm0[13:17:07|action-ticket]$ ls -la
total 28
drwxrwxr-x 2 argadm argadm 4096 янв. 18 12:53 .
drwxrwxrwx 11 argadm argadm 4096 янв. 18 17:54 ..
-rw-rw-r-- 1 argadm argadm 4648 янв. 19 10:18 datamodel.action-ticket.xml
-rw-rw-r-- 1 argadm argadm 219 янв. 18 12:53 en.dict.action-ticket.php
-rw-rw-r-- 1 argadm argadm 656 янв. 18 12:53 model.action-ticket.php
-rw-rw-r-- 1 argadm argadm 981 янв. 18 18:25 module.action-ticket.php
module.action-ticket.php
<?php
//
// iTop module definition file
//
SetupWebPage::AddModule(
__FILE__, // Path to the current file, all other file names are relative to the directory containing this file
'action-ticket/1.0.0',
array(
// Identification
//
'label' => 'Action ticket',
'category' => 'business',
// Setup
//
'dependencies' => array(
'itop-tickets/2.2.0'
),
'mandatory' => false,
'visible' => true,
// Components
//
'datamodel' => array(
'model.action-ticket.php'
),
'webservice' => array(
),
'data.struct' => array(
// add your 'structure' definition XML files here,
),
'data.sample' => array(
// add your sample data XML files here,
),
// Documentation
//
'doc.manual_setup' => '', // hyperlink to manual setup documentation, if any
'doc.more_information' => '', // hyperlink to more information, if any
// Default settings
//
'settings' => array(
// Module specific settings go here, if any
),
)
);
?>
Словарь данных
<?php
/**
* Localized data
*
* @copyright Copyright (C) 2013 XXXXX
* @license http://opensource.org/licenses/AGPL-3.0
*/
Dict::Add('EN US', 'English', 'English', array(
// Dictionary entries go here
));
?>
model.action-ticket.php в нем почему то нет закрывающего тэга php
<?php
// PHP Data Model definition file
// WARNING - WARNING - WARNING
// DO NOT EDIT THIS FILE (unless you know what you are doing)
//
// If you use supply a datamodel.xxxx.xml file with your module
// the this file WILL BE overwritten by the compilation of the
// module (during the setup) if the datamodel.xxxx.xml file
// contains the definition of new classes or menus.
//
// The recommended way to define new classes (for iTop 2.0) is via the XML definition.
// This file remains in the module's template only for the cases where there is:
// - either no new class or menu defined in the XML file
// - or no XML file at all supplied by the module
Проблема в методе UpdateImpactedItems()
класса _Ticket
. Это метод вызывается при сохранении Изменения и пытается дополнить связанные КЕ с учетом влияние тех, которые уже указаны во вкладке, после чего обновляет список КЕ. О вашем новом поле этому методу ничего не известно, поэтому это поле остается пустым.
И как правильно в методе объявить новое поле?
Нужно в классе Ticket (чтобы это распространялось на все типы тикетов) переопределить этот метод внутри тегов methods. В коде метода нужно найти место, где формируется новый перечень линков lnkFunctionalCIToTicket, и там выставлять значение поля aсtion_code.
@vladimir я не знаю как правильно это сделать
Это класс которы определен в файле env-production/itop-tickets/main.itop-tickets.php ?
Это делать в своем модуле?
Нет, там код метода. Класс Ticket (не _Ticket) в datamodel.itop-tickets.xml.
Да.