summaryrefslogtreecommitdiff
path: root/backend/php/src/objects/class.recordversion.php
Unidiff
Diffstat (limited to 'backend/php/src/objects/class.recordversion.php') (more/less context) (ignore whitespace changes)
-rw-r--r--backend/php/src/objects/class.recordversion.php4
1 files changed, 3 insertions, 1 deletions
diff --git a/backend/php/src/objects/class.recordversion.php b/backend/php/src/objects/class.recordversion.php
index 3fbc436..f2de14a 100644
--- a/backend/php/src/objects/class.recordversion.php
+++ b/backend/php/src/objects/class.recordversion.php
@@ -211,96 +211,98 @@ class recordversion extends POG_Base
211 if ($GLOBALS['configuration']['db_encoding'] == 1) 211 if ($GLOBALS['configuration']['db_encoding'] == 1)
212 { 212 {
213 $sortBy = "BASE64_DECODE($sortBy) "; 213 $sortBy = "BASE64_DECODE($sortBy) ";
214 } 214 }
215 else 215 else
216 { 216 {
217 $sortBy = "$sortBy "; 217 $sortBy = "$sortBy ";
218 } 218 }
219 } 219 }
220 else 220 else
221 { 221 {
222 $sortBy = "$sortBy "; 222 $sortBy = "$sortBy ";
223 } 223 }
224 } 224 }
225 else 225 else
226 { 226 {
227 $sortBy = "recordversionid"; 227 $sortBy = "recordversionid";
228 } 228 }
229 $this->pog_query .= " order by ".$sortBy." ".($ascending ? "asc" : "desc")." $sqlLimit"; 229 $this->pog_query .= " order by ".$sortBy." ".($ascending ? "asc" : "desc")." $sqlLimit";
230 $thisObjectName = get_class($this); 230 $thisObjectName = get_class($this);
231 $cursor = Database::Reader($this->pog_query, $connection); 231 $cursor = Database::Reader($this->pog_query, $connection);
232 while ($row = Database::Read($cursor)) 232 while ($row = Database::Read($cursor))
233 { 233 {
234 $recordversion = new $thisObjectName(); 234 $recordversion = new $thisObjectName();
235 $recordversion->recordversionId = $row['recordversionid']; 235 $recordversion->recordversionId = $row['recordversionid'];
236 $recordversion->recordId = $row['recordid']; 236 $recordversion->recordId = $row['recordid'];
237 $recordversion->reference = $this->Unescape($row['reference']); 237 $recordversion->reference = $this->Unescape($row['reference']);
238 $recordversion->header = $this->Unescape($row['header']); 238 $recordversion->header = $this->Unescape($row['header']);
239 $recordversion->data = $this->Unescape($row['data']); 239 $recordversion->data = $this->Unescape($row['data']);
240 $recordversion->version = $this->Unescape($row['version']); 240 $recordversion->version = $this->Unescape($row['version']);
241 $recordversion->previous_version_key = $this->Unescape($row['previous_version_key']); 241 $recordversion->previous_version_key = $this->Unescape($row['previous_version_key']);
242 $recordversion->previous_version_id = $this->Unescape($row['previous_version_id']); 242 $recordversion->previous_version_id = $this->Unescape($row['previous_version_id']);
243 $recordversion->creation_date = $row['creation_date']; 243 $recordversion->creation_date = $row['creation_date'];
244 $recordversion->update_date = $row['update_date']; 244 $recordversion->update_date = $row['update_date'];
245 $recordversion->access_date = $row['access_date']; 245 $recordversion->access_date = $row['access_date'];
246 $recordversionList[] = $recordversion; 246 $recordversionList[] = $recordversion;
247 } 247 }
248 return $recordversionList; 248 return $recordversionList;
249 } 249 }
250 250
251 251
252 /** 252 /**
253 * Saves the object to the database 253 * Saves the object to the database
254 * @return integer $recordversionId 254 * @return integer $recordversionId
255 */ 255 */
256 function Save() 256 function Save()
257 { 257 {
258 $connection = Database::Connect(); 258 $connection = Database::Connect();
259 $this->update_date = date( 'Y-m-d H:i:s');
260 $this->access_date = date( 'Y-m-d H:i:s');
259 $this->pog_query = "select `recordversionid` from `recordversion` where `recordversionid`='".$this->recordversionId."' LIMIT 1"; 261 $this->pog_query = "select `recordversionid` from `recordversion` where `recordversionid`='".$this->recordversionId."' LIMIT 1";
260 $rows = Database::Query($this->pog_query, $connection); 262 $rows = Database::Query($this->pog_query, $connection);
261 if ($rows > 0) 263 if ($rows > 0)
262 { 264 {
263 $this->pog_query = "update `recordversion` set 265 $this->pog_query = "update `recordversion` set
264 `recordid`='".$this->recordId."', 266 `recordid`='".$this->recordId."',
265 `reference`='".$this->Escape($this->reference)."', 267 `reference`='".$this->Escape($this->reference)."',
266 `header`='".$this->Escape($this->header)."', 268 `header`='".$this->Escape($this->header)."',
267 `data`='".$this->Escape($this->data)."', 269 `data`='".$this->Escape($this->data)."',
268 `version`='".$this->Escape($this->version)."', 270 `version`='".$this->Escape($this->version)."',
269 `previous_version_key`='".$this->Escape($this->previous_version_key)."', 271 `previous_version_key`='".$this->Escape($this->previous_version_key)."',
270 `previous_version_id`='".$this->Escape($this->previous_version_id)."', 272 `previous_version_id`='".$this->Escape($this->previous_version_id)."',
271 `creation_date`='".$this->creation_date."', 273 `creation_date`='".$this->creation_date."',
272 `update_date`='".$this->update_date."', 274 `update_date`='".$this->update_date."',
273 `access_date`='".$this->access_date."' where `recordversionid`='".$this->recordversionId."'"; 275 `access_date`='".$this->access_date."' where `recordversionid`='".$this->recordversionId."'";
274 } 276 }
275 else 277 else
276 { 278 {
277 $this->pog_query = "insert into `recordversion` (`recordid`, `reference`, `header`, `data`, `version`, `previous_version_key`, `previous_version_id`, `creation_date`, `update_date`, `access_date` ) values ( 279 $this->pog_query = "insert into `recordversion` (`recordid`, `reference`, `header`, `data`, `version`, `previous_version_key`, `previous_version_id`, `creation_date`, `update_date`, `access_date` ) values (
278 '".$this->recordId."', 280 '".$this->recordId."',
279 '".$this->Escape($this->reference)."', 281 '".$this->Escape($this->reference)."',
280 '".$this->Escape($this->header)."', 282 '".$this->Escape($this->header)."',
281 '".$this->Escape($this->data)."', 283 '".$this->Escape($this->data)."',
282 '".$this->Escape($this->version)."', 284 '".$this->Escape($this->version)."',
283 '".$this->Escape($this->previous_version_key)."', 285 '".$this->Escape($this->previous_version_key)."',
284 '".$this->Escape($this->previous_version_id)."', 286 '".$this->Escape($this->previous_version_id)."',
285 '".$this->creation_date."', 287 '".$this->creation_date."',
286 '".$this->update_date."', 288 '".$this->update_date."',
287 '".$this->access_date."' )"; 289 '".$this->access_date."' )";
288 } 290 }
289 $insertId = Database::InsertOrUpdate($this->pog_query, $connection); 291 $insertId = Database::InsertOrUpdate($this->pog_query, $connection);
290 if ($this->recordversionId == "") 292 if ($this->recordversionId == "")
291 { 293 {
292 $this->recordversionId = $insertId; 294 $this->recordversionId = $insertId;
293 } 295 }
294 return $this->recordversionId; 296 return $this->recordversionId;
295 } 297 }
296 298
297 299
298 /** 300 /**
299 * Clones the object and saves it to the database 301 * Clones the object and saves it to the database
300 * @return integer $recordversionId 302 * @return integer $recordversionId
301 */ 303 */
302 function SaveNew() 304 function SaveNew()
303 { 305 {
304 $this->recordversionId = ''; 306 $this->recordversionId = '';
305 return $this->Save(); 307 return $this->Save();
306 } 308 }
@@ -333,49 +335,49 @@ class recordversion extends POG_Base
333 for ($i=0, $c=sizeof($fcv_array); $i<$c; $i++) 335 for ($i=0, $c=sizeof($fcv_array); $i<$c; $i++)
334 { 336 {
335 if (sizeof($fcv_array[$i]) == 1) 337 if (sizeof($fcv_array[$i]) == 1)
336 { 338 {
337 $pog_query .= " ".$fcv_array[$i][0]." "; 339 $pog_query .= " ".$fcv_array[$i][0]." ";
338 continue; 340 continue;
339 } 341 }
340 else 342 else
341 { 343 {
342 if ($i > 0 && sizeof($fcv_array[$i-1]) !== 1) 344 if ($i > 0 && sizeof($fcv_array[$i-1]) !== 1)
343 { 345 {
344 $pog_query .= " AND "; 346 $pog_query .= " AND ";
345 } 347 }
346 if (isset($this->pog_attribute_type[$fcv_array[$i][0]]['db_attributes']) && $this->pog_attribute_type[$fcv_array[$i][0]]['db_attributes'][0] != 'NUMERIC' && $this->pog_attribute_type[$fcv_array[$i][0]]['db_attributes'][0] != 'SET') 348 if (isset($this->pog_attribute_type[$fcv_array[$i][0]]['db_attributes']) && $this->pog_attribute_type[$fcv_array[$i][0]]['db_attributes'][0] != 'NUMERIC' && $this->pog_attribute_type[$fcv_array[$i][0]]['db_attributes'][0] != 'SET')
347 { 349 {
348 $pog_query .= "`".$fcv_array[$i][0]."` ".$fcv_array[$i][1]." '".$this->Escape($fcv_array[$i][2])."'"; 350 $pog_query .= "`".$fcv_array[$i][0]."` ".$fcv_array[$i][1]." '".$this->Escape($fcv_array[$i][2])."'";
349 } 351 }
350 else 352 else
351 { 353 {
352 $pog_query .= "`".$fcv_array[$i][0]."` ".$fcv_array[$i][1]." '".$fcv_array[$i][2]."'"; 354 $pog_query .= "`".$fcv_array[$i][0]."` ".$fcv_array[$i][1]." '".$fcv_array[$i][2]."'";
353 } 355 }
354 } 356 }
355 } 357 }
356 return Database::NonQuery($pog_query, $connection); 358 return Database::NonQuery($pog_query, $connection);
357 } 359 }
358 } 360 }
359 361
360 362
361 /** 363 /**
362 * Associates the record object to this one 364 * Associates the record object to this one
363 * @return boolean 365 * @return boolean
364 */ 366 */
365 function GetRecord() 367 function GetRecord()
366 { 368 {
367 $record = new record(); 369 $record = new record();
368 return $record->Get($this->recordId); 370 return $record->Get($this->recordId);
369 } 371 }
370 372
371 373
372 /** 374 /**
373 * Associates the record object to this one 375 * Associates the record object to this one
374 * @return 376 * @return
375 */ 377 */
376 function SetRecord(&$record) 378 function SetRecord(&$record)
377 { 379 {
378 $this->recordId = $record->recordId; 380 $this->recordId = $record->recordId;
379 } 381 }
380} 382}
381?> \ No newline at end of file 383?>