Add a new country at once
9308
protected function submitAddCountry()
    {
        $this->setSubmitted(null, $this->getParam());
        $this->setSubmittedJson('format');
        $this->validateComponent('country');
        $this->addCountry();
    }
1170179
protected function setBreadcrumbEditCountry()
    {
        $breadcrumbs = array();

        $breadcrumbs[] = array(
            'url' => $this->url('admin'),
            'text' => $this->text('Dashboard')
        );

        $breadcrumbs[] = array(
            'url' => $this->url('admin/settings/country'),
            'text' => $this->text('Countries')
        );

        $this->setBreadcrumbs($breadcrumbs);
    }
391058
protected function wizardAddCurrency()
    {
        // Required
        $this->validatePrompt('code', $this->text('Code'), 'currency');
        $this->validatePrompt('name', $this->text('Name'), 'currency');
        $this->validatePrompt('symbol', $this->text('Symbol'), 'currency');
        $this->validatePrompt('major_unit', $this->text('Major unit'), 'currency');
        $this->validatePrompt('minor_unit', $this->text('Minor unit'), 'currency');
        $this->validatePrompt('numeric_code', $this->text('Numeric code'), 'currency');

        // Optional
        $this->validatePrompt('status', $this->text('Status'), 'currency', 0);
        $this->validatePrompt('default', $this->text('Default'), 'currency', 0);
        $this->validatePrompt('decimals', $this->text('Decimals'), 'currency', 2);
        $this->validatePrompt('rounding_step', $this->text('Rounding step'), 'currency', 0);
        $this->validatePrompt('conversion_rate', $this->text('Conversion rate'), 'currency', 1);
        $this->validatePrompt('decimal_separator', $this->text('Decimal separator'), 'currency', '.');
        $this->validatePrompt('thousands_separator', $this->text('Thousands separator'), 'currency', ',');
        $this->validatePrompt('template', $this->text('Template'), 'currency', '%symbol%price');

        $this->validateComponent('currency');
        $this->addCurrency();
    }
928181
public function add()
    {
        $this->loadModel('Locale.Languages');
        $language = $this->Languages->newEntity();
        $languages = LocaleToolbox::languagesList(true);
        $icons = LocaleToolbox::flagsList();

        if (!empty($this->request->data['code'])) {
            $info = LocaleToolbox::info($this->request->data['code']);
            $language = $this->Languages->patchEntity($language, [
                'code' => normalizeLocale($this->request->data['code']),
                'name' => $info['language'],
                'direction' => $info['direction'],
                'status' => (isset($this->request->data['status']) ? $this->request->data['status'] : false),
                'icon' => (!empty($this->request->data['icon']) ? $this->request->data['icon'] : null)
            ]);

            if ($this->Languages->save($language)) {
                $this->Flash->success(__d('locale', 'Language was successfully registered!'));
                $this->redirect(['plugin' => 'Locale', 'controller' => 'manage', 'action' => 'index']);
            } else {
                $this->Flash->danger(__d('locale', 'Language could not be registered, please check your information'));
            }
        }

        $this->title(__d('locale', 'Register New Language'));
        $this->set(compact('language', 'languages', 'icons'));
        $this->Breadcrumb
            ->push('/admin/locale')
            ->push(__d('locale', 'Add new language'), '');
    }
739301
function() {
		var key = this.att.get("key");
		if (key) {
			key.split(" ").forEach(function(token) {
				token = token.trim();
				this.key.addGlobal(token);
				this._map[token] = false;
			}, this);
		}
	}
855107
def populate_countries(self):
        """"""
        for i in range(1, 12):
            self.admin_level_comboBox.addItem(self.tr('Level %s') % i, i)

        # Set current index to admin_level 8, the most common one
        self.admin_level_comboBox.setCurrentIndex(7)

        list_countries = sorted([
            self.tr(country) for country in list(self.countries.keys())])
        for country in list_countries:
            self.country_comboBox.addItem(country)

        self.bbox_countries = {}
        for country in list_countries:
            multipolygons = self.countries[country]['bbox']
            self.bbox_countries[country] = []
            for coords in multipolygons:
                bbox = QgsRectangle(coords[0], coords[3], coords[2], coords[1])
                self.bbox_countries[country].append(bbox)

        self.update_helper_political_level()
397386
def _add_countriesdata(cls, iso3, country):
        # type: (str, hxl.Row) -> None
        
        countryname = country.get('#country+name+preferred')
        cls._countriesdata['countrynames2iso3'][countryname.upper()] = iso3
        iso2 = country.get('#country+code+v_iso2')
        if iso2:
            cls._countriesdata['iso2iso3'][iso2] = iso3
            # different types so keys won't clash
            cls._countriesdata['iso2iso3'][iso3] = iso2
        m49 = country.get('#country+code+num+v_m49')
        if m49:
            m49 = int(m49)
            cls._countriesdata['m49iso3'][m49] = iso3
            # different types so keys won't clash
            cls._countriesdata['m49iso3'][iso3] = m49
        cls._countriesdata['aliases'][iso3] = re.compile(country.get('#country+regex'), re.IGNORECASE)
        regionname = country.get('#region+main+name+preferred')
        sub_regionname = country.get('#region+sub+name+preferred')
        intermediate_regionname = country.get('#region+intermediate+name+preferred')
        regionid = country.get('#region+main+code')
        if regionid:
            regionid = int(regionid)
        sub_regionid = country.get('#region+sub+code')
        if sub_regionid:
            sub_regionid = int(sub_regionid)
        intermediate_regionid = country.get('#region+intermediate+code')
        if intermediate_regionid:
            intermediate_regionid = int(intermediate_regionid)

        # region, subregion and intermediate region codes do not clash so only need one dict
        def add_country_to_set(colname, idval, iso3):
            value = cls._countriesdata[colname].get(idval)
            if value is None:
                value = set()
                cls._countriesdata['regioncodes2countries'][idval] = value
            value.add(iso3)

        if regionname:
            add_country_to_set('regioncodes2countries', regionid, iso3)
            cls._countriesdata['regioncodes2names'][regionid] = regionname
            cls._countriesdata['regionnames2codes'][regionname.upper()] = regionid
        if sub_regionname:
            add_country_to_set('regioncodes2countries', sub_regionid, iso3)
            cls._countriesdata['regioncodes2names'][sub_regionid] = sub_regionname
            cls._countriesdata['regionnames2codes'][sub_regionname.upper()] = sub_regionid
        if intermediate_regionname:
            add_country_to_set('regioncodes2countries', intermediate_regionid, iso3)
            cls._countriesdata['regioncodes2names'][intermediate_regionid] = intermediate_regionname
            cls._countriesdata['regionnames2codes'][intermediate_regionname.upper()] = \
                intermediate_regionid
