Merge pull request #6058 from JonnyTischbein/issue_contact_batch_archive

[frio] Fix unarchive contact batch action
This commit is contained in:
Tobias Diekershoff 2018-11-01 06:41:05 +01:00 committed by GitHub
commit e12942ce7f
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23

View file

@ -138,7 +138,7 @@ class Contact extends BaseModule
$contacts_id = $_POST['contact_batch']; $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); $orig_records = DBA::toArray($stmt);
$count_actions = 0; $count_actions = 0;
@ -336,7 +336,7 @@ class Contact extends BaseModule
private static function archiveContact($contact_id, $orig_record) 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()]); $r = DBA::update('contact', ['archive' => $archived], ['id' => $contact_id, 'uid' => local_user()]);
return DBA::isResult($r); return DBA::isResult($r);