Announcement

Collapse
No announcement yet.

Quote Item Duplicates

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

  • Quote Item Duplicates

    Hello,

    I have added custom field named visibility in quote item to show or hide the quote item when the status is not equal to Approved.

    I achieved almost everything, But when i edit quote and save it, the quote item gets duplicated x 2 (Time 2 of the total quote item in DB).

    To show or hide the quote item on https://domain.com#QuoteItem when quote status is not equal to approved.

    I have added this line in base.php

    public function createSelectQuery($entityName, array $params = array(), $deleted = false)
    {
    $whereClause = $whereClause + array('visibility' => 1); // this works when it display the quote item in both quote page and in the quote item page.
    }


    When edit and save the quote item or any other field value in quote page, the quote item gets duplicated .

    Please guide me to fix this.. Thanks.

  • #2
    fix saving in repository

    Comment


    • #3
      Hello Tanya,

      I didn't ask for custom calculation, i need to write a query to fetch the result. Where can i write the select query to add a additional column visibility=1 in the select query for quote item page.

      I just need a file name which is used for fetching data from DB for quote-item page.

      Thanks.

      Comment


      • #4
        application/Espo/Modules/Advanced/Services/Quote.php loadItemListField - if you want to filter items for Quote
        application/Espo/Modules/Advanced/SelectManagers/QuoteItem.php - if you want to filter in Quote Items view
        Where do you want to filter items?

        Comment


        • #5
          Hi tanya

          I want to filter Quote Item application/Espo/Modules/Advanced/SelectManagers/QuoteItem.php. In the Quote Item page, Should display Quote item which are from the Approved Quote.

          How to do that?

          Thanks.

          Comment


          • #6
            I can see some functions inside the QuoteItem.php,

            class QuoteItem extends \Espo\Core\SelectManagers\Base
            {
            protected function acessOnlyOwn(&$result)
            {
            $result['whereClause'][] = array(
            'quote.assignedUserId' => $this->getUser()->id
            );
            }
            }

            My Question:

            1. Do i need to add a new function like the above one?

            2. What should be the function name.

            3. How do EspoCRM read that function, where to declare it?

            Thanks @tanya

            Comment


            • #7
              Here you can find how to override SelectMeneger in upgrade safe way https://forum.espocrm.com/forum/deve...default-filter
              here is the main parent class https://github.com/espocrm/espocrm/b...agers/Base.php

              Comment


              • #8
                Hello,

                I have a similar problem. When I save quote it, The quote item gets duplicated x 2.
                Can you help me?

                Comment

                Working...
                X