View ProjeQtOr On SourceForge.net
ProjeQtOr - Project Management Tool
Support us on Capterra
OIN - Open Invention Network
ProjeQtOr free project management software - Receive Document Versions details by email - ProjeQtOr
 
 

Receive Document Versions details by email

More
17 Dec 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
The topic has been locked.
More
17 Dec 2018 17:37 #2 by babynus
Great !

This patch will be included in V7.4.0.

Thanks.

Babynus
Administrator of ProjeQtOr web site
The topic has been locked.
More
07 Feb 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?
The topic has been locked.
More
08 Feb 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
The topic has been locked.
Moderators: babynusprotion
Time to create page: 0.043 seconds

Cookies settings

×

Functional Cookies

Ce site utilise des cookies pour assurer son bon fonctionnement et ne peuvent pas être désactivés de nos systèmes. Nous ne les utilisons pas à des fins publicitaires. Si ces cookies sont bloqués, certaines parties du site ne pourront pas fonctionner.

Session

Please login to see yours activities!

Other cookies

Ce site web utilise un certain nombre de cookies pour gérer, par exemple, les sessions utilisateurs.