Announcement

Collapse
No announcement yet.

UI broken after latest sales pack upgrade (incompatibility with customization)

Collapse
X
 
  • Filter
  • Time
  • Show
Clear All
new posts

  • UI broken after latest sales pack upgrade (incompatibility with customization)

    I have some custom quote calculations in place which is causing some issues with the latest EspoCRM.

    I have followed this guide to implement the custom calculations:


    In the logs I get error of:
    ERROR: Slim Application Error Type: Error Code: 0 Message: Class "Espo\Modules\Sales\Repositories\Quote&quo t; not found File: /srv/www/htdocs/custom/Espo/Custom/Repositories/Quote.php ......

    EspoCRM will only work if I remove the custom calculation script. Any ideas?
    Last edited by yuri; 01-23-2024, 07:41 AM.

  • #2
    Move this logic to a Before Save hook.

    custom/Espo/Custom/Hooks/Quote/CalculateItems.php

    PHP Code:
    <?php
    namespace Espo\Custom\Hooks\Quote;

    use 
    Espo\ORM\Entity;

    class 
    CalculateItems
    {    
        public static 
    int $order 10;

        public function 
    __construct(
            
    // Define needed dependencies.
        
    ) {}

        public function 
    beforeSave(Entity $entity, array $options): void
        
    {
            if (!
    $entity->has('itemList')) {
                 
    $entity->loadItemListField();
            }

            
    // Move the logic to here.
        
    }
    }

    Note that the forum may add bad invisible characters to code snippets. Beware when copy pasting the code.

    Please let us know whether it worked.

    Comment


    • #3
      Hello yuri ,

      This did not work.

      However, when I added the Quote.php and QuoteItem.php to custom/Espo/Modules/Sales/Repositories it does work but my custom calculations do not.

      File in question starts as:

      <?php

      namespace Espo\Modules\Sales\Repositories;

      use Espo\ORM\Entity;
      use Espo\Core\ORM\Repositories\RDB;

      class Quote extends RDB
      {
      .................................................. ......................

      I think the update removed some files.

      Comment


      • #4
        Did you clear cache? Did you remove your custom file? It won't work with new versions and must be removed.

        Comment


        • #5
          No my custom file is still there. Ok I see what your example meant. Let me implement and get back to you.

          Thank you yuri. This new solution has worked. I will also implement for Invoice and SalesOrder as well.

          Cheers!
          Last edited by jaykay89; 01-23-2024, 03:35 PM.

          Comment

          Working...
          X