Menu

#1813 Exception when creating a new request on portal

2.7.2
accepted
nobody
None
User Interface
Critical
2.6.0
defect
2020-11-10
2019-10-17
Matt L.
No

This was discussed in this thread : https://sourceforge.net/p/itop/discussion/1113906/thread/29f296be60/?limit=100

So we extendended iTop's datamodel to include a set of default services for all users on the portal. To do so, we redefined the oql view on ServiceFamily, Service and SubService's scopes by adding a union on the existing request.

The result wasn't the one we expected as it crashed the new requests's page on the portal, displaying this error message :

RenameAlias: alias 'L-1-1' already used

It seems the class redefinition causing this issue is this one.

<class id="ServiceFamily" _delta="must_exist">
          <scopes _delta="must_exist">
            <scope id="all" _delta="must_exist">
              <oql_view _delta="redefine"><![CDATA[
                  SELECT ServiceFamily AS sf
                  JOIN Service AS s ON s.servicefamily_id = sf.id
                  JOIN lnkCustomerContractToService AS lnk ON lnk.service_id=s.id
                  JOIN CustomerContract AS cc ON lnk.customercontract_id=cc.id
                  WHERE cc.org_id = :current_contact->org_id
                  UNION SELECT ServiceFamily AS sf
                  JOIN DefaultService ON DefaultService.servicefamily_id = sf.id
                  WHERE DefaultService.status != 'obsolete'
               ]]>
              </oql_view>
            </scope>
          </scopes>
        </class>

The code raising this exception seems to be :

core/dbobjectsearch.class.php:207

public function RenameAlias($sOldName, $sNewName)
    {
        $bFound = false;
        if (array_key_exists($sOldName, $this->m_aClasses))
        {
            $bFound = true;
        }
        if (array_key_exists($sNewName, $this->m_aClasses))
        {
            throw new Exception("RenameAlias: alias '$sNewName' already used");
        }
        ...

Callstack

dbobjectsearch.class.php:207, DBObjectSearch->RenameAlias()
dbunionsearch.class.php:236, DBUnionSearch->RenameAlias()
browsebrickcontroller.class.inc.php:125, Combodo\iTop\Portal\Controller\BrowseBrickController->DisplayAction()
HttpKernel.php:151, Symfony\Component\HttpKernel\HttpKernel->handleRaw()
HttpKernel.php:68, Symfony\Component\HttpKernel\HttpKernel->handle()
Application.php:496, Silex\Application->handle()
Application.php:477, Silex\Application->run()
index.php:167, require_once()
index.php:51, require_once()
exec.php:77, {main}()

Are we doing something wrong or is it a bug we have found ?

1 Attachments

Discussion

  • Pierre Goiffon

    Pierre Goiffon - 2019-10-17
    • status: new --> not-a-bug
     
  • Pierre Goiffon

    Pierre Goiffon - 2019-10-17

    Hello,
    Please use the forums ("discussion" tab) for any assistance request.
    Tickets are reserved for qualified bugs reports or enhancement requests.
    Thanks.

     
  • Pierre Goiffon

    Pierre Goiffon - 2019-11-14
    • status: not-a-bug --> accepted
    • Attachments has changed:

    Diff:

    --- old
    +++ new
    @@ -0,0 +1 @@
    +SF#1813_delta.xml (5.0 kB; text/xml)
    
    • Milestone: Unassigned --> Future release
     
  • Pierre Goiffon

    Pierre Goiffon - 2019-11-14

    Attached the XML to reproduce.

    The Service scope alone can work if replacing DefaultService with Service. Here is the modified query :

    SELECT Service AS s JOIN lnkCustomerContractToService AS lnk ON lnk.service_id=s.id JOIN CustomerContract AS cc ON lnk.customercontract_id=cc.id WHERE cc.org_id = :current_contact->org_id AND s.status != 'obsolete' UNION SELECT Service AS ds WHERE ds.status != 'obsolete' AND finalclass='DefaultService'

    But if adding the ServiceFamily scope the error comes back again.

    Attached a delta to reproduce the problem on a standard iTop.

     
  • Pierre Goiffon

    Pierre Goiffon - 2019-11-14
    • Description has changed:

    Diff:

    --- old
    +++ new
    @@ -1,3 +1,6 @@
    +*This was discussed in this thread : https://sourceforge.net/p/itop/discussion/1113906/thread/29f296be60/?limit=100*
    +
    +
     So we extendended iTop&#39;s datamodel to include a set of default services for all users on the portal. To do so, we redefined the oql view on ServiceFamily, Service and SubService&#39;s scopes by adding a union on the existing request.
    
     The result wasn&#39;t the one we expected as it crashed the new requests&#39;s page on the portal, displaying this error message : 
    
     
  • Pierre Goiffon

    Pierre Goiffon - 2019-11-14

    Matt tried this workaround that does not work either (error : SetSelectedClasses: Invalid class alias L-1-1)

        <class id="Service" _delta="must_exist">
          <fields>
            <field id="isDefault" _delta="define" xsi:type="AttributeEnum">
              <sql>is_default</sql>
              <is_null_allowed>false</is_null_allowed>
              <default_value>false</default_value>
              <values>
                <value id="true">true</value>
                <value id="false">false</value>
              </values>
            </field>
          </fields>
        </class>
    

    ServiceFamily scope :

    SELECT `sf` FROM ServiceFamily AS `sf`
    JOIN Service AS `s` ON `s`.servicefamily_id = `sf`.id
    JOIN lnkCustomerContractToService AS `lnk` ON `lnk`.service_id = `s`.id
    JOIN CustomerContract AS `cc` ON `lnk`.customercontract_id = `cc`.id
    WHERE (`cc`.`org_id` = :current_contact->org_id)
    UNION SELECT ServiceFamily AS dsf
    JOIN Service AS ds ON ds.servicefamily_id = dsf.id
    WHERE ds.isDefault = 'true'
    

    Service scope :

    SELECT `s` FROM Service AS `s`
    JOIN lnkCustomerContractToService AS `l1` ON `l1`.service_id = `s`.id
    JOIN CustomerContract AS `cc` ON `l1`.customercontract_id = `cc`.id
    WHERE `cc`.`org_id` = :current_contact->org_id AND `s`.`status` != 'obsolete'
    UNION SELECT Service AS ds
    WHERE ds.isDefault = 'true' AND ds.status != 'obsolete'
    
     
  • Pierre Goiffon

    Pierre Goiffon - 2020-03-05

    Combodo db ref : N°2585

     
  • Eric Espie

    Eric Espie - 2020-11-10

    Fixed in 2.7.2-1

     
  • Eric Espie

    Eric Espie - 2020-11-10
    • 3.0.1: Future release --> 2.7.2
     

Log in to post a comment.

MongoDB Logo MongoDB