/**
  * Registers the edit-forms for this position.
  *
  * @param array|null $record      This will be null for a new database record.  Alternatively, you can pass an array of
  *                                  field values.  Normally this contructor is only used by the internal systems that get objects from the database.
  * @param boolean    $isSingleton This this to true if this is a singleton() object, a stub for calling methods.  Singletons
  *                                  don't have their defaults set.
  *
  * @return string
  *
  * @author Sascha Koehler <*****@*****.**>, Sebastian Diel <*****@*****.**>
  * @since 26.11.2012
  */
 public function __construct($record = null, $isSingleton = false)
 {
     parent::__construct($record, $isSingleton);
     if ($this->ID > 0 && !array_key_exists($this->ID, self::$initializedPositions)) {
         // Check if the installation is complete. If it's not complete we
         // can't access the SilvercartConfig data object (out of database)
         // because it's not build yet
         if (SilvercartTools::isInstallationCompleted()) {
             $this->adjustQuantityToStockQuantity();
         }
         self::$initializedPositions[$this->ID] = true;
     }
 }
 /**
  * Checks if the installation is complete. We assume a complete
  * installation if the Member table has the field "SilvercartShoppingCartID"
  * that is decorated via "SilvercartCustomer".
  * 
  * @return boolean
  * 
  * @author Sascha Koehler <*****@*****.**>, Sebastian Diel <*****@*****.**>
  * @since 04.06.2012
  * @deprecated use SilvercartTools::isInstallationCompleted() instead
  */
 public static function isInstallationCompleted()
 {
     return SilvercartTools::isInstallationCompleted();
 }
 /**
  * Checks if the installation is complete. We assume a complete
  * installation if the Member table has the field "SilvercartShoppingCartID"
  * that is decorated via "SilvercartCustomer".
  * 
  * @return boolean
  * 
  * @author Sascha Koehler <*****@*****.**>, Sebastian Diel <*****@*****.**>
  * @since 26.11.2012
  */
 public static function isInstallationCompleted()
 {
     if (is_null(self::$isInstallationCompleted)) {
         $installationComplete = false;
         if (array_key_exists('SCRIPT_NAME', $_SERVER) && strpos($_SERVER['SCRIPT_NAME'], 'install.php') !== false || array_key_exists('QUERY_STRING', $_SERVER) && strpos($_SERVER['QUERY_STRING'], 'successfullyinstalled') !== false || array_key_exists('QUERY_STRING', $_SERVER) && strpos($_SERVER['QUERY_STRING'], 'deleteinstallfiles') !== false || array_key_exists('REQUEST_URI', $_SERVER) && strpos($_SERVER['REQUEST_URI'], 'successfullyinstalled') !== false || array_key_exists('REQUEST_URI', $_SERVER) && strpos($_SERVER['REQUEST_URI'], 'deleteinstallfiles') !== false) {
             $installationComplete = false;
         } else {
             $memberFieldList = array();
             $queryRes = DB::query("SHOW TABLES");
             if ($queryRes->numRecords() > 0) {
                 $queryRes = DB::query("SHOW COLUMNS FROM Member");
                 foreach ($queryRes as $key => $value) {
                     $memberFieldList[] = $value['Field'];
                 }
                 if (in_array('SilvercartShoppingCartID', $memberFieldList)) {
                     $installationComplete = true;
                 }
             }
         }
         self::$isInstallationCompleted = $installationComplete;
     }
     return self::$isInstallationCompleted;
 }