From 0a015567aeda67dc6469f8f0ac97bd8454f067e1 Mon Sep 17 00:00:00 2001 From: following Date: Sun, 20 Mar 2016 05:27:10 +0100 Subject: [PATCH] changed pictures.seq initialization --- htdocs/doc/sql/stored-proc/maintain-current.inc.php | 4 +++- htdocs/lib2/logic/picture.class.php | 2 +- 2 files changed, 4 insertions(+), 2 deletions(-) diff --git a/htdocs/doc/sql/stored-proc/maintain-current.inc.php b/htdocs/doc/sql/stored-proc/maintain-current.inc.php index 2958353c1..628364e8f 100644 --- a/htdocs/doc/sql/stored-proc/maintain-current.inc.php +++ b/htdocs/doc/sql/stored-proc/maintain-current.inc.php @@ -1503,7 +1503,9 @@ IF ISNULL(@XMLSYNC) OR @XMLSYNC!=1 THEN SET NEW.`date_created`=NOW(); SET NEW.`last_modified`=NOW(); - SET NEW.`seq`= IFNULL((SELECT MAX(`seq`)+1 FROM `pictures` WHERE `object_type`=NEW.`object_type` AND `object_id`=NEW.`object_id`), 1); + IF NEW.`seq` = 0 THEN + SET NEW.`seq` = IFNULL((SELECT MAX(`seq`)+1 FROM `pictures` WHERE `object_type`=NEW.`object_type` AND `object_id`=NEW.`object_id`), 1); + END IF; END IF; IF ISNULL(NEW.`uuid`) OR NEW.`uuid`='' THEN diff --git a/htdocs/lib2/logic/picture.class.php b/htdocs/lib2/logic/picture.class.php index 33f3e3109..5cad90e78 100644 --- a/htdocs/lib2/logic/picture.class.php +++ b/htdocs/lib2/logic/picture.class.php @@ -55,7 +55,7 @@ function __construct($nNewPictureId=ID_NEW) $this->rePicture->addInt('unknown_format', 0, false); $this->rePicture->addInt('display', 1, false); $this->rePicture->addInt('mappreview', 0, false); - $this->rePicture->addInt('seq', 1, false); + $this->rePicture->addInt('seq', 0, false); $this->nPictureId = $nNewPictureId+0;