<?php
-// $Id$
//
// Site registration and verification form.
//
$tech=$input['tech'];
$address=$input['address'];
+# allow address to be left out
+function non_empty_address ($address) {
+ return !empty($address['line1']);
+}
+
if (! $empty_form ) {
// Look for missing/blank entries
$error = form_check_required ($site_form, $input);
// creating the site
$site['enabled']=FALSE;
+ global $PENDING_CONSORTIUM_ID;
+ $site['ext_consortium_id']=$PENDING_CONSORTIUM_ID;
$site_id=$adm->AddSite($site);
$api_error .= $adm->error();
if (empty($api_error)) {
- $verboses [] = "Site created as disabled";
+ $verboses [] = "Site created as disabled, with ext_consortium_id=".$PENDING_CONSORTIUM_ID;
} else {
$error .= $api_error;
}
$messages [] = "Please send a message to " . PLC_MAIL_SUPPORT_ADDRESS . " if this request is not instructed within a few days.";
// creating address
- $adm->AddSiteAddress($site_id,$address);
- $api_error = $adm->error();
- if (empty($api_error)) {
- $verboses [] = "Address created";
- } else {
- $error .= $api_error;
+ if (non_empty_address($address)) {
+ $adm->AddSiteAddress($site_id,$address);
+ $api_error = $adm->error();
+ if (empty($api_error)) {
+ $verboses [] = "Address created";
+ } else {
+ $error .= $api_error;
+ }
}
// creating PI
// creating TECH
$known_tech = $adm->GetPersons(array("email"=>$tech['email'],
"peer_id"=>NULL),array("person_id"));
+ // jan-2013 with improvements in plcapi-5.1-6 about managing persons and tags,
+ // AddPerson has gone more picky and we need to remove some fields
+ // that no longer are silently ignored by AddPerson
+ $user_role_required=$tech['user-role'];
+ unset($tech['user-role']);
if ($known_tech) {
$messages [] = " Note: Tech was already known";
$tech_id=$known_tech[0]['person_id'];
if ($adm->AddRoleToPerson('tech',$tech_id)) {
$verboses [] = $tech['email'] . " granted Tech role";
}
- if ( ($tech['user-role']) && $adm->AddRoleToPerson('user',$tech_id) ) {
+ if ( $user_role_required && $adm->AddRoleToPerson('user',$tech_id) ) {
$verboses [] = $tech['email'] . " granted User role";
}
}