scripts added
This commit is contained in:
@@ -0,0 +1,47 @@
|
||||
// last execution: Fri Dec 04 2020 14:28:53 GMT+0100 (Midden-Europese standaardtijd)
|
||||
|
||||
logAdd(log);
|
||||
|
||||
$contacts = Entity\GetRelated(Entity\This(), 'contacts', 1000);
|
||||
|
||||
$n = array\length($contacts);
|
||||
$i = 0;
|
||||
|
||||
while($i < $n,
|
||||
$contact = array\at($contacts, $i);
|
||||
$contact_id = attr($contact, 'id');
|
||||
logAdd(log, 'info', 'Contact: ', attr($contact, 'lastName'));
|
||||
|
||||
$nascholingen = Entity\GetRelated($contact, 'nascholingen', 1000);
|
||||
$j = 0;
|
||||
$m = array\length($nascholingen);
|
||||
|
||||
ifThen($m > 0,
|
||||
$totaal_2020s = Entity\GetRelated($contact, 'nascholingstotalen', 1000, 'jaar', 'asc', 'jaar=', 2020);
|
||||
$totaal_2020 = array\at($totaal_2020s, 0);
|
||||
$totaal_2020_id = attr($totaal_2020, 'id');
|
||||
|
||||
while($j < $m,
|
||||
$nascholing = array\at($nascholingen, $j);
|
||||
$nasch_id = attr($nascholing, 'id');
|
||||
logAdd(log, 'info', 'Nascholing: ', attr($nascholing, 'code'), ' - ', $nasch_id);
|
||||
$rec_id = record\create('HandmatigeNascholing', 'accNascholingId', $nasch_id,
|
||||
'contactId', $contact_id, 'status', 'presentielijst'
|
||||
);
|
||||
record\relate('Nascholingstotaal', $totaal_2020_id, 'nascholingen', $rec_id);
|
||||
$j = $j + 1;
|
||||
);
|
||||
|
||||
$j = 0;
|
||||
while ($j < $m,
|
||||
$nascholing = array\at($nascholingen, $j);
|
||||
$nasch_id = attr($nascholing, 'id');
|
||||
record\unrelate('Contact', $contact_id, 'nascholingen', $nasch_id);
|
||||
$j = $j + 1;
|
||||
);
|
||||
);
|
||||
|
||||
$i = $i + 1;
|
||||
);
|
||||
|
||||
|
||||
Reference in New Issue
Block a user