better admin licenses view

This commit is contained in:
2021-07-22 11:37:43 +02:00
parent 1806c09228
commit ab3379e361
7 changed files with 32 additions and 1801 deletions

View File

@@ -73,12 +73,12 @@ process:
# plugin: migration_lookup
# migration: # your product variation migration
# source: nid
product_variation:
plugin: static_map
source: rid
map:
6: 2 # web annual
10: 7 # web annual student
product_variation: product_variation_id
# plugin: static_map
# source: rid
# map:
# 6: 2 # web annual
# 10: 7 # web annual
migration_dependencies:
required:

View File

@@ -127,6 +127,7 @@ class D7UcRolesLicense extends DrupalSqlBase {
'created',
'modified',
]);
$query->fields('uop', ['model']);
$query->orderBy('created', 'DESC');
$orders = $query->execute()->fetchAll();
// print_r($orders);
@@ -141,9 +142,29 @@ class D7UcRolesLicense extends DrupalSqlBase {
$first_order = array_shift($orders);
$row->setSourceProperty('created', $first_order['created']);
$row->setSourceProperty('renewed', $first_order['created']);
if(count($orders)){
$last_order = array_pop($orders);
$row->setSourceProperty('renewed', $last_order['created']);
}else{
$last_order = $first_order;
}
drush_print(print_r($last_order, true));
// put the right product variation web OR web-showroom
switch($last_order['model']){
case "abo01-A":
$product_variation_id = 2;
break;
case "abo01-B":
case "abo01-C":
$product_variation_id = 6;
break;
}
if(isset($product_variation_id)){
drush_print($row->getSourceProperty('mail').' product_variation_id: '.$product_variation_id);
$row->setSourceProperty('product_variation_id', $product_variation_id);
}
}