Forum

Welcome to ProjeQtOr new Forum. We migrated old forum to the new website.
You will find all your posts here, with your usual account.
Just one point : you’ll have to reinitialize your password. Use “Lost password” feature.

Receive Document Ve...
 
Notifications
Clear all

Receive Document Versions details by email

4 Posts
2 Users
0 Reactions
3,039 Views
(@papjul)
Posts: 143
Active Member
Topic starter
 
[#5627]

Dear ProjeQtOr developers,

My team was frustrated because when a new version of a document was added to a document, the email they receive didn't include anything regarding the document version.

So I added a document version section in the code and I believe it's worth adding to original ProjeQtOr version.

In SqlElement.php, in getMailDetail() function, it should be added around line 5361, just before the line

if (isset ( $this->_Note ) and is_array ( $this->_Note )) {

The following code:

	// ADDITION BY papjul - Document Version details
    if (isset ( $this->_DocumentVersion ) and is_array ( $this->_DocumentVersion )) {
      $msg .= $rowStart . $sectionStart . i18n ( 'sectionDocumentVersion' ) . $sectionEnd . $rowEnd;
      $documentVersion = new DocumentVersion ();
      $documentVersions = $documentVersion->getSqlElementsFromCriteria ( array('idDocument' => $this->id), false, null, 'name desc' );
      foreach ( $documentVersions as $documentVersion ) {
		  $name = $documentVersion->name;
		  $versionDate = $documentVersion->versionDate;
          $msg .= $rowStart . $labelStart;
          $msg .= $name;
          $msg .= '
'; $msg .= htmlFormatDateTime ( $versionDate ); $msg .= $labelEnd . $fieldStart; $msg .= $documentVersion->fileName; $msg .= '
'; $text = new Html2Text ( $documentVersion->description ); $plainText = $text->getText (); if (mb_strlen ( $plainText ) > 10000) { // Should not send too long email $descriptionTruncated = nl2br ( mb_substr ( $plainText, 0, 10000 ) ); $msg .= $descriptionTruncated; } else { $msg .= $documentVersion->description; } $msg .= $fieldEnd . $rowEnd; } } // End of ADDITION BY papjul - Document Version details

 
Posted : 17 Dec 2018 18H53
babynus
(@babynus)
Posts: 14966
Main Contributor Admin
 

Great !

This patch will be included in V7.4.0.

Thanks.


 
Posted : 17 Dec 2018 19H37
(@papjul)
Posts: 143
Active Member
Topic starter
 

Hi babynus,

Little fix.
We noticed that we received document versions in wrong order in some rare cases. For example:
V4.9
V4.8
[...]
V4.2
V4.12
V4.11
V4.10
V4.1

I chose to replace "name desc" by "createDateTime desc" in the previous code. What do you think? What would be the best field to sort by? What does the Document screen in ProjeQtOr itself use?


 
Posted : 07 Feb 2019 16H29
babynus
(@babynus)
Posts: 14966
Main Contributor Admin
 

Best is sort on id (used in the screen).
It will be done on patch 7.4.1


 
Posted : 08 Feb 2019 11H54
Share:

Scroll to Top