fix new events were created with cal_etag=NULL, which would then also never incremented on update

(because cal_etag=cal_etag+1 for NULL stays NULL). The later is fixed now by using cal_etag=COALESCE(cal_etag,0)+1.
This commit is contained in:
Ralf Becker 2017-09-21 14:02:13 +02:00
parent 9879e02766
commit c4f048bbae

View File

@ -1419,7 +1419,7 @@ ORDER BY cal_user_type, cal_usre_id
if (!is_null($etag)) $where['cal_etag'] = $etag; if (!is_null($etag)) $where['cal_etag'] = $etag;
unset($event['cal_etag']); unset($event['cal_etag']);
$event[] = 'cal_etag=cal_etag+1'; // always update the etag, even if none given to check $event[] = 'cal_etag=COALESCE(cal_etag,0)+1'; // always update the etag, even if none given to check
$this->db->update($this->cal_table,$event,$where,__LINE__,__FILE__,'calendar'); $this->db->update($this->cal_table,$event,$where,__LINE__,__FILE__,'calendar');
@ -1436,12 +1436,12 @@ ORDER BY cal_user_type, cal_usre_id
if (!$event['cal_id'] && !isset($event['cal_uid'])) $event['cal_uid'] = ''; // uid is NOT NULL! if (!$event['cal_id'] && !isset($event['cal_uid'])) $event['cal_uid'] = ''; // uid is NOT NULL!
$event['cal_etag'] = $etag = 0;
$this->db->insert($this->cal_table,$event,false,__LINE__,__FILE__,'calendar'); $this->db->insert($this->cal_table,$event,false,__LINE__,__FILE__,'calendar');
if (!($cal_id = $this->db->get_last_insert_id($this->cal_table,'cal_id'))) if (!($cal_id = $this->db->get_last_insert_id($this->cal_table,'cal_id')))
{ {
return false; return false;
} }
$etag = 0;
} }
$update = array(); $update = array();
// event without uid or not strong enough uid // event without uid or not strong enough uid