470702
public function addDiscCountry()
    {
        $oConfig = \OxidEsales\Eshop\Core\Registry::getConfig();
        $aChosenCntr = $this->_getActionIds('oxcountry.oxid');
        $soxId = $oConfig->getRequestParameter('synchoxid');

        if ($oConfig->getRequestParameter('all')) {
            $sCountryTable = $this->_getViewName('oxcountry');
            $aChosenCntr = $this->_getAll($this->_addFilter("select $sCountryTable.oxid " . $this->_getQuery()));
        }
        if ($soxId && $soxId != "-1" && is_array($aChosenCntr)) {
            foreach ($aChosenCntr as $sChosenCntr) {
                $oObject2Discount = oxNew(\OxidEsales\Eshop\Core\Model\BaseModel::class);
                $oObject2Discount->init('oxobject2discount');
                $oObject2Discount->oxobject2discount__oxdiscountid = new \OxidEsales\Eshop\Core\Field($soxId);
                $oObject2Discount->oxobject2discount__oxobjectid = new \OxidEsales\Eshop\Core\Field($sChosenCntr);
                $oObject2Discount->oxobject2discount__oxtype = new \OxidEsales\Eshop\Core\Field("oxcountry");
                $oObject2Discount->save();
            }
        }
    }
186104
function add(table, inp, state, action, next) {
        table[state<<8|inp] = ((action | 0) << 4) | ((next === undefined) ? state : next);
    }
67261
def addthisbunch(bunchdt, data, commdct, thisbunch, theidf):
    """"""
    key = thisbunch.key.upper()
    obj = copy.copy(thisbunch.obj)
    abunch = obj2bunch(data, commdct, obj)
    bunchdt[key].append(abunch)
    return abunch
1167518
protected function wizardAddState()
    {
        $this->validatePrompt('code', $this->text('Code'), 'state');
        $this->validatePrompt('name', $this->text('Name'), 'state');
        $this->validatePrompt('country', $this->text('Country'), 'state');
        $this->validatePrompt('zone_id', $this->text('Zone'), 'state', 0);
        $this->validatePrompt('status', $this->text('Status'), 'state', 0);

        $this->validateComponent('state');
        $this->addState();
    }
456476
public void addTranslation (String oldname, String newname)
    {
        if (_translations == null) {
            _translations = Maps.newHashMap();
        }
        _translations.put(oldname, newname);
    }
1078428
public void addCountryCode(final String countryCode) {
        if (null == countryCodes) {
            countryCodes = new ArrayList<String>();
        }
        countryCodes.add(countryCode);
    }
490925
def set_country(request):
    
    if request.method == 'POST':
        next = request.POST.get('next', request.GET.get('next'))
        if is_safe_url(url=next, host=request.get_host()):
            response = http.HttpResponseRedirect(next)
        else:
            response = http.HttpResponse()

        country_code = request.POST.get('country', '').upper()
        if country_code != geo.get_supported_country(country_code):
            return http.HttpResponseBadRequest()

        if hasattr(request, 'session'):
            request.session[geo.COUNTRY_SESSION_KEY] = country_code
        else:
            response.set_cookie(geo.COUNTRY_COOKIE_NAME,
                               country_code,
                               max_age=geo.COUNTRY_COOKIE_AGE,
                               path=geo.COUNTRY_COOKIE_PATH)
        return response
    else:
        return http.HttpResponseNotAllowed(['POST'])
16908
public function add()
    {
        $group = $this->UsersGroups->newEntity();

        if ($this->request->is('post')) {
            $group = $this->UsersGroups->patchEntity($group, $this->request->getData());

            if ($this->UsersGroups->save($group)) {
                $this->Flash->success(I18N_OPERATION_OK);

                return $this->redirect(['action' => 'index']);
            }

            $this->Flash->error(I18N_OPERATION_NOT_OK);
        }

        $this->set(compact('group'));
    }
1057632
def add_thing(self, name, location, **kwargs):
        
        if name in self.thing:
            raise WorldIntegrityError(
                "Already have a Thing named {}".format(name)
            )
        self.add_node(name, **kwargs)
        if isinstance(location, Node):
            location = location.name
        self.place2thing(name, location,)
1169645
protected function setTitleEditCountryState()
    {
        if (isset($this->data_state['state_id'])) {
            $title = $this->text('Edit %name', array('%name' => $this->data_state['name']));
        } else {
            $title = $this->text('Add country state for %name', array('%name' => $this->data_country['name']));
        }

        $this->setTitle($title);
    }