Skip to content

Commit f597b7a

Browse files
authored
Force invoices to be after other records
Force invoices to go after other records. Since the IDs don't correlate (different sources) they needed to be forced after the order was made.
1 parent 1875102 commit f597b7a

File tree

1 file changed

+5
-1
lines changed
  • app/code/Magento/Sales/Block/Adminhtml/Order/View/Tab

1 file changed

+5
-1
lines changed

app/code/Magento/Sales/Block/Adminhtml/Order/View/Tab/History.php

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -127,7 +127,8 @@ public function getFullHistory()
127127
$_invoice->getId(),
128128
__('Invoice #%1 created', $_invoice->getIncrementId()),
129129
$_invoice->getEmailSent(),
130-
$this->getOrderAdminDate($_invoice->getCreatedAt())
130+
$this->getOrderAdminDate($_invoice->getCreatedAt()),
131+
'Invoice created'
131132
);
132133

133134
foreach ($_invoice->getCommentsCollection() as $_comment) {
@@ -313,6 +314,9 @@ public static function sortHistoryByTimestamp($a, $b)
313314
$createdAtB = $b['created_at'];
314315

315316
if( $createdAtA->getTimestamp() === $createdAtB->getTimestamp() ) {
317+
if( $a['comment'] == 'Invoice created' || $b['comment'] == 'Invoice created' ) {
318+
return ( $a['comment'] == 'Invoice created' ? 1 : -1 );
319+
}
316320
return $a['entity_id'] <=> $b['entity_id'];
317321
}
318322

0 commit comments

Comments
 (0)