ProjeQtOr free project management software - Receive Document Versions details by email - ProjeQtOr
 

Receive Document Versions details by email

More
17 Déc 2018 16:53 #1 by papjul
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 .= '<br />';
          $msg .= htmlFormatDateTime ( $versionDate );
          $msg .= $labelEnd . $fieldStart;
          $msg .= $documentVersion->fileName;
          $msg .= '<br />';
          $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

Please Connexion or Create an account to join the conversation.

More
17 Déc 2018 17:37 #2 by babynus
Great !

This patch will be included in V7.4.0.

Thanks.

Babynus
Administrator of ProjeQtOr web site

Please Connexion or Create an account to join the conversation.

More
07 Fév 2019 14:29 #3 by papjul
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?

Please Connexion or Create an account to join the conversation.

More
08 Fév 2019 09:54 #4 by babynus
Best is sort on id (used in the screen).
It will be done on patch 7.4.1

Babynus
Administrator of ProjeQtOr web site

Please Connexion or Create an account to join the conversation.

Moderators: babynusprotion
Time to create page: 0.028 seconds