Skip to content
Code-Schnipsel Gruppen Projekte
Commit 076cb778 erstellt von Henning Leutz's avatar Henning Leutz :martial_arts_uniform:
Dateien durchsuchen

Merge branch 'main' into 'next-3.x'

Update 'next-3.x' with latest changes from 'main'

See merge request !54
Übergeordnete a6af6d55 064efcd7
No related branches found
No related tags found
1 Merge Request!54Update 'next-3.x' with latest changes from 'main'
Pipeline #16548 bestanden mit Phase
in 2 Minuten und 16 Sekunden
werden angezeigt mit 163 Ergänzungen und 143 Löschungen
<?xml version="1.0" encoding="UTF-8"?>
<phive xmlns="https://phar.io/phive">
<phar name="phpstan" version="1.11.8" installed="1.11.8" location="./tools/phpstan" copy="false"/>
<phar name="phpstan" version="^2.0.4" installed="2.0.4" location="./tools/phpstan" copy="false"/>
<phar name="phpunit" version="^10.5.20" installed="10.5.20" location="./tools/phpunit" copy="false"/>
<phar name="phpcs" version="^3.10.1" installed="3.10.1" location="./tools/phpcs" copy="false"/>
<phar name="phpcbf" version="^3.10.1" installed="3.10.1" location="./tools/phpcbf" copy="false"/>
......
......@@ -11,7 +11,7 @@ define('package/quiqqer/currency/bin/Currency', [
'Ajax',
'package/quiqqer/currency/bin/classes/BulkConverting'
], function(QUI, QUIDOM, QUIAjax, BulkConverting) {
], function (QUI, QUIDOM, QUIAjax, BulkConverting) {
'use strict';
let Converter = null;
......@@ -19,7 +19,6 @@ define('package/quiqqer/currency/bin/Currency', [
let SYSTEM_CURRENCY = '';
let getCurrenciesFetch = false;
// package_quiqqer_currency_ajax_setUserCurrency
if (typeof window.DEFAULT_CURRENCY !== 'undefined') {
def = window.DEFAULT_CURRENCY;
......@@ -36,7 +35,7 @@ define('package/quiqqer/currency/bin/Currency', [
Extends: QUIDOM,
Type: 'package/quiqqer/currency/bin/Currency',
initialize: function(options) {
initialize: function (options) {
this.parent(options);
this.$currency = def;
......@@ -56,9 +55,9 @@ define('package/quiqqer/currency/bin/Currency', [
*
* @param {String} currencyCode
*/
setCurrency: function(currencyCode) {
this.getCurrencies().then(function(currencies) {
const found = currencies.find(function(Currency) {
setCurrency: function (currencyCode) {
this.getCurrencies().then(function (currencies) {
const found = currencies.find(function (Currency) {
return Currency.code === currencyCode;
});
......@@ -79,7 +78,7 @@ define('package/quiqqer/currency/bin/Currency', [
* @param {Boolean} [refresh] - Refresh data from database
* @return {Promise}
*/
getCurrency: function(currencyCode, refresh) {
getCurrency: function (currencyCode, refresh) {
currencyCode = currencyCode || this.$currency;
refresh = refresh || false;
......@@ -108,12 +107,13 @@ define('package/quiqqer/currency/bin/Currency', [
});
},
/**
* Return all available currencies
*
* @returns {Promise}
*/
getCurrencies: function() {
getCurrencies: function () {
if (Object.getLength(this.$currencies)) {
return Promise.resolve(this.$currencies);
}
......@@ -142,12 +142,33 @@ define('package/quiqqer/currency/bin/Currency', [
});
},
/**
* Return default currency
*
* @returns {Promise}
*/
getDefaultCurrency: function () {
if (SYSTEM_CURRENCY !== '') {
return Promise.resolve(SYSTEM_CURRENCY);
}
return new Promise((resolve, reject) => {
QUIAjax.get('package_quiqqer_currency_ajax_getDefault', (result) => {
SYSTEM_CURRENCY = result.code;
resolve(result.code);
}, {
'package': 'quiqqer/currency',
onError: reject
});
});
},
/**
* Return all available currency types.
*
* @returns {Promise<Array>}
*/
getCurrencyTypes: function() {
getCurrencyTypes: function () {
if (this.$currencyTypes.length) {
return Promise.resolve(this.$currencyTypes);
}
......@@ -171,7 +192,7 @@ define('package/quiqqer/currency/bin/Currency', [
* @param {String} currencyTo
* @returns {Promise}
*/
convert: function(amount, currencyFrom, currencyTo) {
convert: function (amount, currencyFrom, currencyTo) {
currencyTo = currencyTo || this.$currency;
currencyFrom = currencyFrom || this.$currency;
......@@ -193,7 +214,7 @@ define('package/quiqqer/currency/bin/Currency', [
* @param {String} currencyTo
* @returns {Promise}
*/
convertWithSign: function(amount, currencyFrom, currencyTo) {
convertWithSign: function (amount, currencyFrom, currencyTo) {
currencyTo = currencyTo || this.$currency;
currencyFrom = currencyFrom || this.$currency;
......
......@@ -13,7 +13,7 @@ define('package/quiqqer/currency/bin/controls/Select', [
'package/quiqqer/currency/bin/Currency',
'Locale'
], function(QUI, QUIElementSelect, Currencies, QUILocale) {
], function (QUI, QUIElementSelect, Currencies, QUILocale) {
'use strict';
const lg = 'quiqqer/currency';
......@@ -36,7 +36,7 @@ define('package/quiqqer/currency/bin/controls/Select', [
options: {},
initialize: function(options) {
initialize: function (options) {
this.parent(options);
this.setAttribute('Search', this.currencySearch);
......@@ -62,7 +62,7 @@ define('package/quiqqer/currency/bin/controls/Select', [
* @param {String} value
* @returns {Promise}
*/
currencySearch: function(value) {
currencySearch: function (value) {
return new Promise((resolve) => {
require(['package/quiqqer/currency/bin/settings/AllowedCurrencies'], (AllowedCurrencies) => {
let GetCurrencies;
......@@ -84,7 +84,7 @@ define('package/quiqqer/currency/bin/controls/Select', [
}
data = list[currency];
if (data.text.toLowerCase().indexOf(value) !== -1) {
result.push({
icon: 'fa fa-money',
......@@ -106,15 +106,15 @@ define('package/quiqqer/currency/bin/controls/Select', [
* @param self
* @param Btn
*/
$onSearchButtonClick: function(self, Btn) {
$onSearchButtonClick: function (self, Btn) {
Btn.setAttribute('icon', 'fa fa-spinner fa-spin');
require([
'package/quiqqer/currency/bin/controls/search/Window'
], function(Search) {
], function (Search) {
new Search({
events: {
onSubmit: function(Win, values) {
onSubmit: function (Win, values) {
for (let i = 0, len = values.length; i < len; i++) {
self.addItem(values[i]);
}
......
......@@ -9,7 +9,7 @@ define('package/quiqqer/currency/bin/controls/SelectItem', [
'css!package/quiqqer/currency/bin/controls/SelectItem.css'
], function(QUIControl, Currencies) {
], function (QUIControl, Currencies) {
'use strict';
return new Class({
......@@ -25,7 +25,7 @@ define('package/quiqqer/currency/bin/controls/SelectItem', [
id: false
},
initialize: function(options) {
initialize: function (options) {
this.parent(options);
this.$Icon = null;
......@@ -42,7 +42,7 @@ define('package/quiqqer/currency/bin/controls/SelectItem', [
*
* @returns {HTMLElement}
*/
create: function() {
create: function () {
const self = this,
Elm = this.parent();
......@@ -57,7 +57,7 @@ define('package/quiqqer/currency/bin/controls/SelectItem', [
this.$Text = Elm.getElement('.quiqqer-currency-selectItem-text');
this.$Destroy = Elm.getElement('.quiqqer-currency-selectItem-destroy');
this.$Destroy.addEvent('click', function() {
this.$Destroy.addEvent('click', function () {
self.destroy();
});
......@@ -67,7 +67,7 @@ define('package/quiqqer/currency/bin/controls/SelectItem', [
/**
* event : on inject
*/
$onInject: function() {
$onInject: function () {
this.$Text.set({
html: '<span class="fa fa-spinner fa-spin"></span>'
});
......
......@@ -14,7 +14,7 @@ define('package/quiqqer/currency/bin/controls/search/Search', [
'css!package/quiqqer/currency/bin/controls/search/Search.css'
], function(QUIControl, Currencies, QUIButton, QUISwitch, QUILocale, QUIAjax, Grid) {
], function (QUIControl, Currencies, QUIButton, QUISwitch, QUILocale, QUIAjax, Grid) {
'use strict';
const lg = 'quiqqer/currency';
......@@ -35,7 +35,7 @@ define('package/quiqqer/currency/bin/controls/search/Search', [
onlyAllowed: true
},
initialize: function(options) {
initialize: function (options) {
this.parent(options);
this.$Container = null;
......@@ -48,7 +48,7 @@ define('package/quiqqer/currency/bin/controls/search/Search', [
*
* @returns {HTMLElement}
*/
create: function() {
create: function () {
this.$Elm = new Element('div', {
'class': 'quiqqer-currency-search',
html: '',
......@@ -129,7 +129,7 @@ define('package/quiqqer/currency/bin/controls/search/Search', [
*
* @return {Promise}
*/
resize: function() {
resize: function () {
const size = this.$Elm.getSize();
return Promise.all([
......@@ -141,7 +141,7 @@ define('package/quiqqer/currency/bin/controls/search/Search', [
/**
* execute the search
*/
search: function() {
search: function () {
this.fireEvent('searchBegin', [this]);
return new Promise((resolve, reject) => {
......@@ -187,7 +187,7 @@ define('package/quiqqer/currency/bin/controls/search/Search', [
*
* @return {Array}
*/
getSelectedData: function() {
getSelectedData: function () {
return this.$Grid.getSelectedData();
}
});
......
......@@ -11,7 +11,7 @@ define('package/quiqqer/currency/bin/controls/search/Window', [
'package/quiqqer/currency/bin/controls/search/Search',
'Locale'
], function(QUI, QUIControl, QUIButton, QUIConfirm, Search, QUILocale) {
], function (QUI, QUIControl, QUIButton, QUIConfirm, Search, QUILocale) {
'use strict';
return new Class({
......@@ -38,7 +38,7 @@ define('package/quiqqer/currency/bin/controls/search/Window', [
multiple: false
},
initialize: function(options) {
initialize: function (options) {
this.parent(options);
this.$Search = null;
......@@ -53,7 +53,7 @@ define('package/quiqqer/currency/bin/controls/search/Window', [
*
* @return {Promise}
*/
$onResize: function() {
$onResize: function () {
return this.$Search.resize();
},
......@@ -62,7 +62,7 @@ define('package/quiqqer/currency/bin/controls/search/Window', [
*
* @returns {HTMLDivElement}
*/
$onOpen: function(Win) {
$onOpen: function (Win) {
const self = this,
Content = Win.getContent();
......@@ -71,15 +71,15 @@ define('package/quiqqer/currency/bin/controls/search/Window', [
this.$Search = new Search({
searchbutton: false,
events: {
onDblClick: function() {
onDblClick: function () {
self.submit();
},
onSearchBegin: function() {
onSearchBegin: function () {
self.Loader.show();
},
onSearchEnd: function() {
onSearchEnd: function () {
self.Loader.hide();
}
}
......@@ -91,7 +91,7 @@ define('package/quiqqer/currency/bin/controls/search/Window', [
/**
* Execute the search
*/
search: function() {
search: function () {
this.$Search.search();
},
......@@ -100,7 +100,7 @@ define('package/quiqqer/currency/bin/controls/search/Window', [
*
* @fires onSubmit
*/
submit: function() {
submit: function () {
let selected = this.$Search.getSelectedData();
if (!selected.length) {
......
......@@ -13,7 +13,7 @@ define('package/quiqqer/currency/bin/settings/AccountingCurrencyDiffers', [
return new Class({
Extends: QUIControl,
Type : 'package/quiqqer/currency/bin/settings/AccountingCurrencyDiffers',
Type: 'package/quiqqer/currency/bin/settings/AccountingCurrencyDiffers',
Binds: [
'$onImport'
......@@ -30,7 +30,7 @@ define('package/quiqqer/currency/bin/settings/AccountingCurrencyDiffers', [
},
$onImport: function () {
var self = this,
var self = this,
Table = this.getElm().getParent('table');
this.getElm().addEvent('change', function () {
......
......@@ -19,7 +19,7 @@ define('package/quiqqer/currency/bin/settings/AllowedCurrencies', [
'css!package/quiqqer/currency/bin/settings/AllowedCurrencies.css'
], function(QUI, QUIControl, QUISwitch, QUIConfirm, QUIPrompt, QUIAjax, QUILocale, Grid, CurrencyWindow) {
], function (QUI, QUIControl, QUISwitch, QUIConfirm, QUIPrompt, QUIAjax, QUILocale, Grid, CurrencyWindow) {
'use strict';
const lg = 'quiqqer/currency';
......@@ -43,7 +43,7 @@ define('package/quiqqer/currency/bin/settings/AllowedCurrencies', [
values: {}
},
initialize: function(options) {
initialize: function (options) {
this.parent(options);
this.$Input = null;
......@@ -59,7 +59,7 @@ define('package/quiqqer/currency/bin/settings/AllowedCurrencies', [
/**
* event : on import
*/
$onImport: function() {
$onImport: function () {
this.$Input = this.getElm();
this.$Input.type = 'hidden';
......@@ -164,7 +164,7 @@ define('package/quiqqer/currency/bin/settings/AllowedCurrencies', [
textimage: 'fa fa-edit',
disabled: true,
events: {
onClick: function() {
onClick: function () {
self.openUpdateDialog(self.$Grid.getSelectedData()[0].code);
}
}
......@@ -178,8 +178,8 @@ define('package/quiqqer/currency/bin/settings/AllowedCurrencies', [
textimage: 'fa fa-trash',
disabled: true,
events: {
onClick: function() {
const currencies = self.$Grid.getSelectedData().map(function(C) {
onClick: function () {
const currencies = self.$Grid.getSelectedData().map(function (C) {
return C.code;
});
......@@ -193,15 +193,15 @@ define('package/quiqqer/currency/bin/settings/AllowedCurrencies', [
this.$Grid.setWidth(width);
this.$Grid.addEvents({
onClick: function() {
onClick: function () {
const selected = self.$Grid.getSelectedIndices(),
buttons = self.$Grid.getButtons();
const Edit = buttons.filter(function(Btn) {
const Edit = buttons.filter(function (Btn) {
return Btn.getAttribute('name') === 'edit';
})[0];
const Delete = buttons.filter(function(Btn) {
const Delete = buttons.filter(function (Btn) {
return Btn.getAttribute('name') === 'delete';
})[0];
......@@ -216,7 +216,7 @@ define('package/quiqqer/currency/bin/settings/AllowedCurrencies', [
}
},
onDblClick: function() {
onDblClick: function () {
self.openUpdateDialog(self.$Grid.getSelectedData()[0].code);
},
......@@ -246,7 +246,7 @@ define('package/quiqqer/currency/bin/settings/AllowedCurrencies', [
/**
* refresh the currency list
*/
refresh: function() {
refresh: function () {
this.$Grid.showLoader();
return this.getCurrencies().then((list) => {
......@@ -268,7 +268,7 @@ define('package/quiqqer/currency/bin/settings/AllowedCurrencies', [
data = data.splice(start, perPage);
data.each(function(entry, i) {
data.each(function (entry, i) {
data[i].allowed = new QUISwitch({
status: (typeof values[entry.code] !== 'undefined'),
currency: entry.code,
......@@ -294,11 +294,11 @@ define('package/quiqqer/currency/bin/settings/AllowedCurrencies', [
const buttons = this.$Grid.getButtons();
const Edit = buttons.filter(function(Btn) {
const Edit = buttons.filter(function (Btn) {
return Btn.getAttribute('name') === 'edit';
})[0];
const Delete = buttons.filter(function(Btn) {
const Delete = buttons.filter(function (Btn) {
return Btn.getAttribute('name') === 'delete';
})[0];
......@@ -313,7 +313,7 @@ define('package/quiqqer/currency/bin/settings/AllowedCurrencies', [
/**
* update values to the input field
*/
update: function() {
update: function () {
const allowed = [],
values = this.getAttribute('values');
......@@ -336,8 +336,8 @@ define('package/quiqqer/currency/bin/settings/AllowedCurrencies', [
* Return all available currencies
* @returns {Promise}
*/
getCurrencies: function() {
return new Promise(function(resolve, reject) {
getCurrencies: function () {
return new Promise(function (resolve, reject) {
QUIAjax.get('package_quiqqer_currency_ajax_getCurrencies', resolve, {
'package': 'quiqqer/currency',
onError: reject
......@@ -350,7 +350,7 @@ define('package/quiqqer/currency/bin/settings/AllowedCurrencies', [
*
* @returns {Promise}
*/
getAllowedCurrencies: function() {
getAllowedCurrencies: function () {
return new Promise((resolve, reject) => {
QUIAjax.get('package_quiqqer_currency_ajax_getAllowedCurrencies', resolve, {
'package': 'quiqqer/currency',
......@@ -365,12 +365,12 @@ define('package/quiqqer/currency/bin/settings/AllowedCurrencies', [
* @param {Array|String} currencies
* @returns {Promise}
*/
deleteCurrency: function(currencies) {
deleteCurrency: function (currencies) {
if (typeOf(currencies) === 'string') {
currencies = [currencies];
}
return new Promise(function(resolve, reject) {
return new Promise(function (resolve, reject) {
QUIAjax.post('package_quiqqer_currency_ajax_delete', resolve, {
'package': 'quiqqer/currency',
currencies: JSON.encode(currencies),
......@@ -385,8 +385,8 @@ define('package/quiqqer/currency/bin/settings/AllowedCurrencies', [
* @param {String} currency
* @returns {Promise}
*/
createCurrency: function(currency) {
return new Promise(function(resolve, reject) {
createCurrency: function (currency) {
return new Promise(function (resolve, reject) {
QUIAjax.post('package_quiqqer_currency_ajax_create', resolve, {
'package': 'quiqqer/currency',
currency: currency,
......@@ -400,7 +400,7 @@ define('package/quiqqer/currency/bin/settings/AllowedCurrencies', [
*
* @param {Object} Switch
*/
$onCurrencyStatusChange: function(Switch) {
$onCurrencyStatusChange: function (Switch) {
const currency = Switch.getAttribute('currency');
const values = this.getAttribute('values');
......@@ -435,7 +435,7 @@ define('package/quiqqer/currency/bin/settings/AllowedCurrencies', [
*
* @param {Event} event
*/
$switchCurrencyStatus: function(event) {
$switchCurrencyStatus: function (event) {
const Target = event.target;
const SwitchContainer = Target.getParent().getElement('.qui-switch');
......@@ -452,8 +452,8 @@ define('package/quiqqer/currency/bin/settings/AllowedCurrencies', [
* @param {Object} Switch
* @return {Promise}
*/
$changeAutoUpdate: function(Switch) {
return new Promise(function(resolve, reject) {
$changeAutoUpdate: function (Switch) {
return new Promise(function (resolve, reject) {
QUIAjax.post('package_quiqqer_currency_ajax_setAutoupdate', resolve, {
'package': 'quiqqer/currency',
currency: Switch.getAttribute('currency'),
......@@ -468,8 +468,8 @@ define('package/quiqqer/currency/bin/settings/AllowedCurrencies', [
*
* @returns {Promise}
*/
$importFromECB: function() {
return new Promise(function(resolve, reject) {
$importFromECB: function () {
return new Promise(function (resolve, reject) {
QUIAjax.post('package_quiqqer_currency_ajax_importFromECB', resolve, {
'package': 'quiqqer/currency',
onError: reject
......@@ -486,7 +486,7 @@ define('package/quiqqer/currency/bin/settings/AllowedCurrencies', [
*
* @param {String} currency
*/
openUpdateDialog: function(currency) {
openUpdateDialog: function (currency) {
new CurrencyWindow({
currency: currency,
events: {
......@@ -500,7 +500,7 @@ define('package/quiqqer/currency/bin/settings/AllowedCurrencies', [
*
* @param {Array} currencies
*/
openDeleteDialog: function(currencies) {
openDeleteDialog: function (currencies) {
if (!currencies.length) {
return;
}
......@@ -538,17 +538,17 @@ define('package/quiqqer/currency/bin/settings/AllowedCurrencies', [
maxWidth: 600,
autoclose: false,
events: {
onSubmit: function(Win) {
onSubmit: function (Win) {
Win.Loader.show();
self.deleteCurrency(currencies).then(function() {
self.deleteCurrency(currencies).then(function () {
self.refresh().then(function() {
self.refresh().then(function () {
self.update();
Win.Loader.hide();
Win.close();
});
}, function() {
}, function () {
Win.Loader.hide();
});
}
......@@ -559,7 +559,7 @@ define('package/quiqqer/currency/bin/settings/AllowedCurrencies', [
/**
* Opens the create dialog
*/
openCreateDialog: function() {
openCreateDialog: function () {
const self = this;
new QUIPrompt({
......@@ -570,13 +570,13 @@ define('package/quiqqer/currency/bin/settings/AllowedCurrencies', [
maxHeight: 300,
maxWidth: 450,
events: {
onSubmit: function(value, Win) {
onSubmit: function (value, Win) {
Win.Loader.show();
self.createCurrency(value).then(function() {
self.createCurrency(value).then(function () {
Win.close();
self.openUpdateDialog(value);
}, function() {
}, function () {
Win.Loader.hide();
});
}
......
......@@ -9,7 +9,7 @@ define('package/quiqqer/currency/bin/settings/CurrencyList', [
'qui/controls/buttons/Select',
'Ajax'
], function(QUI, QUIControl, QUISelect, QUIAjax) {
], function (QUI, QUIControl, QUISelect, QUIAjax) {
'use strict';
return new Class({
......@@ -22,7 +22,7 @@ define('package/quiqqer/currency/bin/settings/CurrencyList', [
'$onSelectChange'
],
initialize: function(options) {
initialize: function (options) {
this.parent(options);
this.$Input = null;
......@@ -36,7 +36,7 @@ define('package/quiqqer/currency/bin/settings/CurrencyList', [
/**
* event : on import
*/
$onImport: function() {
$onImport: function () {
this.$Input = this.getElm();
this.$Input.type = 'hidden';
......@@ -54,7 +54,7 @@ define('package/quiqqer/currency/bin/settings/CurrencyList', [
}
}).inject(this.$Elm);
this.getCurrencies().then(function(result) {
this.getCurrencies().then(function (result) {
for (let i in result) {
if (!result.hasOwnProperty(i)) {
continue;
......@@ -84,8 +84,8 @@ define('package/quiqqer/currency/bin/settings/CurrencyList', [
* Return all available currencies
* @returns {Promise}
*/
getCurrencies: function() {
return new Promise(function(resolve, reject) {
getCurrencies: function () {
return new Promise(function (resolve, reject) {
QUIAjax.get('package_quiqqer_currency_ajax_getAllowedCurrencies', resolve, {
'package': 'quiqqer/currency',
onError: reject
......@@ -99,7 +99,7 @@ define('package/quiqqer/currency/bin/settings/CurrencyList', [
* @param {String} value
* @param {Object} Select - qui/controls/buttons/Select
*/
$onSelectChange: function(value, Select) {
$onSelectChange: function (value, Select) {
this.$Input.value = value;
this.fireEvent('change', [
this,
......
......@@ -9,11 +9,11 @@ define('package/quiqqer/currency/bin/settings/CurrencyWindow', [
'Locale',
'package/quiqqer/currency/bin/settings/Currency'
], function(QUI, QUIConfirm, QUILocale, Currency) {
], function (QUI, QUIConfirm, QUILocale, Currency) {
'use strict';
return new Class({
Extends: QUIConfirm,
Type: 'package/quiqqer/currency/bin/settings/CurrencyWindow',
......@@ -32,7 +32,7 @@ define('package/quiqqer/currency/bin/settings/CurrencyWindow', [
maxWidth: 600
},
initialize: function(options) {
initialize: function (options) {
this.setAttribute(
'title',
QUILocale.get('quiqqer/currency', 'control.currency.title', {
......@@ -53,7 +53,7 @@ define('package/quiqqer/currency/bin/settings/CurrencyWindow', [
/**
* event : on open
*/
$onOpen: function() {
$onOpen: function () {
this.$Currency = new Currency({
currency: this.getAttribute('currency')
}).inject(this.getContent());
......@@ -62,10 +62,10 @@ define('package/quiqqer/currency/bin/settings/CurrencyWindow', [
/**
* event : on submit
*/
$onSubmit: function() {
$onSubmit: function () {
this.Loader.show();
this.$Currency.save().then(function() {
this.$Currency.save().then(function () {
this.Loader.hide();
this.close();
}.bind(this));
......
......@@ -19,13 +19,13 @@ define('package/quiqqer/currency/bin/settings/Import', [
return new Class({
Extends: QUIControl,
Type : 'package/quiqqer/currency/bin/settings/Import',
Type: 'package/quiqqer/currency/bin/settings/Import',
initialize: function (options) {
this.parent(options);
this.$Input = null;
this.$Elm = null;
this.$Input = null;
this.$Elm = null;
this.$Button = null;
this.addEvents({
......@@ -37,19 +37,19 @@ define('package/quiqqer/currency/bin/settings/Import', [
* event : on import
*/
$onImport: function () {
this.$Input = this.getElm();
this.$Input = this.getElm();
this.$Input.type = 'hidden';
this.$Elm = new Element('div', {
'class': 'quiqqer-currency-allowed',
html : '<div class="quiqqer-currency-import-container"></div>',
styles : {
html: '<div class="quiqqer-currency-import-container"></div>',
styles: {
width: '100%'
}
}).wraps(this.$Input);
new QUIButton({
text : QUILocale.get(lg, 'ecb.import.button.text'),
text: QUILocale.get(lg, 'ecb.import.button.text'),
events: {
onClick: this.openDialog
},
......@@ -69,14 +69,14 @@ define('package/quiqqer/currency/bin/settings/Import', [
*/
openDialog: function () {
new QUIConfirm({
icon : 'fa fa-money',
texticon : 'fa fa-money',
title : QUILocale.get(lg, 'window.ecb.import.title'),
text : QUILocale.get(lg, 'window.ecb.import.text'),
icon: 'fa fa-money',
texticon: 'fa fa-money',
title: QUILocale.get(lg, 'window.ecb.import.title'),
text: QUILocale.get(lg, 'window.ecb.import.text'),
information: QUILocale.get(lg, 'window.ecb.import.information'),
maxHeight : 300,
maxWidth : 600,
events : {
maxHeight: 300,
maxWidth: 600,
events: {
onSubmit: function (Win) {
Win.Loader.show();
QUIAjax.post('package_quiqqer_currency_ajax_importFromECB', function () {
......
......@@ -46,7 +46,7 @@ abstract class AbstractCurrency implements CurrencyInterface
/**
* @var float|bool
*/
protected bool|float $exchangeRate = false;
protected bool | float $exchangeRate = false;
/**
* @var int
......@@ -182,7 +182,7 @@ public function toArray(): array
* @param null|QUI\Locale $Locale -optional
* @return float
*/
public function amount($amount, null |QUI\Locale $Locale = null): float
public function amount($amount, null | QUI\Locale $Locale = null): float
{
if (is_float($amount) || is_int($amount)) {
return $amount;
......@@ -215,7 +215,7 @@ public function amount($amount, null |QUI\Locale $Locale = null): float
* @param null|QUI\Locale $Locale - optional, locale object
* @return string
*/
public function format($amount, null|QUI\Locale $Locale = null): string
public function format($amount, null | QUI\Locale $Locale = null): string
{
if (!$Locale) {
$Locale = $this->Locale;
......@@ -279,7 +279,7 @@ public function autoupdate(): bool
*
* @throws Exception
*/
public function convert($amount, $Currency): float|int|string
public function convert($amount, $Currency): float | int | string
{
if (!is_numeric($amount)) {
QUI\System\Log::addError('Only numeric are allowed Currency->convert()', [
......@@ -347,7 +347,7 @@ public function convertFormat($amount, $Currency): string
* @param boolean|string|Currency $Currency - optional, default = false -> return own exchange rate
* @return float|boolean
*/
public function getExchangeRate($Currency = false): float|bool
public function getExchangeRate($Currency = false): float | bool
{
if ($Currency === false) {
return $this->exchangeRate;
......
......@@ -26,9 +26,9 @@ class Calc
* @throws QUI\Exception
*/
public static function convert(
float|int|string $amount,
Currency|array|string $currencyFrom,
Currency|array|string $currencyTo = 'EUR'
float | int | string $amount,
Currency | array | string $currencyFrom,
Currency | array | string $currencyTo = 'EUR'
): float {
$From = Handler::getCurrency($currencyFrom);
$To = Handler::getCurrency($currencyTo);
......@@ -47,9 +47,9 @@ public static function convert(
* @throws QUI\Exception
*/
public static function convertWithSign(
float|int|string $amount,
Currency|array|string $currencyFrom,
Currency|array|string $currencyTo = 'EUR'
float | int | string $amount,
Currency | array | string $currencyFrom,
Currency | array | string $currencyTo = 'EUR'
): string {
$From = Handler::getCurrency($currencyFrom);
$To = Handler::getCurrency($currencyTo);
......@@ -67,9 +67,9 @@ public static function convertWithSign(
* @throws QUI\Exception
*/
public static function getExchangeRateBetween(
Currency|array|string $currencyFrom,
Currency|array|string $currencyTo
): float|bool {
Currency | array | string $currencyFrom,
Currency | array | string $currencyTo
): float | bool {
$From = Handler::getCurrency($currencyFrom);
$To = Handler::getCurrency($currencyTo);
......
......@@ -52,7 +52,7 @@ public static function getAccountingCurrency(): ?Currency
*
* @return array|bool|string
*/
public static function conf(string $section, ?string $key): bool|array|string
public static function conf(string $section, ?string $key): bool | array | string
{
try {
$Package = QUI::getPackage('quiqqer/currency');
......
......@@ -23,7 +23,7 @@ class Currency extends AbstractCurrency
* @param QUI\Locale|null $Locale
* @return string
*/
public static function getCurrencyTypeTitle(?QUI\Locale $Locale = null): string
public static function getCurrencyTypeTitle(null | QUI\Locale $Locale = null): string
{
if (empty($Locale)) {
$Locale = QUI::getLocale();
......
......@@ -57,19 +57,22 @@ public static function table(): string
* Create a new currency
*
* @param string $currency - currency code
* @param integer|float $rate - currency exchange rate, default = 1
* @param float|integer $rate - currency exchange rate, default = 1
* @param string $type (optional) - Currency type
* @throws QUI\Exception
*/
public static function createCurrency(string $currency, $rate = 1, string $type = self::CURRENCY_TYPE_DEFAULT)
{
public static function createCurrency(
string $currency,
float | int | string $rate = 1,
string $type = self::CURRENCY_TYPE_DEFAULT
): void {
QUI\Permissions\Permission::checkPermission('currency.create');
$Currency = null;
try {
$Currency = self::getCurrency($currency);
} catch (QUI\Exception $Exception) {
} catch (QUI\Exception) {
}
if (!is_null($Currency)) {
......@@ -94,10 +97,6 @@ public static function createCurrency(string $currency, $rate = 1, string $type
]);
// create translations
$languageData = [
'datatype' => 'js,php'
];
$localeGroup = 'quiqqer/currency';
$localeText = 'currency.' . $currency . '.text';
$localeSign = 'currency.' . $currency . '.sign';
......@@ -123,7 +122,7 @@ public static function createCurrency(string $currency, $rate = 1, string $type
'currency.' . $currency . '.text',
'quiqqer/currency'
);
} catch (QUI\Exception $e) {
} catch (QUI\Exception) {
}
if (!empty($textData)) {
......@@ -142,7 +141,7 @@ public static function createCurrency(string $currency, $rate = 1, string $type
'currency.' . $currency . '.sign',
'quiqqer/currency'
);
} catch (QUI\Exception $e) {
} catch (QUI\Exception) {
}
......@@ -164,7 +163,7 @@ public static function createCurrency(string $currency, $rate = 1, string $type
* @param string $currency - currency code
* @throws QUI\Exception
*/
public static function deleteCurrency(string $currency)
public static function deleteCurrency(string $currency): void
{
QUI\Permissions\Permission::checkPermission('currency.delete');
......@@ -188,7 +187,7 @@ public static function deleteCurrency(string $currency)
/**
* Return the default currency
*
* @return Currency
* @return Currency|null
* @throws QUI\Exception
*/
public static function getDefaultCurrency(): ?Currency
......@@ -200,7 +199,7 @@ public static function getDefaultCurrency(): ?Currency
self::$Default = self::getCurrency(
$Config->getValue('currency', 'defaultCurrency')
);
} catch (QUI\Exception $Exception) {
} catch (QUI\Exception) {
QUI\System\Log::addWarning('Default currency is missing');
try {
......@@ -321,7 +320,7 @@ public static function getAllowedCurrencies(): array
foreach ($allowed as $currency) {
try {
$list[] = self::getCurrency($currency);
} catch (QUI\Exception $Exception) {
} catch (QUI\Exception) {
}
}
......@@ -378,7 +377,7 @@ public static function getCurrency(Currency | string | array $currency): Currenc
if (is_string($currency)) {
$code = $currency;
} elseif (is_array($currency) && isset($currency['code'])) {
} elseif (isset($currency['code'])) {
$code = $currency['code'];
}
......@@ -415,10 +414,10 @@ public static function existCurrency(string $currency): bool
/**
* Return all currency entries
*
* @param Locale|boolean $Locale - optional, for translation
* @param Locale|null $Locale - optional, for translation
* @return array
*/
public static function getCurrencies($Locale = false): array
public static function getCurrencies(null | QUI\Locale $Locale = null): array
{
if (!$Locale) {
$Locale = QUI::getLocale();
......@@ -429,12 +428,12 @@ public static function getCurrencies($Locale = false): array
try {
return QUI\Cache\Manager::get($cacheNameLang);
} catch (QUI\Exception $Exception) {
} catch (QUI\Exception) {
}
try {
$currencies = QUI\Cache\Manager::get($cacheName);
} catch (QUI\Exception $Exception) {
} catch (QUI\Exception) {
$currencies = [];
$data = self::getData();
......@@ -448,7 +447,7 @@ public static function getCurrencies($Locale = false): array
foreach ($currencies as $currency) {
try {
$Currency = self::getCurrency($currency);
} catch (QUI\Exception $Exception) {
} catch (QUI\Exception) {
continue;
}
......@@ -465,7 +464,7 @@ public static function getCurrencies($Locale = false): array
* @throws QUI\Database\Exception
* @throws QUI\Exception
*/
public static function updateCurrency($currency, $data)
public static function updateCurrency($currency, $data): void
{
QUI\Permissions\Permission::checkPermission('currency.edit');
......
0% oder .
You are about to add 0 people to the discussion. Proceed with caution.
Bearbeitung dieser Nachricht zuerst beenden!
Bitte registrieren oder zum Kommentieren