Get field code for which value is requested.

@param array $old
Old stock.
@param array $new
New stock.

@return bool
TRUE if stock status changed.
769538
private function isStockStatusChanged(array $old, array $new) {
    if ($old['status'] != $new['status']) {
      return TRUE;
    }

    $had_quantity = (bool) $old['quantity'];
    $has_quantity = (bool) $new['quantity'];

    // Either it was zero before or zero now and status says in stock,
    // we consider it is changed.
    if ($new['status'] && $had_quantity != $has_quantity) {
      return TRUE;
    }

    return FALSE;
  }
1280245
public function old($property) {
		$old = $this->getMeta('sys.orig',array());
		if (isset($old[$property])) {
			return $old[$property];
		}
	}
383482
protected function getTableMigrationNewTables($output, $new, $old)
    {
        if (empty($new['tables'])) {
            return $output;
        }
        foreach ($new['tables'] as $tableName => $table) {
            if ($tableName === $this->options['default_migration_table']) {
                continue;
            }

            if (!isset($old['tables'][$tableName])) {
                // create the table
                $table['has_table_variable'] = true;
                $output = $this->getCreateTable($output, $table, $tableName);
            }

            $output = $this->getTableMigrationNewTablesColumns($output, $table, $tableName, $new, $old);
            $output = $this->getTableMigrationOldTablesColumns($output, $tableName, $new, $old);
            $output = $this->getTableMigrationIndexes($output, $table, $tableName, $new, $old);
        }

        return $output;
    }
393202
protected function compaireSecondary($old, $new)
    {
        $oldMajor = dot($old)[0];
        $newMajor = dot($new)[0];

        $oldMinor = dot($old)[1];
        $newMinor = dot($new)[1];

        $oldSecondary = dot($old)[2];
        $newSecondary = dot($new)[2];

        return $oldSecondary != $newSecondary && $oldMajor == $newMajor && $oldMinor == $newMinor;
    }
452086
protected function mergeGroup(array $new, array $old)
    {
        $new['namespace'] = $this->formatNamespace($new, $old);

        $new['prefix'] = $this->formatPrefix($new, $old);

        foreach (['middleware', 'providers', 'scopes', 'before', 'after'] as $option) {
            $new[$option] = $this->formatArrayBasedOption($option, $new);
        }

        if (isset($new['domain'])) {
            unset($old['domain']);
        }

        if (isset($new['conditionalRequest'])) {
            unset($old['conditionalRequest']);
        }

        if (isset($new['uses'])) {
            $new['uses'] = $this->formatUses($new, $old);
        }

        $new['where'] = array_merge(Arr::get($old, 'where', []), Arr::get($new, 'where', []));

        if (isset($old['as'])) {
            $new['as'] = trim($old['as'].'.'.Arr::get($new, 'as', ''), '.');
        }

        return array_merge_recursive(array_except($old, ['namespace', 'prefix', 'where', 'as']), $new);
    }
1165998
public static function old($value, $fallback = '')
  {
    return Variable::has('form.old') ? (isset(Variable::get('form.old')[$value]) ? Variable::get('form.old')[$value] : $fallback) : $fallback;
  }
1224936
public function compareChecks(Check $oldCheck, Check $newCheck)
    {
        return ($oldCheck->getName() !== $newCheck->getName())
            || ($oldCheck->getDefinition() !== $newCheck->getDefinition());
    }
530836
protected function merge(array $old, array $new)
    {
        foreach ($new as $key => $value) {
            if (isset($old[$key]) && is_array($old[$key]) && is_array($value)) {
                $old[$key] = $this->merge($old[$key], $value);
            } else {
                $old[$key] = $value;
            }
        }

        return $old;
    }
