diff --git a/.github/workflows/main.yml b/.github/workflows/main.yml index 6dcd721..e8d598e 100755 --- a/.github/workflows/main.yml +++ b/.github/workflows/main.yml @@ -26,7 +26,7 @@ jobs: - name: Setup Composer run: composer install - name: Autoformat - run: 'vendor/bin/php-cs-fixer fix ./ --rules=''{"array_syntax": {"syntax": "short"}, "blank_line_after_namespace": true, "global_namespace_import": {"import_classes": false, "import_constants": false, "import_functions": false}, "binary_operator_spaces": {"operators": {"=": "align", ".=": "align", "+=": "align", "-=": "align", "*=": "align", "/=": "align", "|=": "align", "&=": "align", "=>": "align", "??=": "align"}}, "cast_spaces": {"space": "single"}, "class_attributes_separation": { "elements": {"const": "one", "method": "one", "property": "one"} }, "combine_consecutive_issets": true, "compact_nullable_typehint": true, "declare_strict_types": true, "declare_equal_normalize": {"space": "none"}, "elseif": true, "encoding": true, "explicit_indirect_variable": true, "explicit_string_variable": true, "function_to_constant": true, "implode_call": true, "increment_style": {"style": "pre"}, "is_null": true, "yoda_style": {"equal": false, "identical": false, "less_and_greater": false}, "line_ending": true, "logical_operators": true, "lowercase_cast": true, "constant_case": {"case": "lower"}, "lowercase_keywords": true, "modernize_types_casting": true, "native_constant_invocation": true, "native_function_casing": true, "native_function_invocation": {"include": ["@all"]}, "new_with_braces": true, "no_extra_blank_lines": {"tokens": ["break", "case", "continue", "curly_brace_block", "extra", "return", "switch", "throw", "use"]}, "no_spaces_after_function_name": true, "no_alias_functions": true, "no_closing_tag": true, "no_empty_comment": true, "no_empty_phpdoc": true, "no_empty_statement": true, "no_homoglyph_names": true, "no_mixed_echo_print": {"use": "echo"}, "no_php4_constructor": true, "no_singleline_whitespace_before_semicolons": true, "no_spaces_inside_parenthesis": true, "no_trailing_whitespace": true, "no_unneeded_final_method": true, "no_unused_imports": true, "no_useless_return": true, "no_whitespace_before_comma_in_array": true, "no_whitespace_in_blank_line": true, "non_printable_character": true, "normalize_index_brace": true, "ordered_imports": {"sort_algorithm": "alpha"}, "ordered_interfaces": {"order": "alpha"}, "php_unit_construct": true, "php_unit_internal_class": true, "php_unit_set_up_tear_down_visibility": true, "phpdoc_indent": true, "phpdoc_align": {"align": "vertical"}, "phpdoc_annotation_without_dot": true, "phpdoc_scalar": true, "phpdoc_return_self_reference": {"replacements": {"this": "self"}}, "phpdoc_trim": true, "phpdoc_trim_consecutive_blank_line_separation": true, "random_api_migration": true, "self_accessor": true, "return_type_declaration": {"space_before": "one"}, "semicolon_after_instruction": true, "set_type_to_cast": true, "short_scalar_cast": true, "single_blank_line_at_eof": true, "single_line_after_imports": true, "standardize_increment": true, "trailing_comma_in_multiline": true, "trim_array_spaces": true, "visibility_required": true, "void_return": true}'' --allow-risky=yes' + run: 'vendor/bin/php-cs-fixer fix ./ --rules=''{"array_syntax": {"syntax": "short"}, "blank_line_after_namespace": true, "global_namespace_import": {"import_classes": false, "import_constants": false, "import_functions": false}, "binary_operator_spaces": {"operators": {"=": "align", ".=": "align", "+=": "align", "-=": "align", "*=": "align", "/=": "align", "|=": "align", "&=": "align", "=>": "align", "??=": "align", ">>=": "align", "<<=": "align"}}, "cast_spaces": {"space": "single"}, "class_attributes_separation": { "elements": {"const": "one", "method": "one", "property": "one"} }, "combine_consecutive_issets": true, "compact_nullable_typehint": true, "declare_strict_types": true, "declare_equal_normalize": {"space": "none"}, "elseif": true, "encoding": true, "explicit_indirect_variable": true, "explicit_string_variable": true, "function_to_constant": true, "implode_call": true, "increment_style": {"style": "pre"}, "is_null": true, "yoda_style": {"equal": false, "identical": false, "less_and_greater": false}, "line_ending": true, "logical_operators": true, "lowercase_cast": true, "constant_case": {"case": "lower"}, "lowercase_keywords": true, "modernize_types_casting": true, "native_constant_invocation": true, "native_function_casing": true, "native_function_invocation": {"include": ["@all"]}, "new_with_braces": true, "no_extra_blank_lines": {"tokens": ["break", "case", "continue", "curly_brace_block", "extra", "return", "switch", "throw", "use"]}, "no_spaces_after_function_name": true, "no_alias_functions": true, "no_closing_tag": true, "no_empty_comment": true, "no_empty_phpdoc": true, "no_empty_statement": true, "no_homoglyph_names": true, "no_mixed_echo_print": {"use": "echo"}, "no_php4_constructor": true, "no_singleline_whitespace_before_semicolons": true, "no_spaces_inside_parenthesis": true, "no_trailing_whitespace": true, "no_unneeded_final_method": true, "no_unused_imports": true, "no_useless_return": true, "no_whitespace_before_comma_in_array": true, "no_whitespace_in_blank_line": true, "non_printable_character": true, "normalize_index_brace": true, "ordered_imports": {"sort_algorithm": "alpha"}, "ordered_interfaces": {"order": "alpha"}, "php_unit_construct": true, "php_unit_internal_class": true, "php_unit_set_up_tear_down_visibility": true, "phpdoc_indent": true, "phpdoc_align": {"align": "vertical"}, "phpdoc_annotation_without_dot": true, "phpdoc_scalar": true, "phpdoc_return_self_reference": {"replacements": {"this": "self"}}, "phpdoc_trim": true, "phpdoc_trim_consecutive_blank_line_separation": true, "random_api_migration": true, "self_accessor": true, "return_type_declaration": {"space_before": "one"}, "semicolon_after_instruction": true, "set_type_to_cast": true, "short_scalar_cast": true, "single_blank_line_at_eof": true, "single_line_after_imports": true, "standardize_increment": true, "trailing_comma_in_multiline": true, "trim_array_spaces": true, "visibility_required": true, "void_return": true}'' --allow-risky=yes' - name: Check for modified files id: git-check run: echo ::set-output name=modified::$(if git diff-index --quiet HEAD --; then echo "false"; else echo "true"; fi) diff --git a/Controller/ApiController.php b/Controller/ApiController.php index 4663dcb..9f5fa64 100755 --- a/Controller/ApiController.php +++ b/Controller/ApiController.php @@ -171,7 +171,7 @@ final class ApiController extends Controller private function createSupplierL11nFromRequest(RequestAbstract $request) : BaseStringL11n { $supplierL11n = new BaseStringL11n(); - $supplierL11n->ref = $request->getDataInt('supplier') ?? 0; + $supplierL11n->ref = $request->getDataInt('supplier') ?? 0; $supplierL11n->type = new NullBaseStringL11nType($request->getDataInt('type') ?? 0); $supplierL11n->setLanguage( $request->getDataString('language') ?? $request->getLanguage() diff --git a/Models/Supplier.php b/Models/Supplier.php index 0722931..5e2ef3c 100755 --- a/Models/Supplier.php +++ b/Models/Supplier.php @@ -70,7 +70,7 @@ class Supplier private array $partners = []; - /** + /** * Payments. * * @var Payment[] diff --git a/Models/SupplierAttributeValueMapper.php b/Models/SupplierAttributeValueMapper.php index 3106889..d38e358 100755 --- a/Models/SupplierAttributeValueMapper.php +++ b/Models/SupplierAttributeValueMapper.php @@ -37,14 +37,14 @@ final class SupplierAttributeValueMapper extends DataMapperFactory * @since 1.0.0 */ public const COLUMNS = [ - 'suppliermgmt_attr_value_id' => ['name' => 'suppliermgmt_attr_value_id', 'type' => 'int', 'internal' => 'id'], - 'suppliermgmt_attr_value_default' => ['name' => 'suppliermgmt_attr_value_default', 'type' => 'bool', 'internal' => 'isDefault'], - 'suppliermgmt_attr_value_valueStr' => ['name' => 'suppliermgmt_attr_value_valueStr', 'type' => 'string', 'internal' => 'valueStr'], - 'suppliermgmt_attr_value_valueInt' => ['name' => 'suppliermgmt_attr_value_valueInt', 'type' => 'int', 'internal' => 'valueInt'], - 'suppliermgmt_attr_value_valueDec' => ['name' => 'suppliermgmt_attr_value_valueDec', 'type' => 'float', 'internal' => 'valueDec'], - 'suppliermgmt_attr_value_valueDat' => ['name' => 'suppliermgmt_attr_value_valueDat', 'type' => 'DateTime', 'internal' => 'valueDat'], - 'suppliermgmt_attr_value_unit' => ['name' => 'suppliermgmt_attr_value_unit', 'type' => 'string', 'internal' => 'unit'], - 'suppliermgmt_attr_value_deptype' => ['name' => 'suppliermgmt_attr_value_deptype', 'type' => 'int', 'internal' => 'dependingAttributeType'], + 'suppliermgmt_attr_value_id' => ['name' => 'suppliermgmt_attr_value_id', 'type' => 'int', 'internal' => 'id'], + 'suppliermgmt_attr_value_default' => ['name' => 'suppliermgmt_attr_value_default', 'type' => 'bool', 'internal' => 'isDefault'], + 'suppliermgmt_attr_value_valueStr' => ['name' => 'suppliermgmt_attr_value_valueStr', 'type' => 'string', 'internal' => 'valueStr'], + 'suppliermgmt_attr_value_valueInt' => ['name' => 'suppliermgmt_attr_value_valueInt', 'type' => 'int', 'internal' => 'valueInt'], + 'suppliermgmt_attr_value_valueDec' => ['name' => 'suppliermgmt_attr_value_valueDec', 'type' => 'float', 'internal' => 'valueDec'], + 'suppliermgmt_attr_value_valueDat' => ['name' => 'suppliermgmt_attr_value_valueDat', 'type' => 'DateTime', 'internal' => 'valueDat'], + 'suppliermgmt_attr_value_unit' => ['name' => 'suppliermgmt_attr_value_unit', 'type' => 'string', 'internal' => 'unit'], + 'suppliermgmt_attr_value_deptype' => ['name' => 'suppliermgmt_attr_value_deptype', 'type' => 'int', 'internal' => 'dependingAttributeType'], 'suppliermgmt_attr_value_depvalue' => ['name' => 'suppliermgmt_attr_value_depvalue', 'type' => 'int', 'internal' => 'dependingAttributeValue'], ]; diff --git a/Models/SupplierL11nMapper.php b/Models/SupplierL11nMapper.php index 060b2cf..d0d7765 100755 --- a/Models/SupplierL11nMapper.php +++ b/Models/SupplierL11nMapper.php @@ -37,11 +37,11 @@ final class SupplierL11nMapper extends DataMapperFactory * @since 1.0.0 */ public const COLUMNS = [ - 'suppliermgmt_supplier_l11n_id' => ['name' => 'suppliermgmt_supplier_l11n_id', 'type' => 'int', 'internal' => 'id'], - 'suppliermgmt_supplier_l11n_description' => ['name' => 'suppliermgmt_supplier_l11n_description', 'type' => 'string', 'internal' => 'content', 'autocomplete' => true], + 'suppliermgmt_supplier_l11n_id' => ['name' => 'suppliermgmt_supplier_l11n_id', 'type' => 'int', 'internal' => 'id'], + 'suppliermgmt_supplier_l11n_description' => ['name' => 'suppliermgmt_supplier_l11n_description', 'type' => 'string', 'internal' => 'content', 'autocomplete' => true], 'suppliermgmt_supplier_l11n_supplier' => ['name' => 'suppliermgmt_supplier_l11n_supplier', 'type' => 'int', 'internal' => 'ref'], - 'suppliermgmt_supplier_l11n_lang' => ['name' => 'suppliermgmt_supplier_l11n_lang', 'type' => 'string', 'internal' => 'language'], - 'suppliermgmt_supplier_l11n_typeref' => ['name' => 'suppliermgmt_supplier_l11n_typeref', 'type' => 'int', 'internal' => 'type'], + 'suppliermgmt_supplier_l11n_lang' => ['name' => 'suppliermgmt_supplier_l11n_lang', 'type' => 'string', 'internal' => 'language'], + 'suppliermgmt_supplier_l11n_typeref' => ['name' => 'suppliermgmt_supplier_l11n_typeref', 'type' => 'int', 'internal' => 'type'], ]; /** diff --git a/Theme/Backend/Lang/en.lang.php b/Theme/Backend/Lang/en.lang.php index df890b6..077e502 100755 --- a/Theme/Backend/Lang/en.lang.php +++ b/Theme/Backend/Lang/en.lang.php @@ -14,93 +14,93 @@ declare(strict_types=1); return ['SupplierManagement' => [ 'AttributeTypes' => 'Attribute Types', - 'Attribute' => 'Attribute', - 'Accounting' => 'Accounting', - 'Addition' => 'Addition', - 'Address' => 'Address', - 'Addresses' => 'Addresses', - 'AreaManager' => 'Area Manager', - 'Articlegroup' => 'Articlegroup', - 'Articles' => 'Articles', - 'Balance' => 'Balance', - 'Bonus' => 'Bonus', - 'Business' => 'Business', - 'CLV' => 'CLV', - 'Calendar' => 'Calendar', - 'City' => 'City', - 'Client' => 'Client', - 'Clients' => 'Clients', - 'Contact' => 'Contact', - 'Country' => 'Country', - 'Created' => 'Created', - 'CreatedAt' => 'Created at', - 'CreditRating' => 'Credit Rating', - 'Creditcard' => 'Creditcard', - 'DSO' => 'DSO', - 'DUE' => 'Due', - 'Date' => 'Date', - 'Default' => 'Default', - 'Delivery' => 'Delivery', - 'Discount' => 'Discount', - 'DiscountP' => 'Discount %', - 'Documents' => 'Documents', - 'Due' => 'Due', - 'Email' => 'Email', - 'Fax' => 'Fax', - 'Files' => 'Files', - 'Freightage' => 'Freightage', - 'Group' => 'Group', - 'ID' => 'ID', - 'Info' => 'Info', - 'Invoice' => 'Invoice', - 'Invoices' => 'Invoices', - 'IsDefault' => 'Is default', - 'LastContact' => 'Last Contact', - 'LastOrder' => 'Last Order', - 'Log' => 'Log', - 'Logs' => 'Logs', - 'MRR' => 'MRR', - 'MTDSales' => 'MTD Sales', - 'Main' => 'Main', - 'Margin' => 'Margin', - 'Master' => 'Master', - 'Messages' => 'Messages', - 'Modified' => 'Modified', - 'Modules' => 'Modules', - 'Name' => 'Name', - 'Name1' => 'Name1', - 'Name2' => 'Name2', - 'Name3' => 'Name3', - 'Net' => 'Net', - 'Notes' => 'Notes', - 'Number' => 'Number', - 'Office' => 'Office', - 'Payment' => 'Payment', - 'PaymentTerm' => 'Payment Term', - 'Permission' => 'Permission', - 'Phone' => 'Phone', - 'Postal' => 'Postal', - 'Price' => 'Price', - 'Prices' => 'Prices', - 'Private' => 'Private', - 'Productgroup' => 'Productgroup', - 'Profile' => 'Profile', - 'Purchase' => 'Purchase', - 'Quantity' => 'Quantity', - 'RecentInvoices' => 'Recent Invoices', - 'Sales' => 'Sales', - 'Segment' => 'Segment', - 'Segments' => 'Segments', - 'Subtype' => 'Subtype', - 'Supplier' => 'Supplier', - 'Suppliers' => 'Suppliers', - 'Support' => 'Support', - 'Tags' => 'Tags', - 'Title' => 'Title', - 'Type' => 'Type', - 'Website' => 'Website', - 'Wire' => 'Wire', - 'YTDSales' => 'YTD Sales', - 'Zip' => 'Zip', - 'IMG_alt_map' => 'Map', + 'Attribute' => 'Attribute', + 'Accounting' => 'Accounting', + 'Addition' => 'Addition', + 'Address' => 'Address', + 'Addresses' => 'Addresses', + 'AreaManager' => 'Area Manager', + 'Articlegroup' => 'Articlegroup', + 'Articles' => 'Articles', + 'Balance' => 'Balance', + 'Bonus' => 'Bonus', + 'Business' => 'Business', + 'CLV' => 'CLV', + 'Calendar' => 'Calendar', + 'City' => 'City', + 'Client' => 'Client', + 'Clients' => 'Clients', + 'Contact' => 'Contact', + 'Country' => 'Country', + 'Created' => 'Created', + 'CreatedAt' => 'Created at', + 'CreditRating' => 'Credit Rating', + 'Creditcard' => 'Creditcard', + 'DSO' => 'DSO', + 'DUE' => 'Due', + 'Date' => 'Date', + 'Default' => 'Default', + 'Delivery' => 'Delivery', + 'Discount' => 'Discount', + 'DiscountP' => 'Discount %', + 'Documents' => 'Documents', + 'Due' => 'Due', + 'Email' => 'Email', + 'Fax' => 'Fax', + 'Files' => 'Files', + 'Freightage' => 'Freightage', + 'Group' => 'Group', + 'ID' => 'ID', + 'Info' => 'Info', + 'Invoice' => 'Invoice', + 'Invoices' => 'Invoices', + 'IsDefault' => 'Is default', + 'LastContact' => 'Last Contact', + 'LastOrder' => 'Last Order', + 'Log' => 'Log', + 'Logs' => 'Logs', + 'MRR' => 'MRR', + 'MTDSales' => 'MTD Sales', + 'Main' => 'Main', + 'Margin' => 'Margin', + 'Master' => 'Master', + 'Messages' => 'Messages', + 'Modified' => 'Modified', + 'Modules' => 'Modules', + 'Name' => 'Name', + 'Name1' => 'Name1', + 'Name2' => 'Name2', + 'Name3' => 'Name3', + 'Net' => 'Net', + 'Notes' => 'Notes', + 'Number' => 'Number', + 'Office' => 'Office', + 'Payment' => 'Payment', + 'PaymentTerm' => 'Payment Term', + 'Permission' => 'Permission', + 'Phone' => 'Phone', + 'Postal' => 'Postal', + 'Price' => 'Price', + 'Prices' => 'Prices', + 'Private' => 'Private', + 'Productgroup' => 'Productgroup', + 'Profile' => 'Profile', + 'Purchase' => 'Purchase', + 'Quantity' => 'Quantity', + 'RecentInvoices' => 'Recent Invoices', + 'Sales' => 'Sales', + 'Segment' => 'Segment', + 'Segments' => 'Segments', + 'Subtype' => 'Subtype', + 'Supplier' => 'Supplier', + 'Suppliers' => 'Suppliers', + 'Support' => 'Support', + 'Tags' => 'Tags', + 'Title' => 'Title', + 'Type' => 'Type', + 'Website' => 'Website', + 'Wire' => 'Wire', + 'YTDSales' => 'YTD Sales', + 'Zip' => 'Zip', + 'IMG_alt_map' => 'Map', ]]; diff --git a/Theme/Backend/attribute-type.tpl.php b/Theme/Backend/attribute-type.tpl.php index 1ba8593..a1980a0 100755 --- a/Theme/Backend/attribute-type.tpl.php +++ b/Theme/Backend/attribute-type.tpl.php @@ -15,7 +15,7 @@ declare(strict_types=1); use phpOMS\Localization\ISO639Enum; $attribute = $this->getData('attribute'); -$l11ns = $this->getData('l11ns'); +$l11ns = $this->getData('l11ns'); echo $this->getData('nav')->render(); ?> diff --git a/Theme/Backend/supplier-list.tpl.php b/Theme/Backend/supplier-list.tpl.php index 950cf67..053bc40 100755 --- a/Theme/Backend/supplier-list.tpl.php +++ b/Theme/Backend/supplier-list.tpl.php @@ -12,7 +12,6 @@ */ declare(strict_types=1); -use Modules\Media\Models\NullMedia; use phpOMS\Uri\UriFactory; /** @var \phpOMS\Views\View $this */ diff --git a/tests/Controller/Api/ApiControllerSupplierTrait.php b/tests/Controller/Api/ApiControllerSupplierTrait.php index 17a014c..338fb1a 100755 --- a/tests/Controller/Api/ApiControllerSupplierTrait.php +++ b/tests/Controller/Api/ApiControllerSupplierTrait.php @@ -14,7 +14,6 @@ declare(strict_types=1); namespace Modules\SupplierManagement\tests\Controller\Api; -use Modules\Profile\Models\ContactType; use phpOMS\Localization\ISO3166TwoEnum; use phpOMS\Message\Http\HttpRequest; use phpOMS\Message\Http\HttpResponse; diff --git a/tests/Controller/ApiControllerTest.php b/tests/Controller/ApiControllerTest.php index c22cbad..89e13be 100755 --- a/tests/Controller/ApiControllerTest.php +++ b/tests/Controller/ApiControllerTest.php @@ -55,13 +55,13 @@ final class ApiControllerTest extends \PHPUnit\Framework\TestCase protected string $appName = 'Api'; }; - $this->app->dbPool = $GLOBALS['dbpool']; + $this->app->dbPool = $GLOBALS['dbpool']; $this->app->unitId = 1; - $this->app->accountManager = new AccountManager($GLOBALS['session']); - $this->app->appSettings = new CoreSettings(); - $this->app->moduleManager = new ModuleManager($this->app, __DIR__ . '/../../../../Modules/'); - $this->app->dispatcher = new Dispatcher($this->app); - $this->app->eventManager = new EventManager($this->app->dispatcher); + $this->app->accountManager = new AccountManager($GLOBALS['session']); + $this->app->appSettings = new CoreSettings(); + $this->app->moduleManager = new ModuleManager($this->app, __DIR__ . '/../../../../Modules/'); + $this->app->dispatcher = new Dispatcher($this->app); + $this->app->eventManager = new EventManager($this->app->dispatcher); $this->app->eventManager->importFromFile(__DIR__ . '/../../../../Web/Api/Hooks.php'); $this->app->sessionManager = new HttpSession(36000); $this->app->l11nManager = new L11nManager();