Menu

Costom origins option?

Bananaman
2021-09-27
2021-11-19
  • Bananaman

    Bananaman - 2021-09-27

    Hello Guys, Just wondering how could I create new option for origins. Such as WhatsApp/messenger etc. As much as I understood it's not as easy as - "add new origins" button but again requires programming. Can anyone give me advice or point me in right direction, so I could add this.

    Thank you so much :)

     
    • Marco Lima

      Marco Lima - 2021-10-25

      Keep in mind that you have to make these changes to the User Request Class to get what you want. Make sure when you create the Module you fill out the dependencies correctly.

      After that, it should be a simple matter of adding the values with a very small amount of code is you won't have to touch the presentation part.

       
  • Guillaume Lajarige

    Hello,

    You need to make your own extension and add values in the XML datamodel.
    - Check here for how to make your extension
    - Check here for an exemple made by Vladimir Kunin to add currencies in contracts (which is the same as what you want to do : add values to an enum attribute)

    Hope this helps,
    Guillaume

     
    • Bananaman

      Bananaman - 2021-09-28

      Hello Guillaume thanks for response,

      Will this work?

      <?xml version="1.0" encoding="UTF-8"?>
      <itop_design xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" version="1.0">
        <classes>
          <class id="Contract">
            <fields>
              <field id="origins">
                <values>
                  <!-- Add your currency here, then translate it in <dictionaries> -->
                  <!-- <value id="you_currency" _delta="define">you_currency</value> -->
                  <value id="WhatsApp" _delta="define">WhatsApp</value>
                </values>
              </field>
            </fields>
          </class>
        </classes>
        <dictionaries>
          <dictionary id="EN EN">
            <entries>
              <entry id="Class:Contract/Attribute:origins/Value:WhatsApp" _delta="define"><![CDATA[WhatsApp]]></entry>
            </entries>
          </dictionary>
          <dictionary id="EN US">
            <entries>
              <entry id="Class:Contract/Attribute:origins/Value:WhatsApp" _delta="define"><![CDATA[WhatsApp]]></entry>
            </entries>
          </dictionary>
          <!-- Create a dictionary with your language code ('EN US', 'FR FR', 'RU RU', etc.) and add translation entities below -->
          <!-- <dictionary id="EN US"> -->
            <!-- <entries> -->
              <!-- <entry id="Class:Contract/Attribute:cost_currency/Value:you_currency" _delta="define"><![CDATA[Your Currency]]></entry> -->
            <!-- </entries> -->
          <!-- </dictionary> -->
        </dictionaries>
      </itop_design>
      
       
      • Jeffrey Bostoen

        Jeffrey Bostoen - 2021-09-28

        I'd recommend to write "whatsapp" in small characters for the value ID. It's not required, but more consistent.

         
  • Guillaume Lajarige

    Yep, you should keep values lowercase as they will be used in the DB.
    The label displayed to the user should be done through a dictionary entry, like you did at the end of the XML.

    Don't forget to add in your "module.xxx.php" file a dependancy to the module bringing the "Contract" class in the first place, otherwise you might have an error during compilation.

    Guillaume

     
  • Bananaman

    Bananaman - 2021-10-12

    Hello again guys,

    <?xml version="1.0" encoding="UTF-8"?>
    <itop_design xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" version="1.0">
      <classes>
        <class id="Contract">
          <fields>
            <field id="origins">
              <values>
                <value id="whatsapp" _delta="define">whatsapp</value>
              </values>
            </field>
          </fields>
        </class>
      </classes>
      <dictionaries>
        <dictionary id="EN EN">
          <entries>
            <entry id="Class:Contract/Attribute:origins/Value:whatsapp" _delta="define"><![CDATA[whatsapp]]></entry>
          </entries>
        </dictionary>
        <dictionary id="EN US">
          <entries>
            <entry id="Class:Contract/Attribute:origins/Value:whatsapp" _delta="define"><![CDATA[whatsapp]]></entry>
          </entries>
        </dictionary>
      </dictionaries>
    </itop_design>
    

    Will this work? how should i proceed to compile it for a plugin or next steps i should take read the manual but i got more confused of what it requests.

    Any help would be appreciated.

    -Bananaman.

     
  • Pierre Goiffon

    Pierre Goiffon - 2021-10-12

    Hello,
    This seems ok.
    About creating a module to host this XML, take a look here : Customizing iTop [iTop Documentation]

     
    • Bananaman

      Bananaman - 2021-10-13

      Thanks for your answer, I'm still a bit stuck about creating package of all this do i need sql section as well, all of this is way too in depth for as simple thing as adding an drop down function. Please could anyone give me a bit of help.

      -Sadbananaman

       
  • Bananaman

    Bananaman - 2021-10-15

    Still need help with this. BUMP

     
  • Bananaman

    Bananaman - 2021-10-15

    I tried to convert currencies one provided earlier this is the error i get on compiling.

    Error loading module "toms-origins-whatsapp": /itop_design/classes/class[Contract] at line 4: could not be found - Loaded modules: dictionaries,core,application,authent-cas,authent-external,authent-ldap,authent-local,combodo-db-tools,itop-attachments,itop-backup,itop-config-mgmt,itop-config,itop-datacenter-mgmt,itop-endusers-devices,itop-files-information,itop-hub-connector,itop-portal-base,itop-portal,itop-profiles-itil,itop-sla-computation,itop-storage-mgmt,itop-tickets,itop-virtualization-mgmt,itop-welcome-itil,molkobain-portal-mosaic-service-catalog,sample-portal-new-theme,teemip-network-mgmt,toms-origins-whatsapp
    
     
    • Pierre Goiffon

      Pierre Goiffon - 2021-11-09

      You don't need to generate an extension.xml file.
      All needed files can be found in the wiki !

      Here, you probably forgot to define the dependancies in your module's module.*.php file

       
  • Bananaman

    Bananaman - 2021-10-25

    BUMP

     
  • Jeffrey Bostoen

    Jeffrey Bostoen - 2021-10-29

    @Bananaman I can't reply to your private message; I think the email account linked to your SourceForge account/email address is unavailable for some reason.

     
  • Bananaman

    Bananaman - 2021-11-19

    Still need help with this plugin.

     

Log in to post a comment.

Want the latest updates on software, tech news, and AI?
Get latest updates about software, tech news, and AI from SourceForge directly in your inbox once a month.