1. 22 Jun, 2022 2 commits
  2. 21 Jun, 2022 4 commits
  3. 20 Jun, 2022 2 commits
  4. 15 Jun, 2022 10 commits
  5. 14 Jun, 2022 4 commits
  6. 13 Jun, 2022 13 commits
    • Jérome Perrin's avatar
      dms: disable open button in PDF viewer · c54c4bc0
      Jérome Perrin authored
      It does not make any sense to open PDF files from this gadget.
      
      Also remove duplicate line with documentProperties
      c54c4bc0
    • Jérome Perrin's avatar
      dms: support password protected PDFs in viewer · 407b7727
      Jérome Perrin authored
      This is intended to store sensitive documents that users will only
      be able to view from ERP5, but not to easily print or download.
      
      To use this, some customization is needed. First, PDF needs to be
      saved with a password. Then, PDF_getContentPassword type based method
      needs to be customized to return the password.
      
      When using this, we use different password for each document, by
      deriving a password from a master key using document properties (such
      as document reference for example)
      407b7727
    • Jérome Perrin's avatar
      core,dms,xhtml_syle: support language in editor gadgets (CKEditor and pdf.js) · b266ef47
      Jérome Perrin authored
      A new option render option, "language" is passed to the gadget. It is
      a two letter code as used by Localier.
      
      Both CKEditor and pdf.js have support for translations and already
      include translations for many languages. Before this change, they were
      auto detecting the browser language and displaying in the browser
      language, ignoring the language that was selected in ERP5. With this
      change, they use the language selected in ERP5.
      
      For CKEditor, we need to set the language only it is actually supported,
      otherwise CKEditor crash. pdf.js does not this, but we had to call
      ourselves initialize - which is probably better, because it was a promise
      not awaited.
      b266ef47
    • Jérome Perrin's avatar
      dms: no need to remove <base> in PDF viewer · 6dccfa3b
      Jérome Perrin authored
      I'm not sure what was the problem from this comment, but we render
      the gadget in an iframe so there's no need to change the DOM like this.
      Probably this was a problem in early versions when it was in the same
      page.
      6dccfa3b
    • Jérome Perrin's avatar
      dms: support a few more locales in PDF viewer · 23597a79
      Jérome Perrin authored
      also change the content type in so that they are exported as text in
      business template
      23597a79
    • Jérome Perrin's avatar
      dms: use ?format= URL for PDF viewer · 59f626ae
      Jérome Perrin authored
      This is the URL to download, it currently does not support range
      requests, but it sets cache headers properly, unlike /getData which
      is an accessor
      59f626ae
    • Jérome Perrin's avatar
      dms: display drawing preview as PDF · 5fbe1a48
      Jérome Perrin authored
      For drawings the layout is usually important, but HTML preview do
      not preserve layout correctly. Use PDF instead, which keeps layout
      5fbe1a48
    • Jérome Perrin's avatar
      dms_ui_test: more tests for PDF viewer · 4c79cc7c
      Jérome Perrin authored
      It was tested only in the context of erp5_km, not in ERP5JS and xhtml
      style
      4c79cc7c
    • Jérome Perrin's avatar
      erp5_ui_test: move translation utility script to erp5_ui_test_core · f3c1434a
      Jérome Perrin authored
      so that they can be reused by other UI tests business templates without
      having to install the full erp5_ui_test
      f3c1434a
    • Jérome Perrin's avatar
      trade: Consider movement dates to select trade condition for price · 7193b12d
      Jérome Perrin authored
      using movement date rather than order date is more correct
      7193b12d
    • Jérome Perrin's avatar
      composition: only consider validated when looking up effective models · 5d929056
      Jérome Perrin authored
      composition API, which is used to select the "most applicable" model
      (Trade Condition, Transformation, Pay Sheet Model, etc) with the same
      reference was only discarding deleted and validated models, but it
      was selecting draft models.
      
      This leads to this kind of problem:
       - A validated model exist, with an effective date
       - A new model is made by cloning the validated one, edited to set
        effective date from now and validated
       - The first validated model is also cloned by mistake, but not
        validated
      In such case, the model cloned by mistake might be used, which from
      user point of view is wrong, because user validated a model, so if
      the system use a draft instead, that's a very wrong behaviour.
      
      This change require models to be validated for the composition API to
      work, many tests were updated to validate the model (either in the test
      or in the data business template used by the test).
      
      This change might also produce different results in production, because
      it was possible that some draft models were selected before, now they
      will no longer be selected. To check for potential side effects, we
      recommend looking for all draft models with a reference, examine them
      one by one and validate the model if it's a case where user forgot to
      validate.
      5d929056
    • Vincent Pelletier's avatar
      Products.CMFActivity: Unconditionally change user in dummyGroupMethod · 0e57df28
      Vincent Pelletier authored
      Since
        commit f363ac65
        Author: Vincent Pelletier <vincent@nexedi.com>
        Date:   Wed Mar 23 15:55:46 2022 +0900
      
            Products.CMFActivity.ActivityTool: Store user object in activity.
      user_name on newly created activities is always None. As a result,
      activities using dummyGroupMethod are executed within the security
      context which spawns the group, which is System Processes, instead of
      the user which spawned each activity.
      Add a unittest for this.
      0e57df28
    • Vincent Pelletier's avatar
      Products.CMFActivity: Fix user name in activity tracking log messages · 984f7f13
      Vincent Pelletier authored
      This was broken by:
        commit f363ac65
        Author: Vincent Pelletier <vincent@nexedi.com>
        Date:   Wed Mar 23 15:55:46 2022 +0900
      
            Products.CMFActivity.ActivityTool: Store user object in activity.
      as user_name becomes always None.
      984f7f13
  7. 09 Jun, 2022 5 commits
    • Jérome Perrin's avatar
      Enable coding style on erp5_payroll · 34d50a78
      Jérome Perrin authored
      See merge request !1637
      34d50a78
    • Jérome Perrin's avatar
      core: repair ERP5Site_reindexLatestIndexedObjects · e83e7960
      Jérome Perrin authored
      This script stopped working since Catalog changed to be ERP5 document,
      because it was calling the unindex method of the catalog (which
      itself is indexable like any other ERP5 document). Update to use the
      uncatalogObject which is the method to unindex a document by uid.
      
      Even though it was somehow working before, it was not really correct
      in selecting objects, because it was using - operator on TIMESTAMP
      column, which is not computing a difference in seconds as this script
      was expecting. See for example https://stackoverflow.com/a/24504132/7607763
      or the example below for an explanation. Instead, use TIMESTAMPADD
      to compute the start timestamp only once and use >= operator, which
      works as expected.
      
      This query was also sorting by indexation_timestamp, which does not
      use an index. Remove the sort because it's not really needed.
      
      Excluding reserved path was also not needed, we no longer use these
      since 69aefdff (ZSQLCatalog: Drop support for "reserved" path.,
      2017-09-18)
      
      ---
      
      Another reproduction of the timestamp arithmetic problem
      
      select
         TIMESTAMP('2021-01-02 00:00:00') - TIMESTAMP('2021-01-01 00:00:00') a,
         20210102000000 - 20210101000000 aa,
         TIMESTAMP('2021-06-01 00:00:00') - TIMESTAMP('2021-05-31 00:00:00') b,
         20210601000000 - 20210531000000 bb,
         TIMESTAMPDIFF(second, TIMESTAMP('2021-05-31 00:00:00'), TIMESTAMP('2021-06-01 00:00:00')) c
      
      | a | aa | b | bb | c |
      | ------ | ------ | ------ | ------ | ------ |
      | 1000000 | 1000000 | 70000000 | 70000000 | 86400 |
      e83e7960
    • Jérome Perrin's avatar
      9a518828
    • Jérome Perrin's avatar
      tests/SecurityTestCase: sort groups in assertion failure message · f1e4e1c3
      Jérome Perrin authored
      This is a bit easier to read
      f1e4e1c3
    • Jérome Perrin's avatar
      74157942