Commit 3f032d79 authored by Malcolm Blaney's avatar Malcolm Blaney

Invoice module switch to ksort and put category first in packing list.

parent c4841066
Pipeline #37488201 passed with stage
in 1 minute and 11 seconds
......@@ -1585,7 +1585,7 @@ class Invoice extends Base {
// Create a table for each user in packing mode.
if ($message !== '') {
if ($sort_by_category) {
sort($message_data);
ksort($message_data);
$message .= join($message_data);
$message_data = [];
}
......@@ -1596,7 +1596,7 @@ class Invoice extends Base {
$message .= "<table>\n" . '<tr><th colspan="3">' .
'<b>' . $user . '</b> - packed: ' . date('j-F-Y', $packed) .
'</th><th colspan="2">Entered? &#9633;</th></tr>' . "\n" .
'<tr><th>Product</th><th>Category</th><th>Quantity</th>' .
'<tr><th>Category</th><th>Product</th><th>Quantity</th>' .
'<th>Weighed</th><th>Collect</th></tr>' . "\n";
}
else {
......@@ -1636,8 +1636,8 @@ class Invoice extends Base {
$category = isset($products[$name]['category']) ?
$products[$name]['category'] : '';
if (!isset($message_data[$category])) $message_data[$category] = '';
$message_data[$category] .= '<tr><td>' . $name . '</td><td>' .
$category . '</td><td>' . $quantity . $unit .
$message_data[$category] .= '<tr><td>' . $category . '</td><td>' .
$name . '</td><td>' . $quantity . $unit .
"</td><td></td><td></td></tr>\n";
}
else {
......@@ -1660,12 +1660,12 @@ class Invoice extends Base {
}
if ($format === 'product') {
sort($message_data);
ksort($message_data);
$message .= join($message_data);
}
else if ($format === 'packing' && $sort_by_category) {
// Sort and add the data for the last member.
sort($message_data);
ksort($message_data);
$message .= join($message_data);
}
$message .= '</table>' . "\n";
......@@ -1918,7 +1918,7 @@ class Invoice extends Base {
$rows[$name] = '"' . $name . '",' . $quantity . ',' . $size . ',' .
$packs . ',' . $details['price'] . $extra_column . "\n";
}
sort($rows);
ksort($rows);
$content = $title . join($rows);
}
if ($timestamp === 0) $timestamp = time();
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment