I'm trying to add a new field to the Person class and can't seem to get it to work. Last month I successfully added several fields to PC class and they are working fine. That was done under iTop-2.0.3-1916. I've since upgraded to iTop-2.1.0-beta-2045 (not in production yet). I THINK I'm following the same process I used before but I'm still pretty new to iTop.
I created anew extension module that contains the updates to PC and I'm trying to add my updates to Person in that module as well. When I go through adding the Person new fields (using /toolkt), I don't get any errors shown and then I click on 'Update iTop code' and all seems well then.
However, when I go back into iTop and get a list of contacts (via search) and then click on one I throws an SQL error:
Fatal error, iTop cannot continue.
Error: Failed to issue SQL query: query = SELECT DISTINCT Person_person.id AS Personid, Person_contact.name AS Personname, Person_contact.status AS Personstatus, Person_contact.org_id AS Personorg_id, Organization_org_id_organization.name AS Personorg_name, Person_contact.email AS Personemail, Person_contact.phone AS Personphone, Person_contact.notify AS Personnotify, Person_contact.function AS Personfunction, Person_person.first_name AS Personfirst_name, Person_person.employee_number AS Personemployee_number, Person_person.mobile_phone AS Personmobile_phone, Person_person.location_id AS Personlocation_id, Location_location_id_location.name AS Personlocation_name, Person_person.manager_id AS Personmanager_id, Person_manager_id_contact.name AS Personmanager_name, Person_person.officeNumber AS PersonofficeNumber, Person_contact.finalclass AS Personfinalclass, CAST(CONCAT(COALESCE(Person_person.first_name, ''), COALESCE(' ', ''), COALESCE(Person_contact.name, '')) AS CHAR) AS Personfriendlyname, CAST(CONCAT(COALESCE(Organization_org_id_organization.name, '')) AS CHAR) AS Personorg_id_friendlyname, CAST(CONCAT(COALESCE(Location_location_id_location.name, '')) AS CHAR) AS Personlocation_id_friendlyname, CAST(CONCAT(COALESCE(Person_manager_id_person.first_name, ''), COALESCE(' ', ''), COALESCE(Person_manager_id_contact.name, '')) AS CHAR) AS Personmanager_id_friendlyname FROM person AS Person_personLEFT JOIN (location AS Location_location_id_location ) ON Person_person.location_id = Location_location_id_location.idLEFT JOIN (person AS Person_manager_id_person INNER JOIN (contact AS Person_manager_id_contact ) ON Person_manager_id_person.id = Person_manager_id_contact.id) ON Person_person.manager_id = Person_manager_id_person.idINNER JOIN (contact AS Person_contact INNER JOIN (organization AS Organization_org_id_organization ) ON Person_contact.org_id = Organization_org_id_organization.id) ON Person_person.id = Person_contact.id WHERE (Person_person.id = '3') , mysql_error = Unknown column 'Person_person.officeNumber' in 'field list', mysql_errno = 1054.
I seem to recall when I added the new fields to the PC CI the toolkit process gave me an indication it was going to modify a table (not 100% sure of that) but I don't see any indication of this now when trying to add fields to Person. I've verified via MySQL cmd line that the column is NOT added to the table.
I know i'm now doing this under the 2.1 beta (which I suppose could be the issue) but I'm thinking I'm missing something in my extension files. I thought/hoped I'd be able to figure this out but i'm not making any progress on it. Any help in pointing me in the right direction is most appreciated.
Sorry for the long post.
gene
If you would like to refer to this comment somewhere else in this project, copy and paste the following link:
I'm not sure what I did wrong initially, but since I am still evaluating iTop and all the data in the database I had imported via CSV files, I started over with a fresh install, installed the toolkit, added my new module, and it worked.
If you would like to refer to this comment somewhere else in this project, copy and paste the following link:
I suspect that there is some kind of "caching" issue with iTop at times. I ran into similar problems earlier in the year and solved it in pretty much the same way.
If you would like to refer to this comment somewhere else in this project, copy and paste the following link:
I'm trying to add a new field to the Person class and can't seem to get it to work. Last month I successfully added several fields to PC class and they are working fine. That was done under iTop-2.0.3-1916. I've since upgraded to iTop-2.1.0-beta-2045 (not in production yet). I THINK I'm following the same process I used before but I'm still pretty new to iTop.
I created anew extension module that contains the updates to PC and I'm trying to add my updates to Person in that module as well. When I go through adding the Person new fields (using /toolkt), I don't get any errors shown and then I click on 'Update iTop code' and all seems well then.
However, when I go back into iTop and get a list of contacts (via search) and then click on one I throws an SQL error:
Fatal error, iTop cannot continue.
Error: Failed to issue SQL query: query = SELECT DISTINCT
Person_person
.id
ASPersonid
,Person_contact
.name
ASPersonname
,Person_contact
.status
ASPersonstatus
,Person_contact
.org_id
ASPersonorg_id
,Organization_org_id_organization
.name
ASPersonorg_name
,Person_contact
.email
ASPersonemail
,Person_contact
.phone
ASPersonphone
,Person_contact
.notify
ASPersonnotify
,Person_contact
.function
ASPersonfunction
,Person_person
.first_name
ASPersonfirst_name
,Person_person
.employee_number
ASPersonemployee_number
,Person_person
.mobile_phone
ASPersonmobile_phone
,Person_person
.location_id
ASPersonlocation_id
,Location_location_id_location
.name
ASPersonlocation_name
,Person_person
.manager_id
ASPersonmanager_id
,Person_manager_id_contact
.name
ASPersonmanager_name
,Person_person
.officeNumber
ASPersonofficeNumber
,Person_contact
.finalclass
ASPersonfinalclass
, CAST(CONCAT(COALESCE(Person_person
.first_name
, ''), COALESCE(' ', ''), COALESCE(Person_contact
.name
, '')) AS CHAR) ASPersonfriendlyname
, CAST(CONCAT(COALESCE(Organization_org_id_organization
.name
, '')) AS CHAR) ASPersonorg_id_friendlyname
, CAST(CONCAT(COALESCE(Location_location_id_location
.name
, '')) AS CHAR) ASPersonlocation_id_friendlyname
, CAST(CONCAT(COALESCE(Person_manager_id_person
.first_name
, ''), COALESCE(' ', ''), COALESCE(Person_manager_id_contact
.name
, '')) AS CHAR) ASPersonmanager_id_friendlyname
FROMperson
ASPerson_person
LEFT JOIN (location
ASLocation_location_id_location
) ONPerson_person
.location_id
=Location_location_id_location
.id
LEFT JOIN (person
ASPerson_manager_id_person
INNER JOIN (contact
ASPerson_manager_id_contact
) ONPerson_manager_id_person
.id
=Person_manager_id_contact
.id
) ONPerson_person
.manager_id
=Person_manager_id_person
.id
INNER JOIN (contact
ASPerson_contact
INNER JOIN (organization
ASOrganization_org_id_organization
) ONPerson_contact
.org_id
=Organization_org_id_organization
.id
) ONPerson_person
.id
=Person_contact
.id
WHERE (Person_person
.id
= '3') , mysql_error = Unknown column 'Person_person.officeNumber' in 'field list', mysql_errno = 1054.Here is what is in the pertinent files:
en.dict.hcta-extensions.php:
~~~~~~
'HCTA Information', 'Class:PC/Attribute:purchasePrice' => 'Purchase Price', 'Class:PC/Attribute:purchasePrice+' => '', 'Class:PC/Attribute:POnumber' => 'PO Number', 'Class:PC/Attribute:POnumber+' => '', 'Class:PC/Attribute:maintSupplier' => 'Maintenance Supplier', 'Class:PC/Attribute:maintSupplier+' => '', 'Class:PC/Attribute:leased' => 'Leased?', 'Class:PC/Attribute:leased+' => '', 'Class:PC/Attribute:fixedAsset' => 'Fixed Asset?', 'Class:PC/Attribute:fixedAsset+' => '', 'Class:PC/Attribute:maintRenewalAmount' => 'Maintenance Renewal Amount', 'Class:PC/Attribute:maintRenewalAmount+' => '', 'Class:PC/Attribute:leaseEndDate' => 'Lease End Date', 'Class:PC/Attribute:leaseEndDate+' => '', 'Class:PC/Attribute:assetVendor' => 'Asset Vendor', 'Class:PC/Attribute:assetVendor+' => '', 'Person:hctainfo' => 'HCTA Information', 'Class:Person/Attribute:officeNumber' => 'Office Number', 'Class:Person/Attribute:officeNumber+' => '', )); ?><itop_design xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" version="1.0">
<constants>
</constants>
<classes>
<class id="user-content-PC">
<fields>
<field id="user-content-purchasePrice" xsi:type="AttributeDecimal" _delta="define">
<sql>purchasePrice</sql>
<default_value>
<is_null_allowed>true</is_null_allowed>
<digits>9</digits>
<decimals>2</decimals>
</default_value></field>
<field id="user-content-POnumber" xsi:type="AttributeInteger" _delta="define">
<sql>POnumber</sql>
<default_value>
<is_null_allowed>true</is_null_allowed>
</default_value></field>
<field id="user-content-maintSupplier" xsi:type="AttributeString" _delta="define">
<sql>maintSupplier</sql>
<default_value>
<is_null_allowed>true</is_null_allowed>
</default_value></field>
<field id="user-content-fixedAsset" xsi:type="AttributeEnum" _delta="define">
<sql>fixedAsset</sql>
<default_value>no</default_value>
<is_null_allowed>no</is_null_allowed>
<display_style>list</display_style>
<values>
<value>no</value>
<value>yes</value>
</values>
</field>
<field id="user-content-leased" xsi:type="AttributeEnum" _delta="define">
<sql>leased</sql>
<default_value>no</default_value>
<is_null_allowed>no</is_null_allowed>
<display_style>list</display_style>
<values>
<value>no</value>
<value>yes</value>
</values>
</field>
<field id="user-content-maintRenewalAmount" xsi:type="AttributeDecimal" _delta="define">
<sql>maintRenewalAmount</sql>
<default_value>
<is_null_allowed>true</is_null_allowed>
<digits>9</digits>
<decimals>2</decimals>
</default_value></field>
<field id="user-content-leaseEndDate" xsi:type="AttributeDate" _delta="define">
<sql>leaseEndDatea</sql>
<default_value>
<is_null_allowed>true</is_null_allowed>
</default_value></field>
<field id="user-content-assetVendor" xsi:type="AttributeString" _delta="define">
<sql>assetVendor</sql>
<default_value>
<is_null_allowed>true</is_null_allowed>
</default_value></field>
</fields>
<presentation>
</presentation></class></classes></itop_design>
<items>
<item id="user-content-softwares_list">
<rank>5</rank>
</item>
<item id="user-content-contacts_list">
<rank>10</rank>
</item>
<item id="user-content-documents_list">
<rank>20</rank>
</item>
<item id="user-content-tickets_list">
<rank>30</rank>
</item>
<item id="user-content-physicalinterface_list">
<rank>40</rank>
</item>
<item id="user-content-networkdevice_list">
<rank>50</rank>
</item>
<item id="user-content-providercontracts_list">
<rank>60</rank>
</item>
<item id="user-content-services_list">
<rank>70</rank>
</item>
<item id="user-content-col:col1">
<rank>80</rank>
<items>
<item id="user-content-fieldset:Server:baseinfo">
<rank>10</rank>
<items>
<item id="user-content-name">
<rank>10</rank>
</item>
<item id="user-content-org_id">
<rank>20</rank>
</item>
<item id="user-content-status">
<rank>30</rank>
</item>
<item id="user-content-business_criticity">
<rank>40</rank>
</item>
<item id="user-content-location_id">
<rank>50</rank>
</item>
</items>
</item>
<item id="user-content-fieldset:Server:moreinfo">
<rank>20</rank>
<items>
<item id="user-content-brand_id">
<rank>10</rank>
</item>
<item id="user-content-model_id">
<rank>20</rank>
</item>
<item id="user-content-osfamily_id">
<rank>30</rank>
</item>
<item id="user-content-osversion_id">
<rank>40</rank>
</item>
<item id="user-content-type">
<rank>50</rank>
</item>
<item id="user-content-cpu">
<rank>60</rank>
</item>
<item id="user-content-ram">
<rank>70</rank>
</item>
<item id="user-content-serialnumber">
<rank>80</rank>
</item>
<item id="user-content-asset_number">
<rank>90</rank>
</item>
</items>
</item>
</items>
</item>
<item id="user-content-col:col2">
<rank>90</rank>
<items>
<item id="user-content-fieldset:Server:Date">
<rank>10</rank>
<items>
<item id="user-content-move2production">
<rank>10</rank>
</item>
<item id="user-content-purchase_date">
<rank>20</rank>
</item>
<item id="user-content-end_of_warranty">
<rank>30</rank>
</item>
</items>
</item>
<item id="user-content-fieldset:Server:otherinfo">
<rank>20</rank>
<items>
<item id="user-content-description">
<rank>10</rank>
</item>
</items>
</item>
<item id="user-content-fieldset:Server:hctainfo">
<rank>30</rank>
<items>
<item id="user-content-purchasePrice">
<rank>10</rank>
</item>
<item id="user-content-POnumber">
<rank>20</rank>
</item>
<item id="user-content-maintSupplier">
<rank>30</rank>
</item>
<item id="user-content-maintRenewalAmount">
<rank>40</rank>
</item>
<item id="user-content-assetVendor">
<rank>45</rank>
</item>
<item id="user-content-fixedAsset">
<rank>50</rank>
</item>
<item id="user-content-leased">
<rank>60</rank>
</item>
<item id="user-content-leaseEndDate">
<rank>70</rank>
</item>
</items>
</item>
</items>
</item>
</items>
<search>
<items>
<item id="user-content-name">
<rank>10</rank>
</item>
<item id="user-content-org_id">
<rank>20</rank>
</item>
<item id="user-content-status">
<rank>30</rank>
</item>
<item id="user-content-business_criticity">
<rank>40</rank>
</item>
<item id="user-content-location_id">
<rank>50</rank>
</item>
<item id="user-content-brand_id">
<rank>60</rank>
</item>
<item id="user-content-model_id">
<rank>70</rank>
</item>
<item id="user-content-type">
<rank>80</rank>
</item>
<item id="user-content-serialnumber">
<rank>90</rank>
</item>
<item id="user-content-asset_number">
<rank>100</rank>
</item>
<item id="user-content-move2production">
<rank>110</rank>
</item>
<item id="user-content-purchase_date">
<rank>120</rank>
</item>
<item id="user-content-end_of_warranty">
<rank>130</rank>
</item>
</items>
</search>
<list>
<items>
<item id="user-content-org_id">
<rank>10</rank>
</item>
<item id="user-content-status">
<rank>20</rank>
</item>
<item id="user-content-business_criticity">
<rank>30</rank>
</item>
<item id="user-content-location_id">
<rank>40</rank>
</item>
<item id="user-content-brand_id">
<rank>50</rank>
</item>
<item id="user-content-model_id">
<rank>60</rank>
</item>
<item id="user-content-serialnumber">
<rank>70</rank>
</item>
</items>
</list>
<class id="user-content-Person">
<properties>
</properties>
<fields>
<field id="user-content-officeNumber" xsi:type="AttributeText" _delta="define">
<sql>officeNumber</sql>
<properties>
<default_value>
<is_null_allowed>true</is_null_allowed>
</default_value></properties></field>
</fields>
<methods>
<presentation>
<items>
<item id="user-content-team_list">
<rank>10</rank>
</item>
<item id="user-content-tickets_list">
<rank>20</rank>
</item>
<item id="user-content-cis_list">
<rank>30</rank>
</item>
<item id="user-content-col:col1">
<rank>40</rank>
<items>
<item id="user-content-fieldset:Person:info">
<rank>10</rank>
<items>
<item id="user-content-name">
<rank>10</rank>
</item>
<item id="user-content-first_name">
<rank>20</rank>
</item>
<item id="user-content-org_id">
<rank>30</rank>
</item>
<item id="user-content-status">
<rank>40</rank>
</item>
<item id="user-content-location_id">
<rank>50</rank>
</item>
<item id="user-content-function">
<rank>60</rank>
</item>
<item id="user-content-manager_id">
<rank>70</rank>
</item>
<item id="user-content-employee_number">
<rank>80</rank>
</item>
</items>
</item>
</items>
</item>
<item id="user-content-col:col2">
<rank>50</rank>
<items>
<item id="user-content-fieldset:Person:notifiy">
<rank>10</rank>
<items>
<item id="user-content-email">
<rank>10</rank>
</item>
<item id="user-content-notify">
<rank>20</rank>
</item>
<item id="user-content-phone">
<rank>30</rank>
</item>
<item id="user-content-mobile_phone">
<rank>40</rank>
</item>
<item id="user-content-fieldset:Person:hctainfo">
<rank>60</rank>
<items>
<item id="user-content-officeNumber">
<rank>10</rank>
</item>
</items>
</item>
</items>
</item>
</items>
</item>
</items>
<search>
<items>
<item id="user-content-name">
<rank>10</rank>
</item>
<item id="user-content-first_name">
<rank>20</rank>
</item>
<item id="user-content-org_id">
<rank>30</rank>
</item>
<item id="user-content-status">
<rank>40</rank>
</item>
<item id="user-content-location_id">
<rank>50</rank>
</item>
<item id="user-content-email">
<rank>60</rank>
</item>
<item id="user-content-phone">
<rank>70</rank>
</item>
<item id="user-content-employee_number">
<rank>80</rank>
</item>
<item id="user-content-manager_id">
<rank>90</rank>
</item>
<item id="user-content-mobile_phone">
<rank>100</rank>
</item>
<item id="user-content-notify">
<rank>110</rank>
</item>
</items>
</search>
<list>
<items>
<item id="user-content-first_name">
<rank>10</rank>
</item>
<item id="user-content-org_id">
<rank>20</rank>
</item>
<item id="user-content-status">
<rank>30</rank>
</item>
<item id="user-content-location_id">
<rank>40</rank>
</item>
<item id="user-content-email">
<rank>50</rank>
</item>
<item id="user-content-phone">
<rank>60</rank>
</item>
</items>
</list>
</presentation>
</methods></class>
<menus>
</menus>
<user_rights>
<groups>
</groups>
<profiles>
</profiles>
</user_rights>
~~~~~
I seem to recall when I added the new fields to the PC CI the toolkit process gave me an indication it was going to modify a table (not 100% sure of that) but I don't see any indication of this now when trying to add fields to Person. I've verified via MySQL cmd line that the column is NOT added to the table.
I know i'm now doing this under the 2.1 beta (which I suppose could be the issue) but I'm thinking I'm missing something in my extension files. I thought/hoped I'd be able to figure this out but i'm not making any progress on it. Any help in pointing me in the right direction is most appreciated.
Sorry for the long post.
gene
I'm not sure what I did wrong initially, but since I am still evaluating iTop and all the data in the database I had imported via CSV files, I started over with a fresh install, installed the toolkit, added my new module, and it worked.
I suspect that there is some kind of "caching" issue with iTop at times. I ran into similar problems earlier in the year and solved it in pretty much the same way.