Commit dbad254f authored by Romain Therville's avatar Romain Therville 🐭
Browse files

Update to tx_nG6_db.php

The function add_purge_demand() will not update the run and analyzes
tables if a demand already exists for a given project. (See new trigger)

Issue #192
parent a0b5630f
......@@ -359,18 +359,21 @@ class tx_nG6_db {
$GLOBALS['TYPO3_DB']->exec_INSERTquery('tx_nG6_purge_demand', $purge_data);
$purge_demand_id = $GLOBALS['TYPO3_DB']->sql_insert_id();
tx_nG6_db::update_field('tx_nG6_run', $all_runs_ids, array('mail_sent_date','purge_demand_id'),array($date,$purge_demand_id));
tx_nG6_db::update_field('tx_nG6_analyze',$all_analyses_ids,array('mail_sent_date','purge_demand_id'),array($date,$purge_demand_id));
//If the trigger "check_demand_insert" is triggered, the previous request will return 0, so we have to prevents the updates to tx_nG6_run and tx_nG6_analyzes in that case
if( $purge_demand_id > 0){
tx_nG6_db::update_field('tx_nG6_run', $all_runs_ids, array('mail_sent_date','purge_demand_id'),array($date,$purge_demand_id));
tx_nG6_db::update_field('tx_nG6_analyze',$all_analyses_ids,array('mail_sent_date','purge_demand_id'),array($date,$purge_demand_id));
foreach($user_ids as $a_id){
foreach($user_ids as $a_id){
$purge_data_user = array(
'tstamp' => $date,
'crdate' => $date,
'crdate' => $date,
'cruser_id' => $cruser_id,
'purge_demand_id' => $purge_demand_id,
'fe_users_id' => $a_id
);
$GLOBALS['TYPO3_DB']->exec_INSERTquery('tx_nG6_purge_demand_fe_users', $purge_data_user);
}
}
return $purge_demand_id;
}
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment