report_designer.TIA.inc.php 1.3 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546
  1. <?php
  2. #$this; // object reference
  3. #$this->dbh; // initialized MySQL database handle
  4. #$this->key; // primary key name
  5. #$this->key_type; // primary key type
  6. #$this->key_delim; // primary key deliminator
  7. #$this->rec; // primary key value (update and delete only)
  8. #$newvals; // associative array of new values (update and insert only)
  9. #$oldvals; // associative array of old values (update and delete only)
  10. #$changed; // array of keys with changed values
  11. require_once 'auth.php';
  12. global $adodb;
  13. #$adodb->debug = 1;
  14. #var_dump($newvals);
  15. $copyid = $_REQUEST['copyid'];
  16. if ($copyid) {
  17. $insertID = $this->insert_id;
  18. $rs = $adodb->Execute("SELECT * FROM qb_report".
  19. " WHERE id = ? ", array($copyid));
  20. $record = $rs->fields;
  21. $rs = $adodb->Execute("SELECT * FROM qb_user_report".
  22. " WHERE name = ? ", array($record['name']));
  23. while (!$rs->EOF) {
  24. $record = $rs->fields;
  25. unset($record['id']);
  26. $record['name'] = $newvals['name'];
  27. $adodb->Execute($adodb->GetInsertSQL($rs, $record));
  28. $rs->MoveNext();
  29. }
  30. $rs = $adodb->Execute("SELECT * FROM qb_dictionary".
  31. " WHERE module = ? ", array('qb_report_'.$copyid));
  32. while (!$rs->EOF) {
  33. $record = $rs->fields;
  34. unset($record['id']);
  35. $record['module'] = 'qb_report_'.$insertID;
  36. $adodb->Execute($adodb->GetInsertSQL($rs, $record));
  37. $rs->MoveNext();
  38. }
  39. }
  40. ?>