Archive and unarchive contacts
This commit is contained in:
parent
370cf6bd91
commit
ca41e9154d
|
@ -1165,6 +1165,10 @@ function item_set_last_item($arr) {
|
||||||
if ($update) {
|
if ($update) {
|
||||||
dba::update('contact', array('success_update' => $arr['received'], 'last-item' => $arr['received']),
|
dba::update('contact', array('success_update' => $arr['received'], 'last-item' => $arr['received']),
|
||||||
array('id' => $arr['contact-id']));
|
array('id' => $arr['contact-id']));
|
||||||
|
$contact = dba::select('contact', [], ['id' => $arr['contact-id']], ['limit' => 1]);
|
||||||
|
if ($contact['term-date'] > NULL_DATE) {
|
||||||
|
Contact::unmarkForArchival($contact);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
// Now do the same for the system wide contacts with uid=0
|
// Now do the same for the system wide contacts with uid=0
|
||||||
if (!$arr['private']) {
|
if (!$arr['private']) {
|
||||||
|
|
|
@ -99,7 +99,7 @@ class Contact extends BaseObject
|
||||||
if ($contact['archive']) {
|
if ($contact['archive']) {
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
logger('Blubb-m: '.$contact['id'].' - '.System::callstack());
|
||||||
if ($contact['term-date'] <= NULL_DATE) {
|
if ($contact['term-date'] <= NULL_DATE) {
|
||||||
dba::update('contact', array('term-date' => datetime_convert()), array('id' => $contact['id']));
|
dba::update('contact', array('term-date' => datetime_convert()), array('id' => $contact['id']));
|
||||||
|
|
||||||
|
@ -139,6 +139,7 @@ class Contact extends BaseObject
|
||||||
*/
|
*/
|
||||||
public static function unmarkForArchival(array $contact)
|
public static function unmarkForArchival(array $contact)
|
||||||
{
|
{
|
||||||
|
//logger('Blubb-m: '.$contact['id'].' - '.System::callstack());
|
||||||
$condition = array('`id` = ? AND (`term-date` > ? OR `archive`)', $contact[`id`], NULL_DATE);
|
$condition = array('`id` = ? AND (`term-date` > ? OR `archive`)', $contact[`id`], NULL_DATE);
|
||||||
$exists = dba::exists('contact', $condition);
|
$exists = dba::exists('contact', $condition);
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue
Block a user