Announcement

Collapse
No announcement yet.

Bad Server Response

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

  • Bad Server Response

    I have created another entity - Special Rate Card same as Product.

    My Account has an option - either discount or rate card.

    In quotes if the selected account has discount then quote item will load values from Product. And if it has rate card, quote item will load from Special rate card.

    I have an enum field serviceDescription which loads description accordingly.



    Espo.define('Advanced:Views.QuoteItem.Fields.Servi ceDescriptions', 'Views.Fields.Enum', function (Dep) {


    return Dep.extend({

    translatedOptions: null,

    setup: function () {
    this.setupOptions();
    Dep.prototype.setup.call(this);
    this.listenTo(this.model, 'change', function (model) {
    this.params.options=[];
    this.setupOptions();
    this.render();
    }, this);


    },
    setupOptions: function () {

    if (this.mode != 'list') {
    var entity;
    if (this.model.get('discountPolicy') != "None") {
    entity = 'Product';
    } else {
    entity = 'SpecialRateCard';
    }
    var url = 'Product/action/loadListItemField';
    this.translatedOptions = null;
    var list = [];
    var id = this.model.get('productId');
    $.ajax({
    url: url,
    data: {
    id: id,
    entity:entity,
    },
    type: "GET",
    dataType: 'json',
    async: false,
    }).done(function (respose) {
    list.push("");
    $.each(respose, function (i) {
    var val = respose[i].description;
    var listVal = val + " - " + respose[i].unit;
    list.push(listVal);
    });

    this.wait(false);
    }.bind(this));
    console.log(list);
    this.params.options = list;
    }

    },
    });
    });



    Here console.log(list); outputs the values correctly.

    But they don't display in the serviceDescripion field ,Giving bad server response.

    Can anybody help me in this?

    Thanks,





  • #2
    Hello
    Bad server response - what does the server response, what does contain the log (espocrm and apache error)?

    Comment


    • #3
      Hi Tanya,

      Only this bad server response was there. No other messages displayed.

      Tried changing the code like,

      Passed only the productId and in services/product -

      $product = $this->getEntityManager()->getEntity('Product', $productId);
      if(!$product){
      $product = $this->getEntityManager()->getEntity('SpecialRateCard', $productId);
      }

      This worked.

      Thanks Tanya.



      Comment

      Working...
      X