Fossil SCM

Improvements to TH1 variable setup when processing tickets that use TICKETCHNG.

drh 2012-11-26 16:28 UTC ticket-enhancements
Commit cc8a32562239e71f4fc6c7df7bb689cb130813aa
1 file changed +9 -19
+9 -19
--- src/tkt.c
+++ src/tkt.c
@@ -143,33 +143,22 @@
143143
}else if( strncmp(zName, "private_", 8)==0 ){
144144
zVal = zRevealed = db_reveal(zVal);
145145
}
146146
if( (j = fieldId(zName))>=0 ){
147147
aField[j].zValue = mprintf("%s", zVal);
148
- }
149
- if( Th_Fetch(zName, &size)==0 ){
148
+ }else if( memcmp(zName, "tkt_", 4)==0 && Th_Fetch(zName, &size)==0 ){
150149
Th_Store(zName, zVal);
151150
}
152151
free(zRevealed);
153152
}
154
- }else{
155
- db_finalize(&q);
156
- db_prepare(&q, "PRAGMA table_info(ticket)");
157
- if( Th_Fetch("tkt_uuid",&size)==0 ){
158
- Th_Store("tkt_uuid",zName);
159
- }
160
- while( db_step(&q)==SQLITE_ROW ){
161
- const char *zField = db_column_text(&q, 1);
162
- if( Th_Fetch(zField, &size)==0 ){
163
- Th_Store(zField, "");
164
- }
165
- }
166
- if( Th_Fetch("tkt_datetime",&size)==0 ){
167
- Th_Store("tkt_datetime","");
168
- }
169
- }
170
- db_finalize(&q);
153
+ }
154
+ db_finalize(&q);
155
+ for(i=0; i<nField; i++){
156
+ if( Th_Fetch(aField[i].zName, &size)==0 ){
157
+ Th_Store(aField[i].zName, aField[i].zValue);
158
+ }
159
+ }
171160
}
172161
173162
/*
174163
** Transfer all CGI parameters to variables in the interpreter.
175164
*/
@@ -384,10 +373,11 @@
384373
}
385374
style_header("View Ticket");
386375
if( g.thTrace ) Th_Trace("BEGIN_TKTVIEW<br />\n", -1);
387376
ticket_init();
388377
initializeVariablesFromCGI();
378
+ getAllTicketFields();
389379
initializeVariablesFromDb();
390380
zScript = ticket_viewpage_code();
391381
if( g.thTrace ) Th_Trace("BEGIN_TKTVIEW_SCRIPT<br />\n", -1);
392382
Th_Render(zScript);
393383
if( g.thTrace ) Th_Trace("END_TKTVIEW<br />\n", -1);
394384
--- src/tkt.c
+++ src/tkt.c
@@ -143,33 +143,22 @@
143 }else if( strncmp(zName, "private_", 8)==0 ){
144 zVal = zRevealed = db_reveal(zVal);
145 }
146 if( (j = fieldId(zName))>=0 ){
147 aField[j].zValue = mprintf("%s", zVal);
148 }
149 if( Th_Fetch(zName, &size)==0 ){
150 Th_Store(zName, zVal);
151 }
152 free(zRevealed);
153 }
154 }else{
155 db_finalize(&q);
156 db_prepare(&q, "PRAGMA table_info(ticket)");
157 if( Th_Fetch("tkt_uuid",&size)==0 ){
158 Th_Store("tkt_uuid",zName);
159 }
160 while( db_step(&q)==SQLITE_ROW ){
161 const char *zField = db_column_text(&q, 1);
162 if( Th_Fetch(zField, &size)==0 ){
163 Th_Store(zField, "");
164 }
165 }
166 if( Th_Fetch("tkt_datetime",&size)==0 ){
167 Th_Store("tkt_datetime","");
168 }
169 }
170 db_finalize(&q);
171 }
172
173 /*
174 ** Transfer all CGI parameters to variables in the interpreter.
175 */
@@ -384,10 +373,11 @@
384 }
385 style_header("View Ticket");
386 if( g.thTrace ) Th_Trace("BEGIN_TKTVIEW<br />\n", -1);
387 ticket_init();
388 initializeVariablesFromCGI();
 
389 initializeVariablesFromDb();
390 zScript = ticket_viewpage_code();
391 if( g.thTrace ) Th_Trace("BEGIN_TKTVIEW_SCRIPT<br />\n", -1);
392 Th_Render(zScript);
393 if( g.thTrace ) Th_Trace("END_TKTVIEW<br />\n", -1);
394
--- src/tkt.c
+++ src/tkt.c
@@ -143,33 +143,22 @@
143 }else if( strncmp(zName, "private_", 8)==0 ){
144 zVal = zRevealed = db_reveal(zVal);
145 }
146 if( (j = fieldId(zName))>=0 ){
147 aField[j].zValue = mprintf("%s", zVal);
148 }else if( memcmp(zName, "tkt_", 4)==0 && Th_Fetch(zName, &size)==0 ){
 
149 Th_Store(zName, zVal);
150 }
151 free(zRevealed);
152 }
153 }
154 db_finalize(&q);
155 for(i=0; i<nField; i++){
156 if( Th_Fetch(aField[i].zName, &size)==0 ){
157 Th_Store(aField[i].zName, aField[i].zValue);
158 }
159 }
 
 
 
 
 
 
 
 
 
 
160 }
161
162 /*
163 ** Transfer all CGI parameters to variables in the interpreter.
164 */
@@ -384,10 +373,11 @@
373 }
374 style_header("View Ticket");
375 if( g.thTrace ) Th_Trace("BEGIN_TKTVIEW<br />\n", -1);
376 ticket_init();
377 initializeVariablesFromCGI();
378 getAllTicketFields();
379 initializeVariablesFromDb();
380 zScript = ticket_viewpage_code();
381 if( g.thTrace ) Th_Trace("BEGIN_TKTVIEW_SCRIPT<br />\n", -1);
382 Th_Render(zScript);
383 if( g.thTrace ) Th_Trace("END_TKTVIEW<br />\n", -1);
384

Keyboard Shortcuts

Open search /
Next entry (timeline) j
Previous entry (timeline) k
Open focused entry Enter
Show this help ?
Toggle theme Top nav button