New item functions are now used in the delivery process as well

This commit is contained in:
Michael 2018-06-17 21:35:33 +00:00
parent e42b934807
commit 23aa9dffa0
3 changed files with 25 additions and 28 deletions

View file

@ -59,14 +59,10 @@ class Delivery extends BaseObject
}
$parent_id = intval($item['parent']);
$itemdata = dba::p("SELECT `item`.*, `contact`.`uid` AS `cuid`,
`sign`.`signed_text`,`sign`.`signature`,`sign`.`signer`
FROM `item`
INNER JOIN `contact` ON `contact`.`id` = `item`.`contact-id`
LEFT JOIN `sign` ON `sign`.`iid` = `item`.`id`
WHERE `item`.`id` IN (?, ?) AND `visible` AND NOT `moderated`
ORDER BY `item`.`id`",
$item_id, $parent_id);
$condition = ['id' => [$item_id, $parent_id], 'visible' => true, 'moderated' => false];
$params = ['order' => ['id']];
$itemdata = Item::select([], $condition, $params);
$items = [];
while ($item = dba::fetch($itemdata)) {
if ($item['id'] == $parent_id) {
@ -79,7 +75,7 @@ class Delivery extends BaseObject
}
dba::close($itemdata);
$uid = $target_item['cuid'];
$uid = $target_item['contact-uid'];
// avoid race condition with deleting entries
if ($items[0]['deleted']) {