~intrahealth+informatics/ihris-qualify/4.3-release

« back to all changes in this revision

Viewing changes to modules/SampleData/iHRIS_Module_Qualify_SampleData.php

  • Committer: Luke Duncan
  • Date: 2017-10-20 20:06:05 UTC
  • Revision ID: lduncan@intrahealth.org-20171020200605-ld6xt4qk4gtp1qdh
Updated Qualify to 4.3.  Version bumps and removed references to MDB2 by deprecating those functions if not needed or migrating the code to PDO.

Show diffs side-by-side

added added

removed removed

Lines of Context:
66
66
    public function upgrade( $old_vers, $new_vers ) {
67
67
        if ( I2CE_Validate::checkVersion( $old_vers, '<', '4.0.3.2' ) ) {
68
68
            I2CE::raiseError( "Upgrading sample data for license end_date" );
69
 
            $db = MDB2::singleton();
70
 
            $updated = $db->exec( "UPDATE last_entry SET date = NOW(), date_value = '2015-01-01 00:00:00' WHERE form_field = 75 AND date_value = '2010-01-01 00:00:00'" );
71
 
            if ( !I2CE::pearError( $updated, "Unable to update license end_date for Qualify Sample Data." ) ) {
 
69
            $db = I2CE::PDO();
 
70
            try {
 
71
                $updated = $db->exec( "UPDATE last_entry SET date = NOW(), date_value = '2015-01-01 00:00:00' WHERE form_field = 75 AND date_value = '2010-01-01 00:00:00'" );
72
72
                I2CE::raiseError( "Update $updated entries." );
73
73
                $last_mod = $db->exec( "UPDATE record SET last_modified = NOW() WHERE form = 16" );
74
 
                if ( !I2CE::pearError( $last_mod, "Unable to update license end_date for Qualify Sample Data record last modified." ) ) {
75
 
                    I2CE::raiseError( "Updated $last_mod records." );
76
 
                } else {
77
 
                    return false;
78
 
                }
79
 
            } else {
 
74
                I2CE::raiseError( "Updated $last_mod records." );
 
75
            } catch ( PDOException $e ) {
 
76
                I2CE::pdoError( $e, "Unable to update license end_date for Qualify Sample Data or record last modified." );
80
77
                return false;
81
78
            }
82
79
            I2CE::getConfig()->modules->CachedForms->dirty->license = time();