added state to lincesed roles display in user edit form

This commit is contained in:
Bachir Soussi Chiadmi 2022-11-17 12:46:46 +01:00
parent 45379fd988
commit dc4c763d99
1 changed files with 6 additions and 4 deletions

View File

@ -65,7 +65,7 @@ function materio_commerce_form_role_delegation_role_assign_form_alter(&$form, &$
$granted = $license->getGrantedTime(); $granted = $license->getGrantedTime();
$expires = $license->getExpiresTime(); $expires = $license->getExpiresTime();
$license_state = $license->getState()->getValue()['value'];
$license_edit_url = $license->toUrl(); $license_edit_url = $license->toUrl();
$license_link = Link::fromTextAndUrl(t('edit license'), $license_edit_url); $license_link = Link::fromTextAndUrl(t('edit license'), $license_edit_url);
@ -80,9 +80,10 @@ function materio_commerce_form_role_delegation_role_assign_form_alter(&$form, &$
)), $order_url); )), $order_url);
} }
$description .= t("<br/>-- @product: @variation | granted: @granted | expires: @expires | @license_link | @order_link", array( $description .= t("<br/>-- @product: @variation | license state: @license_state | granted: @granted | expires: @expires | @license_link | @order_link", array(
'@product' => $product ? $product->getTitle() : t('no product'), '@product' => $product ? $product->getTitle() : t('no product'),
'@variation' => $product_variation ? $product_variation->getTitle() : t('no variation'), '@variation' => $product_variation ? $product_variation->getTitle() : t('no variation'),
'@license_state' => $license_state,
'@granted' => date('d-m-Y', $granted), '@granted' => date('d-m-Y', $granted),
'@expires' => $expires === "0" ? 'never' : date('d-m-Y', $expires), '@expires' => $expires === "0" ? 'never' : date('d-m-Y', $expires),
'@license_link' => $license_link->toString(), '@license_link' => $license_link->toString(),
@ -139,7 +140,7 @@ function materio_commerce_form_user_form_alter(&$form, &$form_state, $form_id) {
$granted = $license->getGrantedTime(); $granted = $license->getGrantedTime();
$expires = $license->getExpiresTime(); $expires = $license->getExpiresTime();
$license_state = $license->getState()->getValue()['value'];
$license_edit_url = $license->toUrl(); $license_edit_url = $license->toUrl();
$license_link = Link::fromTextAndUrl(t('edit license'), $license_edit_url); $license_link = Link::fromTextAndUrl(t('edit license'), $license_edit_url);
@ -154,9 +155,10 @@ function materio_commerce_form_user_form_alter(&$form, &$form_state, $form_id) {
)), $order_url); )), $order_url);
} }
$description .= t("<br/>-- @product: @variation | granted: @granted | expires: @expires | @license_link | @order_link", array( $description .= t("<br/>-- @product: @variation | license state: @license_state | granted: @granted | expires: @expires | @license_link | @order_link", array(
'@product' => $product ? $product->getTitle() : t('no product'), '@product' => $product ? $product->getTitle() : t('no product'),
'@variation' => $product_variation ? $product_variation->getTitle() : t('no variation'), '@variation' => $product_variation ? $product_variation->getTitle() : t('no variation'),
'@license_state' => $license_state,
'@granted' => date('d-m-Y', $granted), '@granted' => date('d-m-Y', $granted),
'@expires' => $expires === "0" ? 'never' : date('d-m-Y', $expires), '@expires' => $expires === "0" ? 'never' : date('d-m-Y', $expires),
'@license_link' => $license_link->toString(), '@license_link' => $license_link->toString(),