1. 13 Jul, 2022 2 commits
    • Jérome Perrin's avatar
      ERP5Type: deduplicate roles in pickles · ead3a27c
      Jérome Perrin authored
        security.declareProtected(Permissions.AccessContentsInformation,
                                  'debug')
        def debug(self):
          ""
          from zodbpickle.pickle_2 import Unpickler
          from ZODB.serialize import ObjectWriter
          from ZODB.ExportImport import persistent_id
          from io import BytesIO
          from StringIO import StringIO
          from zodbpickle.pickletools_2 import dis
          from Acquisition import aq_base
      
          ow = ObjectWriter(aq_base(self.getPortalObject()))
          ow._p.dump(aq_base(self).__getstate__())
          pkl = ow._file.getvalue()
      
          disf = StringIO()
          dis(pkl, disf)
          msg = "pickle size: %s\n %s" % (len(pkl), disf.getvalue())
          print(msg)
          return msg
      
      ** Before **
      
      pickle size: 756
           0: }    EMPTY_DICT
          1: q    BINPUT     1
          3: (    MARK
          4: U        SHORT_BINSTRING 'default_reference'
         23: q        BINPUT     2
         25: U        SHORT_BINSTRING 'XXXX635'
         34: q        BINPUT     3
         36: U        SHORT_BINSTRING 'uid'
         41: q        BINPUT     4
         43: L        LONG       59161L
         51: U        SHORT_BINSTRING 'workflow_history'
         69: q        BINPUT     5
         71: (        MARK
         72: U            SHORT_BINSTRING '\x00\x00\x00\x00\x00\x07|,'
         82: q            BINPUT     6
         84: c            GLOBAL     'Persistence.mapping PersistentMapping'
        123: q            BINPUT     7
        125: t            TUPLE      (MARK at 71)
        126: Q        BINPERSID
        127: U        SHORT_BINSTRING '_Add_portal_content_Permission'
        159: q        BINPUT     8
        161: (        MARK
        162: U            SHORT_BINSTRING 'Assignee'
        172: q            BINPUT     9
        174: U            SHORT_BINSTRING 'Assignor'
        184: q            BINPUT     10
        186: U            SHORT_BINSTRING 'Manager'
        195: q            BINPUT     11
        197: U            SHORT_BINSTRING 'Owner'
        204: q            BINPUT     12
        206: t            TUPLE      (MARK at 161)
        207: q        BINPUT     13
        209: U        SHORT_BINSTRING '_owner'
        217: q        BINPUT     14
        219: (        MARK
        220: ]            EMPTY_LIST
        221: q            BINPUT     15
        223: U            SHORT_BINSTRING 'acl_users'
        234: q            BINPUT     16
        236: a            APPEND
        237: U            SHORT_BINSTRING 'ERP5TypeTestCase'
        255: q            BINPUT     17
        257: t            TUPLE      (MARK at 219)
        258: q        BINPUT     18
        260: U        SHORT_BINSTRING 'portal_type'
        273: q        BINPUT     19
        275: U        SHORT_BINSTRING 'Visa File'
        286: q        BINPUT     20
        288: U        SHORT_BINSTRING '_Modify_portal_content_Permission'
        323: q        BINPUT     21
        325: (        MARK
        326: U            SHORT_BINSTRING 'Assignee'
        336: q            BINPUT     22
        338: U            SHORT_BINSTRING 'Assignor'
        348: q            BINPUT     23
        350: U            SHORT_BINSTRING 'Manager'
        359: q            BINPUT     24
        361: U            SHORT_BINSTRING 'Owner'
        368: q            BINPUT     25
        370: t            TUPLE      (MARK at 325)
        371: q        BINPUT     26
        373: U        SHORT_BINSTRING '_Access_contents_information_Permission'
        414: q        BINPUT     27
        416: (        MARK
        417: U            SHORT_BINSTRING 'Assignee'
        427: q            BINPUT     28
        429: U            SHORT_BINSTRING 'Assignor'
        439: q            BINPUT     29
        441: U            SHORT_BINSTRING 'Auditor'
        450: q            BINPUT     30
        452: U            SHORT_BINSTRING 'Manager'
        461: q            BINPUT     31
        463: U            SHORT_BINSTRING 'Owner'
        470: q            BINPUT     32
        472: t            TUPLE      (MARK at 416)
        473: q        BINPUT     33
        475: U        SHORT_BINSTRING '__ac_local_roles__'
        495: q        BINPUT     34
        497: }        EMPTY_DICT
        498: q        BINPUT     35
        500: (        MARK
        501: h            BINGET     17
        503: ]            EMPTY_LIST
        504: q            BINPUT     36
        506: U            SHORT_BINSTRING 'Owner'
        513: q            BINPUT     37
        515: a            APPEND
        516: U            SHORT_BINSTRING 'IS-ERPAD*_XXXFR*'
        534: q            BINPUT     38
        536: ]            EMPTY_LIST
        537: q            BINPUT     39
        539: U            SHORT_BINSTRING 'Assignor'
        549: q            BINPUT     40
        551: a            APPEND
        552: U            SHORT_BINSTRING 'DSO*'
        558: q            BINPUT     41
        560: ]            EMPTY_LIST
        561: q            BINPUT     42
        563: U            SHORT_BINSTRING 'Auditor'
        572: q            BINPUT     43
        574: a            APPEND
        575: U            SHORT_BINSTRING 'XXXFR*'
        583: q            BINPUT     44
        585: ]            EMPTY_LIST
        586: q            BINPUT     45
        588: U            SHORT_BINSTRING 'Auditor'
        597: q            BINPUT     46
        599: a            APPEND
        600: U            SHORT_BINSTRING 'AF*_XXXFR*'
        612: q            BINPUT     47
        614: ]            EMPTY_LIST
        615: q            BINPUT     48
        617: U            SHORT_BINSTRING 'Auditor'
        626: q            BINPUT     49
        628: a            APPEND
        629: u            SETITEMS   (MARK at 500)
        630: U        SHORT_BINSTRING 'id'
        634: q        BINPUT     50
        636: U        SHORT_BINSTRING '20220624-57DF4'
        652: q        BINPUT     51
        654: U        SHORT_BINSTRING '_View_Permission'
        672: q        BINPUT     52
        674: (        MARK
        675: U            SHORT_BINSTRING 'Assignee'
        685: q            BINPUT     53
        687: U            SHORT_BINSTRING 'Assignor'
        697: q            BINPUT     54
        699: U            SHORT_BINSTRING 'Auditor'
        708: q            BINPUT     55
        710: U            SHORT_BINSTRING 'Manager'
        719: q            BINPUT     56
        721: U            SHORT_BINSTRING 'Owner'
        728: q            BINPUT     57
        730: t            TUPLE      (MARK at 674)
        731: q        BINPUT     58
        733: U        SHORT_BINSTRING 'quantity'
        743: q        BINPUT     59
        745: G        BINFLOAT   1.0
        754: u        SETITEMS   (MARK at 3)
        755: .    STOP
      
      ** After **
      
      pickle size: 596
           0: }    EMPTY_DICT
          1: q    BINPUT     1
          3: (    MARK
          4: U        SHORT_BINSTRING 'default_reference'
         23: q        BINPUT     2
         25: U        SHORT_BINSTRING 'XXXX636'
         34: q        BINPUT     3
         36: U        SHORT_BINSTRING 'uid'
         41: q        BINPUT     4
         43: L        LONG       59700L
         51: U        SHORT_BINSTRING 'workflow_history'
         69: q        BINPUT     5
         71: (        MARK
         72: U            SHORT_BINSTRING '\x00\x00\x00\x00\x00\x07|.'
         82: q            BINPUT     6
         84: c            GLOBAL     'Persistence.mapping PersistentMapping'
        123: q            BINPUT     7
        125: t            TUPLE      (MARK at 71)
        126: Q        BINPERSID
        127: U        SHORT_BINSTRING '_Add_portal_content_Permission'
        159: q        BINPUT     8
        161: (        MARK
        162: U            SHORT_BINSTRING 'Assignee'
        172: q            BINPUT     9
        174: U            SHORT_BINSTRING 'Assignor'
        184: q            BINPUT     10
        186: U            SHORT_BINSTRING 'Manager'
        195: q            BINPUT     11
        197: U            SHORT_BINSTRING 'Owner'
        204: q            BINPUT     12
        206: t            TUPLE      (MARK at 161)
        207: q        BINPUT     13
        209: U        SHORT_BINSTRING '_owner'
        217: q        BINPUT     14
        219: (        MARK
        220: ]            EMPTY_LIST
        221: q            BINPUT     15
        223: U            SHORT_BINSTRING 'acl_users'
        234: q            BINPUT     16
        236: a            APPEND
        237: U            SHORT_BINSTRING 'ERP5TypeTestCase'
        255: q            BINPUT     17
        257: t            TUPLE      (MARK at 219)
        258: q        BINPUT     18
        260: U        SHORT_BINSTRING 'portal_type'
        273: q        BINPUT     19
        275: U        SHORT_BINSTRING 'Visa File'
        286: q        BINPUT     20
        288: U        SHORT_BINSTRING '_Modify_portal_content_Permission'
        323: q        BINPUT     21
        325: (        MARK
        326: h            BINGET     9
        328: h            BINGET     10
        330: h            BINGET     11
        332: h            BINGET     12
        334: t            TUPLE      (MARK at 325)
        335: q        BINPUT     22
        337: U        SHORT_BINSTRING '_Access_contents_information_Permission'
        378: q        BINPUT     23
        380: (        MARK
        381: h            BINGET     9
        383: h            BINGET     10
        385: U            SHORT_BINSTRING 'Auditor'
        394: q            BINPUT     24
        396: h            BINGET     11
        398: h            BINGET     12
        400: t            TUPLE      (MARK at 380)
        401: q        BINPUT     25
        403: U        SHORT_BINSTRING '__ac_local_roles__'
        423: q        BINPUT     26
        425: }        EMPTY_DICT
        426: q        BINPUT     27
        428: (        MARK
        429: h            BINGET     17
        431: ]            EMPTY_LIST
        432: q            BINPUT     28
        434: h            BINGET     12
        436: a            APPEND
        437: U            SHORT_BINSTRING 'IS-ERPAD*_XXXFR*'
        455: q            BINPUT     29
        457: ]            EMPTY_LIST
        458: q            BINPUT     30
        460: h            BINGET     10
        462: a            APPEND
        463: U            SHORT_BINSTRING 'DSO*'
        469: q            BINPUT     31
        471: ]            EMPTY_LIST
        472: q            BINPUT     32
        474: h            BINGET     24
        476: a            APPEND
        477: U            SHORT_BINSTRING 'XXXFR*'
        485: q            BINPUT     33
        487: ]            EMPTY_LIST
        488: q            BINPUT     34
        490: h            BINGET     24
        492: a            APPEND
        493: U            SHORT_BINSTRING 'AF*_XXXFR*'
        505: q            BINPUT     35
        507: ]            EMPTY_LIST
        508: q            BINPUT     36
        510: h            BINGET     24
        512: a            APPEND
        513: u            SETITEMS   (MARK at 428)
        514: U        SHORT_BINSTRING 'id'
        518: q        BINPUT     37
        520: U        SHORT_BINSTRING '20220624-1203CE'
        537: q        BINPUT     38
        539: U        SHORT_BINSTRING '_View_Permission'
        557: q        BINPUT     39
        559: (        MARK
        560: h            BINGET     9
        562: h            BINGET     10
        564: h            BINGET     24
        566: h            BINGET     11
        568: h            BINGET     12
        570: t            TUPLE      (MARK at 559)
        571: q        BINPUT     40
        573: U        SHORT_BINSTRING 'quantity'
        583: q        BINPUT     41
        585: G        BINFLOAT   1.0
        594: u        SETITEMS   (MARK at 3)
        595: .    STOP
      highest protocol among opcodes = 1
      ead3a27c
    • Jérome Perrin's avatar
      accounting: fix grouping dialog loosing section category on next page · 0d8242de
      Jérome Perrin authored
      In xhtml_style, just after clicking next or previous page in the listbox
      buttons, the values selected in 'Section Category' and 'Section Category
      Strict' were not used, because they were used from request and not from
      as normal script parameters.
      
      This fixes only the xhtml_style version, ERP5JS has another problem that
      dialog fields values are reset when going to next page, so it would also
      need this problem to be fixed.
      0d8242de
  2. 12 Jul, 2022 1 commit
  3. 07 Jul, 2022 2 commits
  4. 01 Jul, 2022 1 commit
  5. 27 Jun, 2022 1 commit
  6. 24 Jun, 2022 1 commit
  7. 23 Jun, 2022 2 commits
  8. 22 Jun, 2022 3 commits
  9. 21 Jun, 2022 4 commits
  10. 20 Jun, 2022 2 commits
  11. 15 Jun, 2022 10 commits
  12. 14 Jun, 2022 4 commits
  13. 13 Jun, 2022 7 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