1. 05 Jun, 2014 8 commits
    • Alex Vandiver's avatar
      Canonicalize all OCFVs on load, not just IP address ranges · 8ed92aed
      Alex Vandiver authored
      This ensures that IPs are padded to three digits per octet, and that
      dates are formatted in standard ISO time.
      8ed92aed
    • Alex Vandiver's avatar
    • Alex Vandiver's avatar
      Let canonicalization return a failure message · b7a8c03f
      Alex Vandiver authored
      This allows CF creation to abort on invalid values, and HasEntry to give
      up and move on if passed a value that can never be found in the
      database.
      b7a8c03f
    • Alex Vandiver's avatar
      Add common IP address and range canonicalizers · c1727f60
      Alex Vandiver authored
      The IP address and range canonicalization in ObjectCustomFieldValue's
      Create is moved into the more general canonicalization functions.  This
      also allows HasEntry can split IP ranges correctly to check their
      existance, and ensures that the standard form (padded to three digits
      per octet) is compared against the database.
      c1727f60
    • Alex Vandiver's avatar
      Move canonicalization into RT::ObjectCustomFieldValue->Create · d3928d7b
      Alex Vandiver authored
      Previously, value canonicalization happened for dates and datetimes in
      RT::CustomField->AddValueForObject, and for IP addresses and ranges in
      RT::ObjectCustomFieldValue->Create.  Standardize on the latter, as it is
      lower down and thus harder to skip accidentally.
      
      This requires creating the CustomField object as the current user, not
      as the system user, as Date and DateTime canonicalization cares about
      the time zone of the current user.  This, in turn, requires switching to
      _Value('Type') instead of Type, as the constructed $cf object is not
      guaranteed to have the right context objects for it to be readable by
      the user.
      d3928d7b
    • Alex Vandiver's avatar
      Add a generic ->_CanonicalizeValue · 66cf1d42
      Alex Vandiver authored
      Refactor the two places that use can() into a common method.
      66cf1d42
    • Alex Vandiver's avatar
      ->Content is as formatted for the user, not the DB value · 5e2dc55a
      Alex Vandiver authored
      When comparing the canonicalized values, one must bear in mind that
      ->Content is not just the Content column in the database; instead, it
      falls back to the LongContent, in addition to doing explicit formatting
      for IP range custom fields.
      
      Compare the 'Content' key to what is actually in the 'Content' column,
      using $self->_Value().  This does not fix IP custom field updates, as
      the input Content has still not been split into Content and LargeContent
      as the database stores it.
      5e2dc55a
    • Alex Vandiver's avatar
      145562b3
  2. 04 Jun, 2014 1 commit
    • Kevin Falcone's avatar
      Test of the Queue/ObjectId failures · 141ca2cc
      Kevin Falcone authored
      These tests are based on the RTIR initialdata file which identified the
      problem and fail on 4.2-trunk because of warnings generated during the
      initialdata load of t/api/initialdata.t
      
      I suspect we want to enhance our initialdata sample with any further
      Handle::InsertData hacking (or docs/initialdata.pod updates).
      141ca2cc
  3. 03 Jun, 2014 2 commits
  4. 30 May, 2014 5 commits
  5. 29 May, 2014 2 commits
  6. 28 May, 2014 6 commits
  7. 27 May, 2014 16 commits
    • Alex Vandiver's avatar
    • Alex Vandiver's avatar
      0174a258
    • Kevin Falcone's avatar
      Switch to ShowActions from ShowTitleBarCommands · 1aa631b9
      Kevin Falcone authored
      f0137c97 deleted ShowTitleBarCommands but commits which were merged
      later (0d8eacf3 and 775f4bd1) used them for newly refactored code,
      causing Reply/Comment/Forward to pop up all over the Approvals display,
      and generating links that either loop back to the approvals page or
      otherwise don't work.
      1aa631b9
    • Kevin Falcone's avatar
      Whitespace only change · 18526eba
      Kevin Falcone authored
      The previous commit removed an outer if block and pushed it into the
      boolean check of the elsif, leaving it weirdly indented.  This left
      shifts everything as a separate commit to make reading the previous code
      change clearer.
      18526eba
    • Kevin Falcone's avatar
      In 4.0, ShowTitleBarCommands didn't hide Outgoing Email links · 18957ceb
      Kevin Falcone authored
      The 4.2 equivalent ShowActions should be compatible for the places
      that want to suppress Reply/Comment/Forward.
      
      This makes the code change, leaves whitespace terrible.
      18957ceb
    • Kevin Falcone's avatar
      Assuming relative paths in ShowHistory breaks Approvals history display · 324e22d3
      Kevin Falcone authored
      Show Outgoing Email goes to /Approvals/ShowEmailRecord.html which
      doesn't exist.  Additionally, Reply/Comment/Forward are broken (although
      shouldn't be visible, fixed in a later commit).
      
      This also shows up in RTIR where links point to
      /RTIR/ShowEmailRecord.html and /RTIR/Attachments/
      
      Fixes issues 29800 and lays groundwork for a fix in RTIR for 29775.
      
      While you could list /Ticket/Update.html and /Ticket/Crypt.html for the
      6 *Path variables passed in %ARGS, it's nicer if you can just say "use
      everything from /Ticket/, like you used to in 4.0".
      
      Broken when moving to relative-by-default paths in 8274e2b6.
      
      Since /Elements/ShowHistory isn't directly callable and the JS helper doesn't
      pass extra arguments, there are currently no ways to pass a malicious
      PathPrefix in from user supplied data.
      324e22d3
    • Alex Vandiver's avatar
      Switch existing code to using LookupType with LoadByName, to be explicit · 487df4d9
      Alex Vandiver authored
      To set an example for future code, transition away from the 'Queue'
      argument, in preference to LookupType and ObjectId.  This helps clarify
      the type of custom field that is expected to be returned.
      Simultaneously, switch to using IncludeGlobal where the code would
      benefit from such.
      487df4d9
    • Alex Vandiver's avatar
      Add tests for the new LoadByName functionality · f4db1cc5
      Alex Vandiver authored
      This throughly exercises the new codepath.  It leaves the existing
      t/customfields/api.t untouched, though it may be sensible to merge them
      in the future.
      f4db1cc5
    • Alex Vandiver's avatar
      Document but deprecate the old names for LoadByName · 2b181e47
      Alex Vandiver authored
      While it is tempting to officially deprecate these, they are in use in
      core RT and in extensions, and introducing new deprecations during a
      stable series is unwise.  Suffice to document them as deprecated, and
      migrate exsting uses away from the, though not produce deprecation
      warnings.
      2b181e47
    • Alex Vandiver's avatar
      Optimize the query slightly, by eliminating an unnecessary DISTINCT · 5ea0b2e9
      Alex Vandiver authored
      The join from CustomFields to ObjectCustomFields is guaranteed to be
      distinct, by dint of the fat that either it is global, or it matches the
      objectid we desire; as such, we can eliminate a cumbersome DISTINCT by
      informing DBIx::SearchBuilder of this property at JOIN time.
      5ea0b2e9
    • Alex Vandiver's avatar
      Allow callers to look in Queue and global CFs · 51d22fdd
      Alex Vandiver authored
      Previously, in order to respect global CFs, callers were forced to
      explicitly attempt to LoadByName with a queue, and then attempt again
      with Queue => 0 if it failed.
      
      Provide an option, defaulting to off, to first search queue CFs,
      followed by global CFs.
      51d22fdd
    • Alex Vandiver's avatar
      Allow callers to not get disabled CFs · 3165021f
      Alex Vandiver authored
      For backwards compatibility, LoadByName has always maintained the
      property that it may return a disabled custom field -- though it does so
      only if there are no matching enabled fields.
      
      Provide an option to control this behavior; the default is maintained as
      it was previously, for backwards compatibility.
      
      Note that previously, the only OrderBy was the Disabled flag -- this
      means that if there were two non-disabled custom fields with the same
      name, which one was returned was possibily non-deterministic.  This
      commit places a predictable ordering on the resolution; namely, lower
      SortOrder and lower id take precedence.
      3165021f
    • Alex Vandiver's avatar
      Allow for non-Queue context objects · 7d7ab570
      Alex Vandiver authored
      This opens the door for using LoadByName for custom fields not on
      Transactions, Tickets, or Queues.  Callers specify a LookupType and
      ObjectId, from which the class to load (if not RT::Queue) can be
      inferred.  Consequently, using LoadByName for User (or Asset) custom
      fields no longer requires writing an alternate and parallel
      implementation of LoadByName.
      7d7ab570
    • Alex Vandiver's avatar
      Move LookupType defaulting earlier · 25ccf89d
      Alex Vandiver authored
      We will use the LookupType as a default in the next commit, and thus
      need to have it prior to when we resolve the object (currently Queue).
      25ccf89d
    • Alex Vandiver's avatar
      Simplify logic by loading the queue even if not strictly necessary · f1c5aebc
      Alex Vandiver authored
      The existing logic in the "if" statement serves to skip the block in
      precisely one situation -- the passed Queue is numeric, and there
      already exists a ContextObject.  In such situation, it is not necessary
      to attempt to load the Queue -- but it is not harmful, either.  In fact,
      it may allow a better warning in cases where a numeric but non-existant
      Queue is passed in.  It also clarifies the logic immeasurably.
      f1c5aebc
    • Alex Vandiver's avatar
      Short-circuit if a bogus Queue was passed · d68734f7
      Alex Vandiver authored
      d68734f7