Announcement

Collapse
No announcement yet.

Problems With New Field Value

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

  • Problems With New Field Value

    I've added the value "Expired" to the "Status" field for entity "Quote" using the Entity Manager.

    Unfortunately, I'm experiencing two issues:
    1. The new value wouldn't show up in the filter I apply to a Report.
    2. I couldn't find a way to exclude the new value from the "Actual" filter in the list of Quotes.

    Find two corresponding screenshots attached, any help is much appreciated.

  • #2
    Hi,
    1. Refresh a web page and check it again.
    2. Open the application/Espo/Modules/Sales/SelectManagers/Quote.php file and add 'Expired' to an array:
    PHP Code:
    protected function filterActual(&$result)
        {
            
    $result['whereClause'][] = [
                
    'status!=' => ['Approved''Rejected''Canceled''Expired']
            ];
        } 
    UPD.

    Basically it is recommended to redefine a logic in the /custom directory. For example, create the file /custom/Espo/Custom/SelectManagers/Quote.php with this code:
    PHP Code:
    <?php
    namespace Espo\Custom\SelectManagers;

    class 
    Quote extends \Espo\Modules\Sales\SelectManagers\Quote
    {
        protected function 
    filterActual(&$result)
        {
            
    $result['whereClause'][] = [
                
    'status!=' => ['Approved''Rejected''Canceled''Expired']
            ];
        }
    }
    Last edited by yuri; 05-12-2020, 03:44 PM.

    Comment


    • #3
      Maximus Thanks so much for the quick reply.

      #1 worked after refresh, as suggested.

      #2 I've added the file, rebuilt but "Expired" still shows up with the "Actual" Quotes. Anything I need to do in addition?

      Comment


      • #4
        Could be you didn't add "<?php" in the beginning.

        Comment


        • #5
          yuri thanks, that was it.

          The filter is now applied as expected. However, the option to filter "Only my" is now gone. What could be the reason for that?

          Comment


          • #6
            Hi Tobias,
            I've checked it but by default, there is no such filter in UI. Do this:
            1. Create the file (if it doesn't yet exist) /custom/Espo/Custom/Resources/metadata/clientDefs/Quote.json with the code:
            Code:
            {
                "boolFilterList": ["onlyMy"]
            }
            2. Administration -> Clear Cache
            3. Refresh a web page
            4. Set up the filter on the Quote list view

            Comment


            • #7
              Maximus Thanks, I've done steps 1 to 3 but I'm not quite sure what you mean by step 4 (Set up the filter on the Quote list view)?

              Comment


              • #8
                That's ok. I just meant that now you can select this filter in the Quote list view.

                Comment


                • #9
                  Hm, I'm afraid I cannot select this filter in the Quote list view, find a screenshot attached. I've cleared cache and even rebuilt (both in CLI). What am I missing?

                  Comment


                  • #10
                    Sorry, my bad. I had the json file wrong. All working now

                    Comment

                    Working...
                    X