Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Sort invoice items #762

Merged
merged 7 commits into from
Oct 14, 2023
Merged

Sort invoice items #762

merged 7 commits into from
Oct 14, 2023

Conversation

o-psi
Copy link
Contributor

@o-psi o-psi commented Oct 14, 2023

This PR adds the ability to order invoice items.

I know we wanted to do draggable, but I need to practice JS more for that.

@wrongecho
Copy link
Collaborator

Test these changes at: https://Invoiceitemsorder762.pr-review.itflow.org
(automatic message)

$item_order_id = 1;
foreach ($sql_invoice_items as $row) {
$item_id = $row['item_id'];
mysqli_query($mysqli, "UPDATE invoice_items SET item_order_id = '$item_order_id' WHERE item_id = '$item_id'");
Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Update each invoice item and give it a, item order id

@o-psi o-psi changed the title Order invoice items Sort invoice items Oct 14, 2023
@johnnyq
Copy link
Collaborator

johnnyq commented Oct 14, 2023

Nice work, you dont slow down hahhaa but can we rename item_order_id to just item_order we use id to reference items in multi tables and it would cause a little bit of confusion

@johnnyq johnnyq self-requested a review October 14, 2023 03:14
@o-psi
Copy link
Contributor Author

o-psi commented Oct 14, 2023

@johnnyq Done :)

@sonarqubecloud
Copy link

Kudos, SonarCloud Quality Gate passed!    Quality Gate passed

Bug A 0 Bugs
Vulnerability A 0 Vulnerabilities
Security Hotspot A 0 Security Hotspots
Code Smell A 2 Code Smells

No Coverage information No Coverage information
0.0% 0.0% Duplication

@johnnyq johnnyq merged commit 766df19 into itflow-org:master Oct 14, 2023
3 checks passed
@johnnyq
Copy link
Collaborator

johnnyq commented Oct 14, 2023

So far so good on the item order I pulled it in it looks fantastic but needs some more functionality love
Item order should not be greater than the amount of items in an invoice as I can keep clicking the up and down arrows as many times to increment the order.

Some Logic to add

  • If order is 0 do not show Up Arrow as this would be the first item
  • If order is the last order do not show down arrow.

Of course once this is super stable we should replicate this everywhere recurring invoices, quotes, quote to invoice, cron generated invoices from recurring etc.

Great job!

@o-psi o-psi deleted the Invoice-items-order branch October 15, 2023 17:49
@o-psi
Copy link
Contributor Author

o-psi commented Oct 16, 2023

@johnnyq See #768

I believe this fixes your stability concern as it reduces complexity substantially, and additionally removes the arrows as suggested.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants