Modify behaviour of cases module

Collapse
X
 
  • Time
  • Show
Clear All
new posts
  • manuel-kraus
    Junior Member
    • Nov 2016
    • 9

    Modify behaviour of cases module

    Hi,

    is it possible to override or hook before/after the "actionCreateLink"-method or other of the Cases Module?

    Thanks in advance
    Manuel
  • tanya
    Senior Member
    • Jun 2014
    • 4308

    #2
    Hi
    Look at /application/Espo/ORM/Repositories/RDB.php
    (an example - relation between KnowledgeBaseArticles and Cases (code is in Repositories))

    You can override Repository of Cases

    Comment

    • manuel-kraus
      Junior Member
      • Nov 2016
      • 9

      #3
      Thank you for your reply

      Could you please give an example of how to override the Repository of Cases?

      Comment

      • tanya
        Senior Member
        • Jun 2014
        • 4308

        #4
        custom/Espo/Custom/Repositories/CaseObj.php

        Code:
        namespace Espo\Custom\Repositories;
        
        class CaseObj extends \Espo\Modules\Crm\Repositories
        {
        
        }
        read files I wrote before

        Comment

        • manuel-kraus
          Junior Member
          • Nov 2016
          • 9

          #5
          So i tried this and it works fine with the relation between Cases and KnowledgeBaseArticles, but not with my custom modules.

          Code:
          namespace Espo\Custom\Repositories;
          
          use Espo\ORM\Entity;
          
          class CaseObj extends \Espo\Modules\Crm\Repositories\CaseObj
          {
              public function relate(Entity $entity, $relationName, $foreign, $data = null)
              {
          
              }
          }

          Comment

          • tanya
            Senior Member
            • Jun 2014
            • 4308

            #6
            do not override method relate. Read the file, I sent before.


            $beforeMethodName = 'beforeRelate' . ucfirst($relationName);
            $afterMethodName = 'afterRelate' . ucfirst($relationName);
            $methodName = 'relate' . ucfirst($relationName);

            What the problem is with custom modules?

            Comment

            • manuel-kraus
              Junior Member
              • Nov 2016
              • 9

              #7
              Everything works well with your help.

              The problem with the custom modules was an error that was made by me.

              Thank you very much.

              Comment

              Working...