Example #1
0
         $sql = "SELECT seqnum FROM " . DBRptFields . " WHERE reportid = " . $ReportID . " AND entrytype = '" . $EntryType . "';";
         $Result = DB_query($sql, $db, '', '', false, true);
         if ($SeqNum < DB_num_rows($Result)) {
             $success = ChangeSequence($_POST['SeqNum'], $EntryType, 'down');
         }
     } elseif (isset($_POST['ed_x'])) {
         // the sequence edit button was pushed
         $OverrideDefaults = true;
         // pre fill form with the field to edit and change button name
         $sql = "SELECT * FROM " . DBRptFields . "\n\t\t\t\t\tWHERE reportid = " . $ReportID . " AND entrytype = '" . $EntryType . "' AND seqnum=" . $SeqNum . ";";
         $Result = DB_query($sql, $db, '', '', false, true);
         $NewDefaults['defaults'] = DB_fetch_array($Result);
         $NewDefaults['defaults']['buttonvalue'] = RPT_BTN_CHANGE;
     } elseif (isset($_POST['rm_x'])) {
         // the sequence remove button was pushed
         $success = DeleteSequence($_POST['SeqNum'], $EntryType);
     }
     $reportname = $_POST['ReportName'];
     $FormParams = PrepStep('6');
 } else {
     switch ($_POST['todo']) {
         case RPT_BTN_BACK:
             $reportname = $_POST['ReportName'];
             $FormParams = PrepStep('5');
             break;
         case RPT_BTN_ADDNEW:
         case RPT_BTN_CHANGE:
             $EntryType = $_POST['EntryType'];
             //fetch the entry type
             // error check input
             $IsValidField = ValidateField($ReportID, $_POST['FieldName'], $_POST['DisplayDesc']);
     break;
 case 'edit':
     $OverrideDefaults = true;
     // pre fill form with the field to edit and change button name
     $sql = "select * from " . TABLE_REPORT_FIELDS . " \r\n\t\t\t\t\twhere reportid = " . $ReportID . " and entrytype = '" . $EntryType . "' and seqnum = " . $rowSeq;
     $result = $db->Execute($sql);
     $NewDefaults['defaults'] = $result->fields;
     $NewDefaults['defaults']['params'] = unserialize($result->fields['params']);
     //				$NewDefaults['defaults']['params']      = $temp_params[0];
     //				$NewDefaults['defaults']['minvalue']    = $temp_params[2];
     //				$NewDefaults['defaults']['maxvalue']    = $temp_params[3];
     $NewDefaults['defaults']['buttonvalue'] = TEXT_CHANGE;
     $FormParams = PrepStep('6');
     break;
 case 'delete':
     $success = DeleteSequence($rowSeq, $EntryType);
     $FormParams = PrepStep('6');
     break;
 case 'back':
     $FormParams = PrepStep('5');
     break;
 case 'add':
 case 'change':
     // error check input
     $IsValidField = ValidateField($ReportID, $_POST['FieldName'], $_POST['DisplayDesc']);
     if (!$IsValidField) {
         // then user entered a bad fieldname or description, error and reload
         $messageStack->add(RW_RPT_BADFLD, 'error');
         // reload form with bad data entered as field defaults, ready to be editted
         $OverrideDefaults = true;
         switch ($EntryType) {