Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

N°6863 - Allow mail inbox administrator to choose log attribute in which updates will be added #8

Open
wants to merge 2 commits into
base: master
Choose a base branch
from

Conversation

Molkobain
Copy link
Member

@Molkobain Molkobain commented Oct 23, 2023

Objective
Allow mail inbox administrator to choose log attribute in which updates will be added

Use case

  • 1 mail inbox for caller creation / updates in the public log
  • 1 mail inbox for provider (dispatched) updates in another log

The idea is to avoid the end-user to be aware of the provider updates

Proposed solution

  • De-hardcoded the target log attribute and display it in the mail inbox object
  • Set default value to "public_log" for backward compatibility
  • Use of an AttributeString instead of an ÀttributeClassAttCodeSet` to avoid data migration and as default value is not handled well, but this can be subject to discussion.

Appendices
XML snippet for AttributeClassAttCodeSet:

<field id="ticket_updates_log_attcode" xsi:type="AttributeClassAttCodeSet">
  <sql>ticket_updates_log_attcode</sql>
  <class_field>target_class</class_field>
  <attribute_definition_list>AttributeCaseLog</attribute_definition_list>
  <min_items>1</min_items>
  <max_items>1</max_items>
  <default_value>public_log</default_value>
  <is_null_allowed>false</is_null_allowed>
  <dependencies>
    <attribute id="target_class" />
  </dependencies>
</field>

Copy link
Collaborator

@Hipska Hipska left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Could you also elaborate what the exact issue is with AttributeClassAttCodeSet? Doesn't it fill in the default value in the database on creation of the column?

Comment on lines 840 to 844
// Determine which field to update
$sAttCode = 'public_log';
$sAttCode = $this->Get('ticket_updates_log_attcode');
$aAttCodes = MetaModel::GetModuleSetting('itop-standard-email-synchro', 'ticket_log', array('UserRequest' => 'public_log', 'Incident' => 'public_log'));
if (array_key_exists(get_class($oTicket), $aAttCodes))
{
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

$sAttCode will get overwritten by this default module setting..

Should this setting be obsoleted and ignored maybe?

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

You are right, I'll fix it!

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I just changed the conf. param. default value to an empty array; but actually the whole conf. param. should be obsoleted you are right.

Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

What about existing/upgrading users? They will still have the setting from previous install. Also new users will have this setting as it is still present in module file.

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

That's why obsoleting the param. and removing the line from the code is the best way IMHO.

For existing users, we should check the existing conf. param. and apply the corresponding value to existing mail inboxes. I missed that!

Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

That could be an action during setup (after database creation) for example..

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Totally

@Molkobain
Copy link
Member Author

Could you also elaborate what the exact issue is with AttributeClassAttCodeSet? Doesn't it fill in the default value in the database on creation of the column?

I wasn't able to prefill the attribute with a default value when creating a new mail inbox, even with public_log or |public_log| as default value in the XML.

@Hipska
Copy link
Collaborator

Hipska commented Oct 24, 2023

I wasn't able to prefill the attribute with a default value when creating a new mail inbox, even with public_log or |public_log| as default value in the XML.

You found a bug? 😁

@Molkobain
Copy link
Member Author

Molkobain commented Oct 24, 2023

You found a bug? 😁

Let's call it a known limitation 😅😭

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
2 participants