Hi, Jerome.
I really don't want to imagine the whole bunch of topics you go through every day. So I will do my best to be clear enough.
After implementin the two patches and testing:
1. Extra Invoice issue - still not fixed by the patch
2. Wrong Invoice number - FIXED (by the last code change)
About the extra Invoice number patch what I did: I replaced the code bellow in Admin/HM/order.php
Jerome wrote: You have to modify HikaShop to not generate the invoice id when it already have an invoice number.
Replacing
if(!empty($order->order_status) && empty($order->order_invoice_id) && empty($order->old->order_invoice_id) && $order_type == 'sale') {
By$already_invoice_number = ((!empty($order->order_invoice_number) && !empty($order->order_invoice_created)) || (!empty($order->old->order_invoice_number) && !empty($order->old->order_invoice_created)));
if(!empty($order->order_status) && empty($order->order_invoice_id) && empty($order->old->order_invoice_id) && $order_type == 'sale' && !$already_invoice_number) {
Then, you can see to copy the "order_invoice_number" and "order_invoice_created" from the HikaMarket subsale into the HikaShop sale (I don't have yet the code for HikaMarket ; I'll need more time for that).
Only in that case, you can stop HikaShop to generate invoice number for all "sales".
Test Result: Generating of
invoice for suborder in HM
still leads to generating of Invoice Number in HS.
HM Configuration:
- One Vendor
- Vendor paid directly
The process:
1.
Customer buys directly from Vendor (he receives money, not we)
2.
Order in HS
and suborder in HM are generated
3. Changing the
suborder status in HM to "
shipped" leads to:
- Generating
suborder Invoice in HM -
That's OK
- Generating of
main order Invoice -
That is Not OK (as we don't sell here)
I hope it is well structured this time.
Regards!