. */ if( isset($setup) ) { if( $setup['SetupBoardApproval']=="yes" ) { ################################################## ### Check participant types and send reminders ### ################################################## $total_notvalidated=0; $out.="\n\n=== Checking for errors in participant type / order ===\n"; $query="SELECT `BodyCode`, `BodyName`, `Email`, `BodyStatus`, `BodyCategory`, `BodyCategoryOrder`, `NoDelegates`, `NoEnvoys`, `NoVisitors`, `NoObservers` FROM `ab_bodies`"; if( mysql_num_rows($res=doquery($query))>0 ) { while( $row=mysql_fetch_array($res) ) { // Run for every body seperately $query2="SELECT `PersonID`, `FirstName`, `LastName`, `Email`, `ParticipantType`, `ParticipantOrder`, `BoardConfirmed` FROM `persons` WHERE `BodyCode`='".addslashes($row['BodyCode'])."'"; if( mysql_num_rows($res2=doquery($query2))>0 ) { $nums = getParticipantNum($row); $typeorder=array(); $notvalidated=array(); $notvalidatedmail=array(); while( $row2=mysql_fetch_array($res2) ) { // Duplicate check if( isset($typeorder[ $row2['ParticipantType'] ]) && isset($typeorder[ $row2['ParticipantType'] ][ $row2['ParticipantOrder'] ]) && strlen($typeorder[ $row2['ParticipantType'] ][ $row2['ParticipantOrder'] ])>0 ) { // There is already a participant with this participant type/order combination. Duplicate entry! $out.=$row['BodyCode'].": duplicate participant type/order for ".$typeorder[ $row2['ParticipantType'] ][ $row2['ParticipantOrder'] ]; $out.=" and ".$row2['FirstName']." ".$row2['LastName'].". Last one will be removed.\n"; $query3="UPDATE `persons` SET `ParticipantType`='-', `ParticipantOrder`=0, `Log`=CONCAT(`Log`,'\n".date("Y-m-d H:i:s").": removed participant type by rundaily (duplicate entry)') WHERE `BodyCode`='".addslashes($row['BodyCode'])."' AND `PersonID`=".addslashes($row2['PersonID']); if( doquery($query3) ) { $message ="Dear board of ".$row['BodyName'].",\n\n"; $message.="We found out that there are 2 participants for your body with the same "; $message.="participant type and participant order. The persons for which this was "; $message.="the case:\n\n"; $message.="\t- ".$typeorder[ $row2['ParticipantType'] ][ $row2['ParticipantOrder'] ]."\n"; $message.="\t- ".$row2['FirstName']." ".$row2['LastName']."\n\n"; $message.="The last one has been put back to the waiting list.\n\n"; $message.="In case of a move between bodies of a participant, it can happen that a participant has a participant type that is not available for the body he/she has been moved "; $message.="to. It is also possible that due to the move, 2 participants are on exactly the same place. This problem has been solved by removing the participant type of one "; $message.="participant. Please assign a new participant type (and possible move some other people to another place). This removal of participant type does not change the "; $message.="accepted status of this person (so, if this person was already accepted, this does not change), but it will prevent this person to be accepted in case he/she was "; $message.="not accepted yet.\n\n"; $message.="To assign this person a new participant type, you'll have to go to https://".$FULL_URL."board.php?login and login with your ".$ldap->getSystemName()." account. There you'll find "; $message.="this person on the list of people without a participant type. Simply select a participant type for this person, click save and you have solved the problem.\n\n"; $message.="Greetings,\n\n"; $message.="The webmaster\n"; $mail = new Mail($setup['MailReturnpath'], $row['Email']); $mail->setSubject("Error in participant list found (double booking)"); $mail->addHeader("To", "\"".Mail::encodeHeader(utf8_decode("Board ".$row['BodyName']))."\" <".$row['Email'].">"); $mail->addHeader("From", "\"".$setup['SetupEventType']." Application Mailer\" <".$setup['EventApplFromEmail'].">"); $mail->addHeader("X-Content", "typeordererror to board"); $mail->addHeader("X-BodyCode", $row['BodyCode']); $mail->addHeader("X-Signature", get_signature("typeordererror to board", $row['BodyCode'])); $mail->setMessage($message); $mail->send(true); }else { $out.="!!! Failed removing the participant type/order !!!\n"; } $row2['ParticipantType']="-"; $row2['ParticipantOrder']=0; $out.="\n"; }//if( duplicate type/order ) // Check valid type/order if( $row2['ParticipantType']!="-" ) $typeorder[ $row2['ParticipantType'] ][ $row2['ParticipantOrder'] ]=$row2['FirstName']." ".$row2['LastName']; if( ($row2['ParticipantType']=="delegate" AND $row2['ParticipantOrder']>$nums['NoDelegates']) OR ($row2['ParticipantType']=="envoy" AND $row2['ParticipantOrder']>$nums['NoEnvoys']) OR ($row2['ParticipantType']=="visitor" AND $row2['ParticipantOrder']>$nums['NoVisitors']) OR ($row2['ParticipantType']=="observer" AND $row2['ParticipantOrder']>$nums['NoObservers']) ) { // This participant has a type/order combination that is not allowed for this body $out.=$row['BodyCode'].": invalid participant type/order for ".$row2['FirstName']." ".$row2['LastName'].".\n"; $out.="Invalid values: ParticipantType=".$row2['ParticipantType']."; ParticipantOrder=".$row2['ParticipantOrder'].".\n"; $query3="UPDATE `persons` SET `ParticipantType`='-', `ParticipantOrder`=0, `Log`=CONCAT(`Log`,'\n".date("Y-m-d H:i:s").": removed participant type by rundaily (invalid type/order)') WHERE `BodyCode`='".addslashes($row['BodyCode'])."' AND `PersonID`=".addslashes($row2['PersonID']); if( doquery($query3) ) { $message ="Dear board of ".$row['BodyName'].",\n\n"; $message.="We found out that there is a participant for your body with a participant "; $message.="type and participant order that is not available for your body. The persons "; $message.="for which this was the case:\n\n"; $message.="\t- ".$row2['FirstName']." ".$row2['LastName']."\n\n"; $message.="This person has no participant type (delegate, envoy, observer or visitor) any more.\n\n"; $message.="Normally, this is caused by the upgrading/downgrading of your local.\n\n"; $message.="For every type of local (Contact, Contact Antenna or Antenna) there is a certain number of delegate, envoy, observer and visitor places available. With the "; $message.="upgrading or downgrading, this number can change. People that were placed on a place that is not available any more, will be removed participant type. This "; $message.="does NOT change their accepted status. So, if the person was accepted already when the participant was removed, the person will stay accepted. But, participants "; $message.="without a participant type will not be moved from the waiting list to the participants list, so it is imporant to assign a new participant type to this person. "; $message.="Also people that are already accepted should get a new participant type, as otherwise they will not be able to register at the ".$setup['SetupEventType'].".\n\n"; $message.="To assign this person a new participant type, you'll have to go to https://".$FULL_URL."board.php?login and login with your ".$ldap->getSystemName()." account. There you'll find "; $message.="this person on the list of people without a participant type. Simply select a participant type for this person, click save and you have solved the problem.\n\n"; $message.="Greetings,\n\n"; $message.="The webmaster\n"; $mail = new Mail($setup['MailReturnpath'], $row['Email']); $mail->setSubject("Error in participant list found (place not available)"); $mail->addHeader("To", "\"".Mail::encodeHeader(utf8_decode("Board ".$row['BodyName']))."\" <".$row['Email'].">"); $mail->addHeader("From", "\"".$setup['SetupEventType']." Application Mailer\" <".$setup['EventApplFromEmail'].">"); $mail->addHeader("X-Content", "typeordererror to board", $row2['PersonID']); $mail->addHeader("X-BodyCode", $row['BodyCode']); $mail->addHeader("X-Signature", get_signature("typeordererror to board", $row['BodyCode'])); $mail->setMessage($message); $mail->send(true); }else { $out.="!!! Failed removing the participant type/order !!!\n"; } $row2['ParticipantType']="-"; $row2['ParticipantOrder']=0; $out.="\n"; }// if( valid type/order ) if( $row2['ParticipantType']=="-" AND $row2['BoardConfirmed']!="no" ) { $notvalidated[]=$row2['FirstName']." ".$row2['LastName']." (ID ".$row2['PersonID'].")"; $notvalidatedmail[]=$row2['Email']; } }//while( $row2=mysql_fetch_array($res2) ) if( is_sendreminder() ) { // Reminders are send out today if( count($notvalidated)>0 ) { // This body has not validated all applications yet $total_notvalidated+=count($notvalidated); $out.="Sending reminder for ".$row['BodyName'].": ".count($notvalidated)." persons not validated.\n"; $toparticipants = array(); $message ="--- this mail has been send as a copy to the people that are not validated ---\n\n\n"; $message.="Dear board of ".$row['BodyName'].",\n\n"; $message.="We noticed that there are still applications for your body that are not "; $message.="validated. Please keep in mind that in order to let your members participate "; $message.="in this ".$setup['SetupEventType']." you'll have to assign them a participant type (delegate, "; $message.="envoy, visitor). If you fail to do so, your members will not be able to "; $message.="participate.\n\n"; $message.="At the moment, the following people are not yet validated:\n\n"; for( $i=0; $isetSubject("Please validate the ".$setup['SetupEventType']." applications for your body"); $mail->addHeader("To", "\"".Mail::encodeHeader(utf8_decode("Board ".$row['BodyName']))."\" <".$row['Email'].">"); $mail->addHeader("From", "\"".$setup['SetupEventType']." Application Mailer\" <".$setup['EventApplFromEmail'].">"); $mail->addHeader("X-Content", "reminder to board"); $mail->addHeader("X-BodyCode", $row['BodyCode']); $mail->addHeader("X-Signature", get_signature("reminder to board", $row['BodyCode'])); $mail->setMessage($message); $mail->send(true); // Make a separate mail as BCC to participants to prevent returning mails from triggering the wrong warnings $mail = new Mail($setup['MailReturnpath'], $toparticipants); $mail->setSubject("Please validate the ".$setup['SetupEventType']." applications for your body"); $mail->addHeader("To", "\"".Mail::encodeHeader(utf8_decode("Board ".$row['BodyName']))."\" <".$row['Email'].">"); $mail->addHeader("From", "\"".$setup['SetupEventType']." Application Mailer\" <".$setup['EventApplFromEmail'].">"); $mail->addHeader("X-Content", "reminder to bccparticipants"); $mail->addHeader("X-BodyCode", $row['BodyCode']); $mail->addHeader("X-Signature", get_signature("reminder to bccparticipants", $row['BodyCode'])); $mail->setMessage($message); $mail->send(true); } }//if( send reminders today ) }else { //if( mysql_num_rows($res2=doquery($query2))>0 ) // No applications for this body if( $setup['NoApplicationsReminder']>0 AND get_sql_date($setup['EventDateAppEnd'])==date("Y-m-d", strtotime("+"+$setup['NoApplicationsReminder']+" days")) AND get_sql_date($setup['EventDateAppEnd'])setSubject("Deadline for ".$setup['SetupEventType']." approaching - there is no applications from your local yet"); $mail->addHeader("To", "\"".Mail::encodeHeader(utf8_decode("Board ".$row['BodyName']))."\" <".$row['Email'].">"); $mail->addHeader("From", "\"Chair team AEGEE-Europe\" <".$setup['MailChair'].">"); $mail->addHeader("X-Content", "reminder to board"); $mail->addHeader("X-BodyCode", $row['BodyCode']); $mail->addHeader("X-Signature", get_signature("reminder to board", $row['BodyCode'])); $mail->setMessage($m); switch( $mail->send(true) ) { case Mail::MAIL_OK: $out.="No applications from ".$row['BodyName'].", send mail to inform board.\n"; break; case MAIL::MAIL_QUEUE: $out.="No applications from ".$row['BodyName'].", queued mail to inform board.\n"; break; default: $out.="No applications from ".$row['BodyName'].", but failed sending mail to board.\n"; } }else { $out.="No applications from ".$row['BodyName'].", but failed sending mail to board.\n"; } } } } }//while( $row=mysql_fetch_array($res) ) }else { $out.="!!! No bodies found !!!\n"; } }// if( $setup['SetupBoardApproval']=="yes" ) if( is_sendreminder() ) { $out.="\n\n=== Send out reminders to board for not validated applications ===\n"; $out.="Number of applications that are not validated: ".$total_notvalidated."\n"; } } ?>