concrete/blocks/form/mini_survey.php
public static function questionCleanup($qsID = 0, $bID = 0)
    {
        $db = Database::connection();

        //First make sure that the bID column has been set for this questionSetId (for backwards compatibility)
        $vals = array(intval($qsID));
        $questionsWithBIDs = $db->fetchColumn('SELECT count(*) FROM btFormQuestions WHERE bID!=0 AND questionSetId=? ', $vals);

        //form block was just upgraded, so set the bID column
        if (!$questionsWithBIDs) {
            $vals = array(intval($bID), intval($qsID));
            $rs = $db->executeQuery('UPDATE btFormQuestions SET bID=? WHERE bID=0 AND questionSetId=?', $vals);

            return;
        }

        //Then remove all temp/placeholder questions for this questionSetId that haven't been assigned to a block
        $vals = array(intval($qsID));
        $rs = $db->executeQuery('DELETE FROM btFormQuestions WHERE bID=0 AND questionSetId=?', $vals);
    }
public static function questionCleanup($qsID = 0, $bID = 0)
    {
        $db = Database::connection();

        //First make sure that the bID column has been set for this questionSetId (for backwards compatibility)
        $vals = array(intval($qsID));
        $questionsWithBIDs = $db->fetchColumn('SELECT count(*) FROM btFormQuestions WHERE bID!=0 AND questionSetId=? ', $vals);

        //form block was just upgraded, so set the bID column
        if (!$questionsWithBIDs) {
            $vals = array(intval($bID), intval($qsID));
            $rs = $db->executeQuery('UPDATE btFormQuestions SET bID=? WHERE bID=0 AND questionSetId=?', $vals);

            return;
        }

        //Then remove all temp/placeholder questions for this questionSetId that haven't been assigned to a block
        $vals = array(intval($qsID));
        $rs = $db->executeQuery('DELETE FROM btFormQuestions WHERE bID=0 AND questionSetId=?', $vals);
    }
public static function questionCleanup ( $ qsID = 0 , $ bID = 0 ) { $ db = Database :: connection ( ) ; //First make sure that the bID column has been set for this questionSetId (for backwards compatibility) $ vals = array ( intval ( $ qsID ) ) ; $ questionsWithBIDs = $ db -> fetchColumn ( 'SELECT count(*) FROM btFormQuestions WHERE bID!=0 AND questionSetId=? ' , $ vals ) ; //form block was just upgraded, so set the bID column if ( ! $ questionsWithBIDs ) { $ vals = array ( intval ( $ bID ) , intval ( $ qsID ) ) ; $ rs = $ db -> executeQuery ( 'UPDATE btFormQuestions SET bID=? WHERE bID=0 AND questionSetId=?' , $ vals ) ; return ; } //Then remove all temp/placeholder questions for this questionSetId that haven't been assigned to a block $ vals = array ( intval ( $ qsID ) ) ; $ rs = $ db -> executeQuery ( 'DELETE FROM btFormQuestions WHERE bID=0 AND questionSetId=?' , $ vals ) ; }
Run on Form block edit
Run on Form block edit