Skip to content

Commit

Permalink
Merge pull request #179 from PrestaShop/dev
Browse files Browse the repository at this point in the history
Release v1.4.3
  • Loading branch information
kpodemski authored Dec 15, 2022
2 parents 3ef2608 + 01998cb commit 2b94cd4
Show file tree
Hide file tree
Showing 5 changed files with 58 additions and 75 deletions.
61 changes: 3 additions & 58 deletions .github/workflows/build-release.yml
Original file line number Diff line number Diff line change
Expand Up @@ -2,61 +2,6 @@ name: Build
on: [push, pull_request]

jobs:
deploy:
name: build dependencies & create artifact
runs-on: ubuntu-latest
steps:
- name: Checkout
uses: actions/checkout@v2.0.0
- name: Install composer dependencies
run: composer install --no-dev -o
- name: Clean-up project
uses: PrestaShopCorp/github-action-clean-before-deploy@v1.0
- name: Prepare auto-index tool
run: |
composer global require prestashop/autoindex
- name: Generate index.php
run: |
~/.composer/vendor/bin/autoindex
- name: Create & upload artifact
uses: actions/upload-artifact@v1
with:
name: ${{ github.event.repository.name }}
path: ../
update_release_draft:
runs-on: ubuntu-latest
needs: [deploy]
if: github.event_name == 'push' && github.event.ref == 'refs/heads/master'
steps:
- name: Download artifact
uses: actions/download-artifact@v1
with:
name: ${{ github.event.repository.name }}
- id: release_info
uses: toolmantim/release-drafter@v5
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
- name: Prepare for Release
run: |
cd ${{ github.event.repository.name }}
zip -r ${{ github.event.repository.name }}.zip ${{ github.event.repository.name }}
- name: Clean existing assets
shell: bash
run: |
curl -fsSL https://github.com/github/hub/raw/master/script/get | bash -s 2.14.1
assets=`bin/hub api -t repos/${{ github.repository }}/releases/${{ steps.release_info.outputs.id }}/assets | awk '/\].url/ { print $2 }'`
for asset in $assets
do
bin/hub api -X DELETE $asset
done
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
- name: Publish to GitHub Release
uses: actions/upload-release-asset@v1.0.1
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
with:
upload_url: ${{ steps.release_info.outputs.upload_url }}
asset_path: ./${{ github.event.repository.name }}/${{ github.event.repository.name }}.zip
asset_name: ${{ github.event.repository.name }}.zip
asset_content_type: application/zip
build-and-release-draft:
name: Build & Release draft
uses: PrestaShop/.github/.github/workflows/build-release.yml@master
2 changes: 1 addition & 1 deletion config.xml
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
<module>
<name>psgdpr</name>
<displayName><![CDATA[Official GDPR compliance]]></displayName>
<version><![CDATA[1.4.2]]></version>
<version><![CDATA[1.4.3]]></version>
<description><![CDATA[Make your store comply with the General Data Protection Regulation (GDPR).]]></description>
<author><![CDATA[PrestaShop]]></author>
<tab><![CDATA[front_office_features]]></tab>
Expand Down
12 changes: 6 additions & 6 deletions psgdpr.php
Original file line number Diff line number Diff line change
Expand Up @@ -122,7 +122,7 @@ public function __construct()
// Settings
$this->name = 'psgdpr';
$this->tab = 'administration';
$this->version = '1.4.2';
$this->version = '1.4.3';
$this->author = 'PrestaShop';
$this->need_instance = 0;

Expand Down Expand Up @@ -566,6 +566,7 @@ public function hookAdditionalCustomerFormFields()
$label = Configuration::get('PSGDPR_CUSTOMER_FORM', $id_lang);
break;
case 'authentication':
case 'registration':
case 'order':
case 'order-confirmation':
$active = Configuration::get('PSGDPR_CREATION_FORM_SWITCH');
Expand Down Expand Up @@ -658,7 +659,7 @@ public function hookDisplayCustomerAccount()
'ps_version' => $this->ps_version,
]);

return $this->display(dirname(__FILE__), 'views/templates/front/customerAccount.tpl');
return $this->fetch('module:' . $this->name . '/views/templates/front/customerAccount.tpl');
}

