GithubHelp home page GithubHelp logo

Comments (18)

voytec69 avatar voytec69 commented on June 15, 2024

tak wygląda w bazie dokument którego nie mogę wyświetlić

SELECT * from documentattachments  WHERE docid = 317160 ORDER BY docid ASC, type DESC;
  id   | docid  |         filename         |   contenttype   |              md5sum              | type | cdate
-------+--------+--------------------------+-----------------+----------------------------------+------+-------
 29220 | 317160 | ssssss_DANUTA - u.pdf | application/pdf | 94197cc3186fb7b8b2f7ffd644ca7b8f |    0 |     0

from lms.

voytec69 avatar voytec69 commented on June 15, 2024

Zapytania z procesu wyświetlania teg dokumentu wyglądają tak.

SELECT 1 FROM documents WHERE id = '317160';
 ?column?
----------
        1
(1 row)
SELECT d.id FROM documents d
                JOIN docrights r ON (r.doctype = d.type)
                WHERE d.id IN (317160)
                    AND d.type < 0
                    AND r.userid = '2'
                    AND (r.rights & 1) > 0;
   id
--------
 317160
(1 row)
SELECT filename, contenttype, md5sum
                    FROM documentattachments
                    WHERE docid IN ('317160') AND type = 1 ORDER BY docid ASC, type DESC;
 filename | contenttype | md5sum
----------+-------------+--------
(0 rows)

from lms.

voytec69 avatar voytec69 commented on June 15, 2024

Commit 6527b4f

Było

WHERE docid IN ?
ORDER BY docid ASC, type DESC',

Jest

WHERE docid IN ?'
. ($attachments || !empty($attachmentid) ? '' : ' AND type = 1')
. (empty($attachmentid) ? '' : ' AND id = ' . $attachmentid)
. ' ORDER BY docid ASC, type DESC',

Zmieniłem linie u siebie

. ($attachments || !empty($attachmentid) ? '' : ' AND type = 1')

na

. ($attachments || !empty($attachmentid) ? '' : '')

I działa, ale to słabe rozwiązanie problemu :) i zapewne wygeneruje inne...

from lms.

voytec69 avatar voytec69 commented on June 15, 2024

O ile dobrze rozumiem logikę documentadd.php to plik generowany w systemie ma

'attachmenttype' => 1,

a ten uploadowany ma
$attachment['attachmenttype'] = 0;

jak to się ma do tego warunku type = 1 w documentview.php ?

from lms.

chilek avatar chilek commented on June 15, 2024

attachmenttype = 1 (pole type w tabeli documentattachments) - to załącznik główny dokumentu i jest zwykle generowany na podstawie szablonu HTML.

from lms.

chilek avatar chilek commented on June 15, 2024

Jest

WHERE docid IN ?'
. ($attachments || !empty($attachmentid) ? '' : ' AND type = 1')
. (empty($attachmentid) ? '' : ' AND id = ' . $attachmentid)
. ' ORDER BY docid ASC, type DESC',

Jeśli do ?m=documentview przekazano attachmentid, tzn. że chcemy obejrzeć konkretny plik z załącznikem dokumentu i wtedy potrzebny jest warunek AND id = ' . $attachmentid, a jednocześnie nie powinniśmy testować, czy załącznik jest głównym (niepotrzebny więc warunek AND type = 1).

Jeśli $attachments jest niepuste, tzn. że chcemy obejrzeć wszystkie załączniki w postaci sklejonego HTML lub PDF i dlatego też nie powinniśmy tworzyć warunku AND type = 1).

Typ własny dokumentu nie ma nic wspólnego z typem załącznika. Typ dokumentu to pole type w tabeli documents, a typ załącznika dokumentu to pole type w tabeli documentattachments.

Z ciekawości - co pokazuje Ci polecenie:

pdfinfo 'ssssss_DANUTA - u.pdf'

?

from lms.

chilek avatar chilek commented on June 15, 2024

Jaki wynik zwraca zapytanie:

SELECT filename, contenttype, md5sum
                    FROM documentattachments
                    WHERE docid = 317160;

?

from lms.

voytec69 avatar voytec69 commented on June 15, 2024

Wynik już wrzucałem wyżej:
#2330 (comment)

i tu proces z logow postgresa. Jak widac dla tego dokumentu testowal warunek and type = 1 w konsekwencji nie zwraca tego co trzeba.
#2330 (comment)

Ta logika którą wprowadziłeś, za pewne nie ogarnia (bo skąd), sposobu dodawania pdfów (zaszłość) przez bok.
Odbywa się to poprzez Dokument->Nowy dokument.

attachmenttype = 1 (pole type w tabeli documentattachments) - to załącznik główny dokumentu i jest zwykle generowany na podstawie szablonu HTML.

No czyli tu pewnie jest pies pogrzebany, bo dokument nie powstał na bazie żadnego szablonu.

Typ dokumentu skan jest własny, dodany w definitions.php

Zrzut ekranu 2022-11-9 o 18 56 42

Nie napisałem precyzyjnie też, bo to dotyczy wszystkich dokumentów dodanych w ten sposób, ten jeden to przykład tylko.
(do momentu wprowadzenia tego warunku, otwierały się wszystkie bez problemu).

from lms.

voytec69 avatar voytec69 commented on June 15, 2024

Żeby była jasność, to te pdfy to fizyczne skany nie wiem, ulotki, oświadczenia, mapki ale też samej umowy wydrukowanej i podpisanej przez klienta.

from lms.

voytec69 avatar voytec69 commented on June 15, 2024

odwzorowałem to na demo.lms.org.pl https://demo.lms.org.pl/?m=documentlist&c=10 dokument aaa_test

from lms.

voytec69 avatar voytec69 commented on June 15, 2024

@chilek potrzebne ci dodatkowe info?

from lms.

chilek avatar chilek commented on June 15, 2024

Proszę o testy po poprawce, którą przesłałem.

from lms.

voytec69 avatar voytec69 commented on June 15, 2024

To samo.
PHP Warning: Invalid argument supplied for foreach() in /modules/documentview.php on line 76

Problem jest raczej w zapytaniu które powinno coś zwrócić.

from lms.

voytec69 avatar voytec69 commented on June 15, 2024

Poprawka, jednak jest ok, mialem jedno niezamknięte okno LMSa, które wprowadziło mnie w błąd.

from lms.

voytec69 avatar voytec69 commented on June 15, 2024

Dzięki, zamykam.

from lms.

voytec69 avatar voytec69 commented on June 15, 2024

Jednak jak klika się w wiersz to się nie otwiera dokument. testowane na demo.lms.org.pl

blank_page_docs_s2.mov

from lms.

interduo avatar interduo commented on June 15, 2024

Może warto użyć w tym miejscu:
https://github.com/interduo/lms/blob/master/js/lms-ui-fileview.js ?

Fajnie to działa dla plików PDF.

from lms.

chilek avatar chilek commented on June 15, 2024

Naprawione.

from lms.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.