scripts added
This commit is contained in:
@@ -0,0 +1,70 @@
|
||||
// last execution: Mon Aug 10 2026 14:14:13 GMT+0200 (Midden-Europese zomertijd)
|
||||
|
||||
// last execution: 2023-01-13 03:30:02
|
||||
$script_alle_totalen = configGet('script-bereken-nascholingstotalen');
|
||||
$script_calc_totaal_voor_jaar = configGet('script-bereken-nascholingstotaal-voor-jaar');
|
||||
|
||||
log('warning', 'Fetching Maximum nascholingstotaal');
|
||||
$rows= Record\FetchManyHash('Nascholingstotaal', 'jaar', 'jaar', 'desc', 'limit by', 1);
|
||||
$n_rows = array\length($rows);
|
||||
|
||||
log('warning', 'n_rows=', $n_rows);
|
||||
|
||||
logAdd(log);
|
||||
logAdd(log, 'info', 'n_rows = ', $n_rows);
|
||||
|
||||
ifThenElse($n_rows == 0,
|
||||
logAdd(log, 'info', '0 nascholingstotalen');
|
||||
,
|
||||
logAdd(log, 'info', $n_rows, ' nascholingstotalen');
|
||||
$row = array\at($rows, 0);
|
||||
$max_jaar = hash\get($row, 'jaar');
|
||||
logAdd(log, 'info', 'Maximum jaar met nascholingstotalen = ', $max_jaar);
|
||||
|
||||
logAdd(log, 'info', 'Herberekenen van alle nascholingstotalen.');
|
||||
|
||||
logAdd(log, 'info', 'Voor alle contacten gerelateerd aan dit script.');
|
||||
|
||||
$rows = record\fetchRelatedManyHash('Script', id, 'contacts', 'id, lidnummer, name', 'name', 'asc');
|
||||
$n_rows = array\length($rows);
|
||||
$i = 0;
|
||||
|
||||
log('warning', 'i=', $i, ', n_rows=', $n_rows);
|
||||
|
||||
while($i < $n_rows,
|
||||
$row = array\at($rows, $i);
|
||||
$contact_id = hash\get($row, 'id');
|
||||
$lidnummer = hash\get($row, 'lidnummer');
|
||||
$lastname = hash\get($row, 'name');
|
||||
logAdd(log, 'info', 'lid: ', $lidnummer, ' - ', $lastname, ' - herberekenen...');
|
||||
log('warning', 'Herberekenen alle totalen voor lid ', $lidnummer, ', id = ', $contact_id);
|
||||
|
||||
$tot_rows = Record\FetchManyHash('Nascholingstotaal', 'id, jaar',
|
||||
'jaar', 'asc', 'contactId=', $contact_id);
|
||||
$n_tot_rows = array\length($tot_rows);
|
||||
|
||||
ifThenElse($n_tot_rows == 0,
|
||||
logAdd(log, 'info', 'Geen nascholingstotalen voor dit lid');
|
||||
,
|
||||
$t_row = 0;
|
||||
while($t_row < $n_tot_rows,
|
||||
$tot_row = array\at($tot_rows, $t_row);
|
||||
$jaar = hash\get($tot_row, 'jaar');
|
||||
$t_id = hash\get($tot_row, 'id');
|
||||
|
||||
logAdd(log, 'info', 'Berekenen jaar voor lid ', $lidnummer, ', jaar:', $jaar);
|
||||
|
||||
$no_db_update == false;
|
||||
$year = $jaar;
|
||||
Exec($script_calc_totaal_voor_jaar);
|
||||
|
||||
$t_row = $t_row + 1;
|
||||
);
|
||||
|
||||
// bereken de hele zaak
|
||||
$year = $jaar;
|
||||
Exec($script_alle_totalen);
|
||||
);
|
||||
$i = $i + 1;
|
||||
);
|
||||
);
|
||||
Reference in New Issue
Block a user