$this->_joblog = TRUE;
}
else {
- while(list($short, $long) = each($this->_additional_arguments)) {
+ while (list($short, $long) = each($this->_additional_arguments)) {
if ($arg == '-' . $short || $arg == '--' . $long) {
$property = '_' . $long;
$this->$property = $value;
}
if (!empty($this->_user)) {
- if(!CRM_Utils_System::authenticateScript(TRUE, $this->_user, $this->_password, TRUE, FALSE, FALSE)) {
+ if (!CRM_Utils_System::authenticateScript(TRUE, $this->_user, $this->_password, TRUE, FALSE, FALSE)) {
$this->_log(ts("Failed to login as %1. Wrong username or password.", array('1' => $this->_user)));
return FALSE;
}
$result = civicrm_api($this->_entity, 'Get', $this->_params);
$first = TRUE;
foreach ($result['values'] as $row) {
- if($first) {
+ if ($first) {
$columns = array_keys($row);
fputcsv($out, $columns, $this->separator, '"');
$first = FALSE;
}
//handle values returned as arrays (i.e. custom fields that allow multiple selections) by inserting a control character
foreach ($row as &$field) {
- if(is_array($field)) {
+ if (is_array($field)) {
//convert to string
$field = implode($field, CRM_Core_DAO::VALUE_SEPARATOR) . CRM_Core_DAO::VALUE_SEPARATOR;
}
$this->header = $header;
while (($data = fgetcsv($handle, 0, $this->separator)) !== FALSE) {
// skip blank lines
- if(count($data) == 1 && is_null($data[0])) { continue;
+ if (count($data) == 1 && is_null($data[0])) {
+ continue;
}
$this->row++;
$params = $this->convertLine($data);
$result = civicrm_api($this->_entity, 'Delete', $params);
if ($result['is_error']) {
echo "\nERROR line " . $this->row . ": " . $result['error_message'] . "\n";
- } else {
+ }
+ else {
echo "\nline " . $this->row . ": deleted\n";
}
}