$contacts_id = $_POST['contact_batch'];
- $stmt = DBA::select('contact', ['id'], ['id' => $contacts_id, 'uid' => local_user(), 'self' => false]);
+ $stmt = DBA::select('contact', ['id', 'archive'], ['id' => $contacts_id, 'uid' => local_user(), 'self' => false]);
$orig_records = DBA::toArray($stmt);
$count_actions = 0;
private static function archiveContact($contact_id, $orig_record)
{
- $archived = (($orig_record['archive']) ? 0 : 1);
+ $archived = (defaults($orig_record, 'archive', '') ? 0 : 1);
$r = DBA::update('contact', ['archive' => $archived], ['id' => $contact_id, 'uid' => local_user()]);
return DBA::isResult($r);