/**
Expand Down Expand Up @@ -714,7 +715,7 @@ public function getRegisteredModules()
{
$modulesRegister = Hook::getHookModuleExecList('registerGDPRConsent'); // get modules using the gdpr hook

if (empty($modulesRegister) || count($modulesRegister) <= 1) { // if 0 module stop (1 to exclude gdpr module)
if (empty($modulesRegister)) { // if 0 module stop
return;
}

Expand Down Expand Up @@ -904,6 +905,7 @@ public function getCustomerDataFromPrestashop(Customer $customer)

// get referrers
if (version_compare(_PS_VERSION_, '8.0.0', '<')) {
// @phpstan-ignore-next-line
$data['referrer'] = Referrer::getReferrers($customer->id);
}

Expand Down Expand Up @@ -1139,12 +1141,10 @@ public function getCustomerNameById($id_customer)
*/
public function getAgeCustomer($id_customer)
{
$value = (int) Db::getInstance((bool) _PS_USE_SQL_SLAVE_)->getValue('SELECT AVG(DATEDIFF("' . date('Y-m-d') . ' 00:00:00", birthday))
return (int) Db::getInstance((bool) _PS_USE_SQL_SLAVE_)->getValue('SELECT TIMESTAMPDIFF(YEAR, birthday, CURDATE()) AS age
FROM `' . _DB_PREFIX_ . 'customer` c
WHERE active = 1
AND id_customer = ' . (int) $id_customer . '
AND birthday IS NOT NULL AND birthday != "0000-00-00" ' . Shop::addSqlRestriction());

return (int) round($value / 365);
}
}
37 changes: 37 additions & 0 deletions upgrade/upgrade-1.4.3.php
Original file line number Diff line number Diff line change
@@ -0,0 +1,37 @@
<?php

/**
* 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 Academic Free License 3.0 (AFL-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/AFL-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 license@prestashop.com so we can send you a copy immediately.
*
* @author PrestaShop SA <contact@prestashop.com>
* @copyright Since 2007 PrestaShop SA and Contributors
* @license https://opensource.org/licenses/AFL-3.0 Academic Free License 3.0 (AFL-3.0)
*/
if (!defined('_PS_VERSION_')) {
exit;
}

/**
* @param Psgdpr $module
*
* @return bool
*/
function upgrade_module_1_4_3($module)
{
if (!$module->isRegisteredInHook('displayGDPRConsent')) {
return $module->registerHook('displayGDPRConsent');
}

return true;
}
21 changes: 11 additions & 10 deletions views/templates/hook/displayGDPRConsent.tpl
Original file line number Diff line number Diff line change
Expand Up @@ -16,16 +16,17 @@
* @copyright Since 2007 PrestaShop SA and Contributors
* @license https://opensource.org/licenses/AFL-3.0 Academic Free License 3.0 (AFL-3.0)
*}

<div id="gdpr_consent" class="gdpr_module_{$psgdpr_id_module|escape:'htmlall':'UTF-8'}">
<span class="custom-checkbox">
<label class="psgdpr_consent_message">
<input id="psgdpr_consent_checkbox_{$psgdpr_id_module|escape:'htmlall':'UTF-8'}" name="psgdpr_consent_checkbox" type="checkbox" value="1" class="psgdpr_consent_checkboxes_{$psgdpr_id_module|escape:'htmlall':'UTF-8'}">
<span><i class="material-icons rtl-no-flip checkbox-checked psgdpr_consent_icon"></i></span>
<span>{$psgdpr_consent_message nofilter}</span>{* html data *}
</label>
</span>
</div>
{block name='gdpr_checkbox'}
<div class="gdpr_consent gdpr_module_{$psgdpr_id_module|escape:'htmlall':'UTF-8'}">
<span class="custom-checkbox">
<label class="psgdpr_consent_message">
<input id="psgdpr_consent_checkbox_{$psgdpr_id_module|escape:'htmlall':'UTF-8'}" name="psgdpr_consent_checkbox" type="checkbox" value="1" class="psgdpr_consent_checkboxes_{$psgdpr_id_module|escape:'htmlall':'UTF-8'}">
<span><i class="material-icons rtl-no-flip checkbox-checked psgdpr_consent_icon"></i></span>
<span>{$psgdpr_consent_message nofilter}</span>{* html data *}
</label>
</span>
</div>
{/block}
{literal}
<script type="text/javascript">
var psgdpr_front_controller = "{/literal}{$psgdpr_front_controller|escape:'htmlall':'UTF-8'}{literal}";
Expand Down

0 comments on commit 2b94cd4

Please sign in to comment.