@@ -764,14 +764,15 @@ angular.module('mm.addons.mod_glossary')
764764 * @param {Number } courseId Course ID of the glossary.
765765 * @param {Array } [options] Array of options for the entry.
766766 * @param {Mixed } [attach] Attachments ID if sending online, result of $mmFileUploader#storeFilesToUpload otherwise.
767+ * @param {Number } [timecreated] The time the entry was created. If not defined, current time.
767768 * @param {String } [siteId] Site ID. If not defined, current site.
768769 * @param {Object } [discardEntry] The entry provided will be discarded if found.
769770 * @param {Boolean } allowOffline True if it can be stored in offline, false otherwise.
770771 * @param {Boolean } [checkDuplicates] Check for duplicates before storing offline. Only used if allowOffline is true.
771772 * @return {Promise } Promise resolved with entry ID if entry was created in server, false if stored in device.
772773 */
773- self . addEntry = function ( glossaryId , concept , definition , courseId , options , attach , siteId , discardEntry , allowOffline ,
774- checkDuplicates ) {
774+ self . addEntry = function ( glossaryId , concept , definition , courseId , options , attach , timecreated , siteId , discardEntry ,
775+ allowOffline , checkDuplicates ) {
775776 siteId = siteId || $mmSite . getId ( ) ;
776777
777778 if ( ! $mmApp . isOnline ( ) && allowOffline ) {
@@ -800,15 +801,15 @@ angular.module('mm.addons.mod_glossary')
800801
801802 // Convenience function to store a new entry to be synchronized later.
802803 function storeOffline ( ) {
803- var timecreated = discardEntry && discardEntry . timecreated ,
804- duplicatesPromise = checkDuplicates ? self . isConceptUsed ( glossaryId , concept , timecreated , siteId ) : $q . when ( false ) ;
804+ var discardTime = discardEntry && discardEntry . timecreated ,
805+ duplicatesPromise = checkDuplicates ? self . isConceptUsed ( glossaryId , concept , discardTime , siteId ) : $q . when ( false ) ;
805806 // Check if the entry is duplicated in online or offline mode.
806807 return duplicatesPromise . then ( function ( used ) {
807808 if ( used ) {
808809 return $mmLang . translateAndReject ( 'mma.mod_glossary.errconceptalreadyexists' ) ;
809810 }
810811
811- return $mmaModGlossaryOffline . saveAddEntry ( glossaryId , concept , definition , courseId , options , attach ,
812+ return $mmaModGlossaryOffline . saveAddEntry ( glossaryId , concept , definition , courseId , options , attach , timecreated ,
812813 siteId , undefined , discardEntry ) . then ( function ( ) {
813814 return false ;
814815 } ) ;
@@ -909,7 +910,6 @@ angular.module('mm.addons.mod_glossary')
909910 return true ;
910911 }
911912 }
912-
913913 return false ;
914914 } ) ;
915915 } ) . catch ( function ( ) {
0 commit comments