Skip to content

Commit

Permalink
Merge pull request PrestaShop#37580 from boherm/merge-9.0.x-into-develop
Browse files Browse the repository at this point in the history
Merge `9.0.x` into `develop`
  • Loading branch information
jolelievre authored Dec 9, 2024
2 parents b6f2a90 + 0a6dc74 commit 23c159c
Show file tree
Hide file tree
Showing 217 changed files with 11,364 additions and 7,680 deletions.
2 changes: 1 addition & 1 deletion .github/workflows/api-module.yml
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@ jobs:
runs-on: ubuntu-latest
strategy:
matrix:
php: [ '8.1', '8.2', '8.3' ]
php: [ '8.1', '8.2', '8.3', '8.4' ]
fail-fast: false
steps:
- name: Setup PHP
Expand Down
2 changes: 1 addition & 1 deletion .github/workflows/behaviour.yml
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@ jobs:
runs-on: ubuntu-latest
strategy:
matrix:
php: [ '8.1', '8.2', '8.3' ]
php: [ '8.1', '8.2', '8.3', '8.4' ]
fail-fast: false
steps:
- name: Setup PHP
Expand Down
2 changes: 1 addition & 1 deletion .github/workflows/integration.yml
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@ jobs:
runs-on: ubuntu-latest
strategy:
matrix:
php: [ '8.1', '8.2', '8.3' ]
php: [ '8.1', '8.2', '8.3', '8.4' ]
fail-fast: false
steps:
- name: Setup PHP
Expand Down
4 changes: 2 additions & 2 deletions .github/workflows/php.yml
Original file line number Diff line number Diff line change
Expand Up @@ -53,7 +53,7 @@ jobs:
runs-on: ubuntu-latest
strategy:
matrix:
php: [ '8.1', '8.2', '8.3' ]
php: [ '8.1', '8.2', '8.3', '8.4' ]
fail-fast: false
steps:
- name: Setup PHP
Expand Down Expand Up @@ -93,7 +93,7 @@ jobs:
runs-on: ubuntu-latest
strategy:
matrix:
php: [ '8.1', '8.2', '8.3' ]
php: [ '8.1', '8.2', '8.3', '8.4' ]
fail-fast: false
steps:
- name: Setup PHP
Expand Down
13 changes: 13 additions & 0 deletions .github/workflows/sanity.yml
Original file line number Diff line number Diff line change
Expand Up @@ -60,6 +60,19 @@ jobs:
- php: 8.3
browser: chromium
db: mariadb
## 8.4
- php: 8.4
browser: chromium
db: mysql
- php: 8.4
browser: firefox
db: mysql
- php: 8.4
browser: webkit
db: mysql
- php: 8.4
browser: chromium
db: mariadb
fail-fast: false

steps:
Expand Down
47 changes: 47 additions & 0 deletions .github/workflows/verify_autoupgrade_label_and_approvals.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,47 @@
name: Verify 'Needs autoupgrade PR' label and approvals

on:
pull_request_review:
types: [ submitted ]

jobs:
check_label_and_appoval:
runs-on: ubuntu-latest
steps:

- name: Check if comment already exist
id: check_comment
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
run: |
PR_NUMBER=$(jq --raw-output .pull_request.number < $GITHUB_EVENT_PATH)
COMMENTS=$(gh api repos/${{ github.repository }}/issues/$PR_NUMBER/comments --jq '.[].body')
if echo "$COMMENTS" | grep -q "This means that the changes made in your PR must also be reported in the Autoupgrade module"; then
echo "comment_exists=true" >> $GITHUB_ENV
fi
- name: Verify approvals and label
id: check_approvals_and_labels
if: ${{ !env.comment_exists }}
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
LABELS: Needs autoupgrade PR
run: |
PR_NUMBER=$(jq --raw-output .pull_request.number < $GITHUB_EVENT_PATH)
APPROVAL_COUNT=$(gh api repos/${{ github.repository }}/pulls/$PR_NUMBER/reviews \
--jq '[.[] | select(.state == "APPROVED")] | length')
LABEL_PRESENT=$(gh api repos/${{ github.repository }}/issues/$PR_NUMBER/labels \
--jq '[.[] | select(.name == "${{ env.LABELS }}")] | length')
echo $APPROVAL_COUNT > ./approvals
echo $LABEL_PRESENT > ./label
- name: Upload
uses: actions/upload-artifact@v4
with:
name: approval_count
path: |
approvals
label
1 change: 1 addition & 0 deletions .php-cs-fixer.dist.php
Original file line number Diff line number Diff line change
Expand Up @@ -52,6 +52,7 @@
'single_line_throw' => false,
'no_alias_language_construct_call' => false,
'no_null_property_initialization' => false,
'nullable_type_declaration_for_default_null_value' => true,
'global_namespace_import' => [
'import_classes' => true,
'import_constants' => false,
Expand Down
32 changes: 16 additions & 16 deletions admin-dev/themes/new-theme/.webpack/common.js
Original file line number Diff line number Diff line change
Expand Up @@ -41,6 +41,7 @@ module.exports = {
},
entry: {
address: './js/pages/address',
alias_form: './js/pages/alias/form',
api_client: './js/pages/api-client',
api_client_form: './js/pages/api-client/form',
attachment: './js/pages/attachment',
Expand All @@ -51,6 +52,7 @@ module.exports = {
backup: './js/pages/backup',
carrier: './js/pages/carrier',
carrier_form: './js/pages/carrier/form',
cart: './js/pages/cart',
cart_rule: './js/pages/cart-rule',
cart_rule_form: './js/pages/cart-rule/form',
catalog: './js/app/pages/catalog',
Expand All @@ -65,42 +67,47 @@ module.exports = {
combination_bulk: './js/pages/product/combination/bulk',
combination_form: './js/pages/product/combination/form',
contacts: './js/pages/contacts',
country: './js/pages/country',
country_form: './js/pages/country/form',
create_product: './js/pages/product/create/create-product',
create_product_default_theme: './scss/pages/product/create_product_default_theme.scss',
credit_slip: './js/pages/credit-slip',
currency: './js/pages/currency',
currency_form: './js/pages/currency/form',
customer: './js/pages/customer/index',
customer_form: './js/pages/customer/form',
customer_address_form: './js/pages/address/form',
customer_form: './js/pages/customer/form',
customer_groups: './js/pages/customer-groups',
customer_outstanding: './js/pages/outstanding',
customer_preferences: './js/pages/customer-preferences',
customer_thread: './js/pages/customer-thread/index',
customer_thread_view: './js/pages/customer-thread/view',
customer_threads: './scss/pages/customer_thread/customer_thread.scss',
customer_groups: './js/pages/customer-groups',
email: './js/pages/email',
employee: './js/pages/employee/index',
employee_form: './js/pages/employee/form',
error: './js/pages/error',
feature: './js/pages/feature',
feature_value: './js/pages/feature/feature-value',
feature_value_form: './js/pages/feature/feature-value/form',
feature_flag: './js/pages/feature-flag/index',
feature_form: './js/pages/feature/form',
feature_value: './js/pages/feature/feature-value',
feature_value_form: './js/pages/feature/feature-value/form',
form_popover_error: './js/components/form/form-popover-error',
geolocation: './js/pages/geolocation',
image_settings: './js/pages/image-settings',
imports: './js/pages/import',
improve_design_positions: './js/pages/improve/design_positions',
invoices: './js/pages/invoices',
language: './js/pages/language',
light_theme: './scss/light_theme.scss',
localization: './js/pages/localization',
login: './scss/pages/login/login.scss',
login_form: './js/pages/login',
logs: './js/pages/logs',
main: './js/theme',
maintenance: './js/pages/maintenance',
manufacturer: './js/pages/manufacturer',
manufacturer_address_form:
'./js/pages/manufacturer/manufacturer_address_form',
manufacturer_address_form: './js/pages/manufacturer/manufacturer_address_form',
merchandise_return: './js/pages/merchandise-return',
meta: './js/pages/meta',
module: './js/pages/module',
Expand All @@ -123,6 +130,7 @@ module.exports = {
performance_preferences: './js/pages/performance-preferences',
permission: './js/pages/permission',
permissions: './scss/pages/permissions/permissions.scss',
pre_select_product_shop: './js/pages/product/shop/pre-select-product-shop',
product: './scss/pages/product/product_page.scss',
product_catalog: './scss/pages/product/products_catalog.scss',
product_create: './js/pages/product/create',
Expand All @@ -131,11 +139,11 @@ module.exports = {
product_page: './js/product-page/index',
product_preferences: './js/pages/product-preferences',
product_shops: './js/pages/product/shop',
pre_select_product_shop: './js/pages/product/shop/pre-select-product-shop',
profiles: './js/pages/profiles',
reset_password: './js/pages/login/reset-password',
search_engine: './js/pages/search-engine',
rtl: './scss/rtl.scss',
search: './js/pages/search',
search_engine: './js/pages/search-engine',
security: './js/pages/security',
shipping_preferences: './js/pages/shipping-preferences',
specific_price_form: './js/pages/product/specific-price/form',
Expand All @@ -149,22 +157,14 @@ module.exports = {
tax: './js/pages/tax',
tax_rules: './js/pages/tax-rules',
tax_rules_group: './js/pages/tax-rules-group',
light_theme: './scss/light_theme.scss',
theme: './scss/theme.scss',
rtl: './scss/rtl.scss',
themes: './js/pages/themes',
title: './js/pages/title',
title_form: './js/pages/title/form',
translation_settings: './js/pages/translation-settings',
translations: './js/app/pages/translations',
webservice: './js/pages/webservice',
zone: './js/pages/zone',
country: './js/pages/country',
country_form: './js/pages/country/form',
create_product: './js/pages/product/create/create-product',
image_settings: './js/pages/image-settings',
create_product_default_theme: './scss/pages/product/create_product_default_theme.scss',
cart: './js/pages/cart',
},
output: {
publicPath: '',
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,107 @@
/**
* Copyright since 2007 PrestaShop SA and Contributors
* PrestaShop is an International Registered Trademark & Property of PrestaShop SA
*
* NOTICE OF LICENSE
*
* This source file is subject to the Open Software License (OSL 3.0)
* that is bundled with this package in the file LICENSE.md.
* It is also available through the world-wide-web at this URL:
* https://opensource.org/licenses/OSL-3.0
* If you did not receive a copy of the license and are unable to
* obtain it through the world-wide-web, please send an email
* to [email protected] so we can send you a copy immediately.
*
* DISCLAIMER
*
* Do not edit or add to this file if you wish to upgrade PrestaShop to newer
* versions in the future. If you wish to customize PrestaShop for your
* needs please refer to https://devdocs.prestashop.com/ for more information.
*
* @author PrestaShop SA and Contributors <[email protected]>
* @copyright Since 2007 PrestaShop SA and Contributors
* @license https://opensource.org/licenses/OSL-3.0 Open Software License (OSL 3.0)
*/

import AliasFormMap from '@pages/alias/form/alias-form.map';

const {$} = window;

/**
* This component is used in alias form page to manage the behavior of the aliases collection.
*/
export default class AliasesCollectionManager {
$collection: JQuery;

idxAlias: number;

constructor() {
// Get dom element of the collection
this.$collection = $(AliasFormMap.aliasesCollection);
this.idxAlias = this.$collection.children(AliasFormMap.aliasItem).length;
// Initialize listeners
this.initListeners();
// If we have no alias, we add one
if (this.$collection.children().length === 0) {
this.onAddAlias(null, false);
}
}

// Initialize listeners to manage the collection properly.
private initListeners(): void {
this.$collection.parent().on('click', AliasFormMap.addAliasButton, (e: Event) => this.onAddAlias(e));
this.$collection.on('click', AliasFormMap.deleteAliasButton, (e: Event) => this.onDeleteAlias(e));
this.$collection.on('keydown', AliasFormMap.aliasItemInput, (e: Event) => this.onKeyDownAlias(e as KeyboardEvent));
}

// On click in add alias button
private onAddAlias(e: Event|null = null, needFocus: boolean = true): void {
if (e) {
e.preventDefault();
}
// +1 idx
this.idxAlias += 1;
// Retrieve the prototype and format it
let prototype = this.$collection.data('prototype');
prototype = prototype.replace(/__name__/g, this.idxAlias);
// Then, add it at the bottom of the collection
this.$collection.append(prototype);
// We set active to true on the added alias
this.$collection.children().last().find('[name$="[active]"][value=1]').prop('checked', true);
// We set focus on last added input if needed
if (needFocus) {
this.$collection.children().last().find(AliasFormMap.aliasItemInput).focus();
}
// Check if we need to display delete buttons or not
this.refreshDeleteAliasButtons();
}

// On click on delete alias button
private onDeleteAlias(e: Event): void {
e.preventDefault();
// Remove the alias element related to this button
const $item = $(e.target as HTMLElement);
$item.parents(AliasFormMap.aliasItem).remove();
// Check if we need to display delete buttons or not
this.refreshDeleteAliasButtons();
}

// On key down in alias item input => if it's a comma (and the value is already set), add a new alias and focus on new input
private onKeyDownAlias(e: KeyboardEvent): void {
if (e.key === ',') {
e.preventDefault();
if (this.$collection.children().last().find('input').val() !== '') {
this.onAddAlias(e);
}
}
}

// Check if we need to display delete buttons or not (if there is only one alias, we hide the delete buttons)
private refreshDeleteAliasButtons(): void {
if (this.$collection.children().length === 1) {
this.$collection.children().find(AliasFormMap.deleteAliasButton).addClass('d-none');
} else {
this.$collection.children().find(AliasFormMap.deleteAliasButton).removeClass('d-none');
}
}
};
32 changes: 32 additions & 0 deletions admin-dev/themes/new-theme/js/pages/alias/form/alias-form.map.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,32 @@
/**
* Copyright since 2007 PrestaShop SA and Contributors
* PrestaShop is an International Registered Trademark & Property of PrestaShop SA
*
* NOTICE OF LICENSE
*
* This source file is subject to the Open Software License (OSL 3.0)
* that is bundled with this package in the file LICENSE.md.
* It is also available through the world-wide-web at this URL:
* https://opensource.org/licenses/OSL-3.0
* If you did not receive a copy of the license and are unable to
* obtain it through the world-wide-web, please send an email
* to [email protected] so we can send you a copy immediately.
*
* DISCLAIMER
*
* Do not edit or add to this file if you wish to upgrade PrestaShop to newer
* versions in the future. If you wish to customize PrestaShop for your
* needs please refer to https://devdocs.prestashop.com/ for more information.
*
* @author PrestaShop SA and Contributors <[email protected]>
* @copyright Since 2007 PrestaShop SA and Contributors
* @license https://opensource.org/licenses/OSL-3.0 Open Software License (OSL 3.0)
*/

export default {
aliasesCollection: '.js-aliases-collection',
addAliasButton: '.js-btn-add-alias',
deleteAliasButton: '.js-btn-delete-alias',
aliasItem: '.alias-item',
aliasItemInput: '.form-control[name$="[alias]"]',
};
Loading

0 comments on commit 23c159c

Please sign in to comment.