CRM-10213 Enable/disable a line twice does reload the page

    Details

    • Type: Bug
    • Status: Done/Fixed
    • Priority: Trivial
    • Resolution: Fixed/Completed
    • Affects Version/s: 4.2.0
    • Fix Version/s: 4.3.0
    • Component/s: None
    • Labels:
      None

      Description

      When you change the status (enable/disable) twice, it force to reload the page. you should be able to set the status as often as you want.

      Analyis:
      after the switch is done the first time, it's rewriting the code that is put on the onclick (they are so many wrong things on that line that I will leave it like that).
      var newAction = 'enableDisable( ' + recordID + ',"' +
      recordBAO + '","' +
      operation + '","' +
      reloadPage + '","' +
      rowId + '"' + ' );';
      cj( fieldID ).attr("onClick", newAction );

      the reloadPage is written between quotes, and in js "0" is true, so next time, it reloads

      This code should be thrown and re-written properly using sane jquery conventions.
      More generally, we should go away from php building an html blob for the links that contains onclick

      X+

        Attachments

          Activity

          [CRM-10213] Enable/disable a line twice does reload the page
          xavier dutoit added a comment -

          So the longest was to realise that it was broken already before my change.

          The code should really be re-factored. In general, we should stop re-inventing the ajax wheel and for once use the ajax api (I don't think it's used anywhere in the core ;(

          X+

          Donald A. Lobo added a comment -

          A lot of that code is legacy code and hence has not been switched to using jQuery etc which is always a work in progress.But if you do have the time to go in and fix those place and replace them with the right jQuery / ajax API equivalent that would be great.

          Saying that core does not use abc feature does not help you or us. You can contribute patches that migrates core towards using the right things in the right place

          xavier dutoit added a comment -

          I don't know how to avoid the problem with the links -> html blob. I seems the only option it to add js onclick

          I'll add that for the next codesprint

          Coleman Watts added a comment -

          Thanks for the contribution Xavier

            People

            • Assignee:
              Coleman Watts
              Reporter:
              xavier dutoit

              Dates

              • Created:
                Updated:
                Resolved: