]> lifelog.hopto.org Git - LifeLog.git/commitdiff
Sticky log type entries and work on bugs started.
authorMetabox <redacted>
Thu, 3 Oct 2019 06:07:38 +0000 (16:07 +1000)
committerMetabox <redacted>
Thu, 3 Oct 2019 06:07:38 +0000 (16:07 +1000)
Current Development Check List.md
htdocs/cgi-bin/config.cgi
htdocs/cgi-bin/login_ctr.cgi
htdocs/cgi-bin/main.cgi

index 0889ca8c0833cb547cf0692e6cc7e4cb54ef4e28..5b576bd5648d4c38b7847826717306cd046d393e 100644 (file)
@@ -21,6 +21,7 @@ This version is not compatible in data structure to prior versions. Data migrati
 
 
 ## Urgent FIXES and Known Issuses
+* CVS Export and Import has not been implemented for RTF type log entries.
 &#10004; Dynamic toggle of page sections, interaction fixed, bettered.
 &#10004; View by Date - search not showing current month entries.
 &#10004; Fix Interaction jumping edits and creating new entries via now button.
@@ -68,6 +69,7 @@ This version is not compatible in data structure to prior versions. Data migrati
 >&#10004; Deletion of log, deletes the document.
 
 ## Bugs
+* Bug - 09 RTF documents lost on data renumeration of log. Data fix options in config. Needs urgent revision.
 * Bug - 08 CSV imports duplicate on DB Fix in config page.
 * Bug - 07, Editing and RTF entry, Dosen't strip the attached html to view in place.
 * &#10004; Bug - 06, Invalid Time 00. Javascript error thrown, when 00am used.
index 866d32aa858aaa9066fda6cc90b53f13e4ef58df..6865a28c7394ac7bd61021a3319697b3ee92ec0b 100755 (executable)
@@ -721,7 +721,7 @@ try{
         $db->do('BEGIN TRANSACTION;');
         #Check for duplicates, which are possible during imports or migration as internal rowid is not primary in log.
         $dbs = dbExecute('SELECT rowid, DATE FROM LOG ORDER BY DATE;');                        
-        while(my @row = $dbs->fetchrow_array()) {
+        while(@row = $dbs->fetchrow_array()) {
             my $existing = $dates{$row[0]};
             if($existing && $existing eq $row[1]){
                 $dlts[$cntr_del++] = $row[0];
@@ -730,7 +730,7 @@ try{
                 $dates{$row[0]} = $row[1];
                 $updts[$cntr_upd++] = $row[0];
             }
-        }      
+        }
 
         foreach my $del (@dlts){
             $issue = "DELETE FROM LOG WHERE rowid=$del;";
@@ -739,13 +739,26 @@ try{
                     $st_del->execute();
         }
 
-        #Renumerate Log!
+        #Renumerate Log! Copy into temp. table.
         $dbs = dbExecute("CREATE TABLE life_log_temp_table AS SELECT * FROM LOG;");
-        $dbs = dbExecute('SELECT rowid, DATE FROM LOG ORDER BY DATE;');                
-        # Delete Orphaned Notes entries.                       
-        $dbs = dbExecute("SELECT LID, LOG.rowid from NOTES LEFT JOIN LOG ON 
-                                        NOTES.LID = LOG.rowid WHERE LOG.rowid is NULL;");                      
-        while(my @row = $dbs->fetchrow_array()) {                              
+        $dbs = dbExecute('SELECT rowid, DATE FROM LOG WHERE RTF == 1 ORDER BY DATE;');
+        #update  notes with new log id
+        while(@row = $dbs->fetchrow_array()) {
+            my $sql_date = $row[1];
+            #$sql_date =~ s/T/ /;
+            $sql_date = DateTime::Format::SQLite->parse_datetime($sql_date);
+            $issue = "SELECT rowid, DATE FROM life_log_temp_table WHERE RTF = 1 AND DATE = '".$sql_date."';";
+            $dbs = dbExecute($issue);
+            my @new  = $dbs->fetchrow_array();
+            if(scalar @new > 0){
+               $db->do("UPDATE NOTES SET LID =". $new[0]." WHERE LID==".$row[0].";");
+            }
+        }
+
+        # Delete Orphaned Notes entries.
+        $dbs = dbExecute("SELECT LID, LOG.rowid from NOTES LEFT JOIN LOG ON
+                                        NOTES.LID = LOG.rowid WHERE LOG.rowid is NULL;");
+        while(my @row = $dbs->fetchrow_array()) {
             $db->do("DELETE FROM NOTES WHERE LID=$row[0];");
         }
         $dbs = dbExecute('DROP TABLE LOG;');
@@ -756,7 +769,6 @@ try{
                                 AMOUNT INTEGER,
                                 AFLAG TINY DEFAULT 0,
                                 RTF BOOL DEFAULT 0);));
-
         $dbs = dbExecute('INSERT INTO LOG (ID_CAT,DATE,LOG,AMOUNT,AFLAG, RTF)
                                       SELECT ID_CAT, DATE, LOG, AMOUNT, AFLAG, RTF 
                                       FROM life_log_temp_table ORDER by DATE;');
@@ -780,7 +792,7 @@ try{
 }
 catch{ 
     $db->do('ROLLBACK;');
-    die qq(@&processDBFix error:$_ with statement->$issue for $date update counter:$cntr_upd); 
+    die qq(@&processDBFix error:$_ with statement->$issue for $date update counter:$cntr_upd);
 }
 }
 
@@ -1023,6 +1035,7 @@ sub updateLOGDB {
             my $amv    = $flds[3];
             my $amf    = $flds[4];
             my $rtf    = $flds[5];
+            my $sticky = $flds[6];
             my $pdate = DateTime::Format::SQLite->parse_datetime($date);
             #Check if valid date log entry?
             if($id_cat==0||$id_cat==""||!$pdate){
@@ -1032,21 +1045,21 @@ sub updateLOGDB {
             $dbs = $db->prepare("SELECT ID_CAT, DATE, LOG, AMOUNT, AFLAG, RTF  FROM LOG WHERE date = '$date';");
             $dbs->execute();
             if(!$dbs->fetchrow_array()){
-                    $dbs = $db->prepare('INSERT INTO LOG VALUES (?,?,?,?,?,?)');
-                    $dbs->execute( $id_cat, $pdate, $log, $amv, $amf, $rtf);
+                    $dbs = $db->prepare('INSERT INTO LOG VALUES (?,?,?,?,?,?, ?)');
+                    $dbs->execute( $id_cat, $pdate, $log, $amv, $amf, $rtf, $sticky);
             }
             #Renumerate
-            $dbs = $db->prepare('select rowid from LOG ORDER BY DATE;');
-            $dbs->execute();
-            my @row = $dbs->fetchrow_array();
-            my $cnt = 1;
-             while(my @row = $dbs->fetchrow_array()) {
-            my $st_upd = $db->prepare("UPDATE LOG SET rowid=".$cnt.
-                                        " WHERE rowid='".$row[0]."';");
-                $st_upd->execute();
-                $cnt = $cnt + 1;
-            }
-            $dbs->finish;
+            $dbs = $db->prepare('select rowid from LOG ORDER BY DATE;');
+            $dbs->execute();
+            my @row = $dbs->fetchrow_array();
+            my $cnt = 1;
+             while(my @row = $dbs->fetchrow_array()) {
+            my $st_upd = $db->prepare("UPDATE LOG SET rowid=".$cnt.
+                                        " WHERE rowid='".$row[0]."';");
+                $st_upd->execute();
+                $cnt = $cnt + 1;
+            }
+            #$dbs->finish;
     }
     catch{
         print "<font color=red><b>SERVER ERROR</b>->exportLogToCSV</font>:".$_;
index dd5e54450ac7016733cf324b7e7e3e64312fbc96..f4dfb4a58005620aa0aee6c04df28e4baac1a2ba 100755 (executable)
@@ -190,15 +190,15 @@ try{
              AMOUNT INTEGER DEFAULT 0,
              AFLAG TINY DEFAULT 0,
              RTF BOOL DEFAULT 0,
-             STICKY BOOL DEFAULT 0;
+             STICKY BOOL DEFAULT 0
         );
         CREATE INDEX idx_log_dates ON LOG (DATE);
         );
         $rv = $db->do($stmt);
         if($rv < 0){print "<p>Error->"& $DBI::errstri &"</p>";}
 
-        $st = $db->prepare('INSERT INTO LOG VALUES (?,?,?,?,?,?)');
-        $st->execute( 3, $today, "DB Created!",0,0,0);
+        $st = $db->prepare('INSERT INTO LOG VALUES (?,?,?,?,?,?,?)');
+        $st->execute( 3, $today, "DB Created!",0,0,0, 0);
       }
     $st = $db->prepare(selSQLTbl('CAT'));
     $st->execute();
index 51a143d46f1debd4504aa0074ef8c00bcf5fcb89..83147fa947361b88c0c950d3aa760277e46ddb6c 100755 (executable)
@@ -851,6 +851,7 @@ return $today;
         my $view_all  = $cgi->param('rs_all');
         my $is_rtf    = $cgi->param('rtf');
         my $rtf       = 0;
+        my $sticky    = 0;
         $rtf = 1 if $is_rtf eq 'on';
 
         try {
@@ -901,8 +902,8 @@ return $today;
                     return;
                 }
 
-                $st = $db->prepare('INSERT INTO LOG VALUES (?,?,?,?,?,?)');
-                $st->execute( $cat, $date, $log, $am, $af, $rtf );
+                $st = $db->prepare('INSERT INTO LOG VALUES (?,?,?,?,?,?,?)');
+                $st->execute( $cat, $date, $log, $am, $af, $rtf, $sticky );
                 if($rtf){ #Update 0 ground NOTES entry to the just inserted log.
                    
                    #last_insert_id() -> Not reliable commented out.