312067
public function firstDifference($old, $new)
    {
        // loop through old and new character by character and compare
        $oldLen = mb_strlen($old);
        $newLen = mb_strlen($new);

        if ($oldLen === 0) {
            return 0;
        }

        $oldStripped = $this->cursor->filter($old, static::REPLACEMENT_CHAR);
        $newStripped = $this->cursor->filter($new, static::REPLACEMENT_CHAR);
        $lastReal = 0;

        for ($i = 0; $i < $oldLen && $i < $newLen; $i++) {
            if (mb_substr($old, $i, 1) !== mb_substr($new, $i, 1)) {
                if (($i > 0)
                    && ((mb_substr($oldStripped, $i - 1, 1) === static::REPLACEMENT_CHAR)
                        || (mb_substr($newStripped, $i - 1, 1) === static::REPLACEMENT_CHAR)
                    )
                ) {
                    return $lastReal > 0 ? $lastReal + 1 : 0;
                }
                return $i;
            } elseif (mb_substr($oldStripped, $i, 1) !== static::REPLACEMENT_CHAR) {
                $lastReal = $i;
            }
        }
        if ($i < $oldLen || $i < $newLen) {
            return $i;
        }
        return -1;
    }
1055482
protected function updateLogo( $new, $old )
    {
        $this->removeFile( $old );
        $new = $this->addFile( $new, 'settings/logo.%2$s' );
        $this->setSetting( 'logoType', $this->getMime( $new ) );
        return $new;
    }
1174536
protected function _overwrite(&$old, $new)
    {
        if (!empty($old)) {
            foreach ($old as $key => $var) {
                if (!isset($new[$key])) {
                    unset($old[$key]);
                }
            }
        }
        foreach ($new as $key => $var) {
            $old[$key] = $var;
        }
    }
320386
public static function merge(array $old, array $new)
    {
        foreach ($new as $key => $value) {
            if (isset($old[$key]) && is_array($old[$key]) && is_array($value)) {
                $old[$key] = self::merge($old[$key], $value);
            } else {
                $old[$key] = $value;
            }
        }

        return $old;
    }
290153
protected function fieldsHaveBeenChanged()
    {
        $old = HighloadBlockTable::getById($this->id)->fetch();
        $new = $this->fields + ['ID' => (string) $this->id];

        return $new != $old;
    }
65592
public function update($key, $newvars, $oldvars)
    {
        $now = $this->db->now();
        $ts  = microtime(true);

        // if new and old data are not the same, update data
        // else update expire timestamp only when certain conditions are met
        if ($newvars !== $oldvars) {
            $this->db->query("UPDATE {$this->table_name} "
                . "SET `changed` = $now, `vars` = ? WHERE `sess_id` = ?",
                base64_encode($newvars), $key);
        }
        else if ($ts - $this->changed + $this->time_diff > $this->lifetime / 2) {
            $this->db->query("UPDATE {$this->table_name} SET `changed` = $now"
                . " WHERE `sess_id` = ?", $key);
        }

        return true;
    }
1144484
public function diff(array $oldData, array $newData)
    {
        $diff = [];
        $keys = array_keys($oldData + $newData);
        
        foreach ($keys as $field) {
            $old = array_key_exists($field, $oldData) ? $oldData[$field] : null;
            $new = array_key_exists($field, $newData) ? $newData[$field] : null;

            if ($old == $new) {
                $row = ['old' => '', 'new' => '', 'same' => $old];
            } else {
                $row = ['old' => $old, 'new' => $new, 'same' => ''];
            }

            $diff[$field] = $row;
        }

        return $diff;
    }
669149
public function compareIndexes(Index $oldIndex, Index $newIndex)
    {
        return ($oldIndex->getName() !== $newIndex->getName())
            || ($oldIndex->getColumnNames() !== $newIndex->getColumnNames())
            || ($oldIndex->isUnique() !== $newIndex->isUnique());
    }
1102921
public function convertBc($name, array $old)
    {
        $new = $this->fields;

        $new[self::NAME] = $name;

        foreach ($old as $fieldName => $value) {
            $newFieldName = $this->getFieldBc($fieldName);
            $new[$newFieldName] = $value;
        }

        if (empty($new[self::RENDERER])) {
            $new[self::RENDERER] = 'rcm-plugin-bc';
        }

        if (empty($new[self::EDITOR])) {
            $new[self::EDITOR] = 'rcm-plugin-bc';
        }

        return $new;
    }