From f51ad2fe0ef2d858d9d901e15c94a9e348b3e4ef Mon Sep 17 00:00:00 2001 From: Abhishek Kumar Date: Tue, 26 Sep 2023 15:08:34 +0530 Subject: [PATCH] Comment delivery related order state options --- .../controllers/orders/_documents.tpl | 134 +++++++----------- classes/order/Order.php | 20 +-- controllers/admin/AdminStatusesController.php | 66 ++++----- 3 files changed, 96 insertions(+), 124 deletions(-) diff --git a/admin/themes/default/template/controllers/orders/_documents.tpl b/admin/themes/default/template/controllers/orders/_documents.tpl index 8b1436d34..022df0499 100644 --- a/admin/themes/default/template/controllers/orders/_documents.tpl +++ b/admin/themes/default/template/controllers/orders/_documents.tpl @@ -43,97 +43,70 @@ {foreach from=$order->getDocuments() item=document} - {if get_class($document) eq 'OrderInvoice'} - {if isset($document->is_delivery)} - - {else} - {/if} {elseif get_class($document) eq 'OrderSlip'} {/if} - - {dateFormat date=$document->date_add} - - {if get_class($document) eq 'OrderInvoice'} - {if isset($document->is_delivery)} - {l s='Delivery slip'} - {else} - {l s='Invoice'} - {/if} - {elseif get_class($document) eq 'OrderSlip'} - {l s='Credit Slip'} - {/if} - - - {if get_class($document) eq 'OrderInvoice'} - {if isset($document->is_delivery)} - - {else} - - {/if} - {elseif get_class($document) eq 'OrderSlip'} - - {/if} - {if get_class($document) eq 'OrderInvoice'} - {if isset($document->is_delivery)} - {Configuration::get('PS_DELIVERY_PREFIX', $current_id_lang, null, $order->id_shop)}{'%06d'|sprintf:$document->delivery_number} - {else} - {$document->getInvoiceNumberFormatted($current_id_lang, $order->id_shop)} - {/if} - {elseif get_class($document) eq 'OrderSlip'} - {Configuration::get('PS_CREDIT_SLIP_PREFIX', $current_id_lang)}{'%06d'|sprintf:$document->id} - {/if} - - - + {dateFormat date=$document->date_add} + {if get_class($document) eq 'OrderInvoice'} - {if isset($document->is_delivery)} - -- - {else} - {displayPrice price=$document->total_paid_tax_incl currency=$currency->id}  - {if $document->getTotalPaid()} - - {if $document->getRestPaid() > 0} - ({displayPrice price=$document->getRestPaid() currency=$currency->id} {l s='not paid'}) - {elseif $document->getRestPaid() < 0} - ({displayPrice price=-$document->getRestPaid() currency=$currency->id} {l s='overpaid'}) - {/if} - - {/if} - {/if} + {l s='Invoice'} {elseif get_class($document) eq 'OrderSlip'} - {displayPrice price=$document->total_products_tax_incl+$document->total_shipping_tax_incl currency=$currency->id} + {l s='Credit Slip'} {/if} - - + + {if get_class($document) eq 'OrderInvoice'} - {if !isset($document->is_delivery)} - - {if $document->getRestPaid()} - - - {l s='Enter payment'} - - {/if} - - - {if $document->note eq ''} - - {l s='Add note'} - {else} - - {l s='Edit note'} - {/if} - - - {/if} + + {elseif get_class($document) eq 'OrderSlip'} + {/if} - - + {if get_class($document) eq 'OrderInvoice'} + {$document->getInvoiceNumberFormatted($current_id_lang, $order->id_shop)} + {elseif get_class($document) eq 'OrderSlip'} + {Configuration::get('PS_CREDIT_SLIP_PREFIX', $current_id_lang)}{'%06d'|sprintf:$document->id} + {/if} + + + + {if get_class($document) eq 'OrderInvoice'} + {displayPrice price=$document->total_paid_tax_incl currency=$currency->id}  + {if $document->getTotalPaid()} + + {if $document->getRestPaid() > 0} + ({displayPrice price=$document->getRestPaid() currency=$currency->id} {l s='not paid'}) + {elseif $document->getRestPaid() < 0} + ({displayPrice price=-$document->getRestPaid() currency=$currency->id} {l s='overpaid'}) + {/if} + + {/if} + {elseif get_class($document) eq 'OrderSlip'} + {displayPrice price=$document->total_products_tax_incl+$document->total_shipping_tax_incl currency=$currency->id} + {/if} + + + {if get_class($document) eq 'OrderInvoice'} + {if $document->getRestPaid()} + + + {l s='Enter payment'} + + {/if} + + + {if $document->note eq ''} + + {l s='Add note'} + {else} + + {l s='Edit note'} + {/if} + + {/if} + + {if get_class($document) eq 'OrderInvoice'} - {if !isset($document->is_delivery)}
@@ -155,7 +128,6 @@
- {/if} {/if} {foreachelse} diff --git a/classes/order/Order.php b/classes/order/Order.php index 79ba75e60..be4e7d223 100644 --- a/classes/order/Order.php +++ b/classes/order/Order.php @@ -1891,18 +1891,18 @@ class OrderCore extends ObjectModel unset($invoices[$key]); } } - $delivery_slips = $this->getDeliverySlipsCollection()->getResults(); - // @TODO review - foreach ($delivery_slips as $key => $delivery) { - $delivery->is_delivery = true; - $delivery->date_add = $delivery->delivery_date; - if (!$invoice->delivery_number) { - unset($delivery_slips[$key]); - } - } + // $delivery_slips = $this->getDeliverySlipsCollection()->getResults(); + // // @TODO review + // foreach ($delivery_slips as $key => $delivery) { + // $delivery->is_delivery = true; + // $delivery->date_add = $delivery->delivery_date; + // if (!$invoice->delivery_number) { + // unset($delivery_slips[$key]); + // } + // } $order_slips = $this->getOrderSlipsCollection()->getResults(); - $documents = array_merge($invoices, $order_slips, $delivery_slips); + $documents = array_merge($invoices, $order_slips); usort($documents, array('Order', 'sortDocuments')); return $documents; diff --git a/controllers/admin/AdminStatusesController.php b/controllers/admin/AdminStatusesController.php index 7a0b22572..1e841356a 100644 --- a/controllers/admin/AdminStatusesController.php +++ b/controllers/admin/AdminStatusesController.php @@ -402,28 +402,28 @@ class AdminStatusesControllerCore extends AdminController 'name' => 'name' ), ), - array( - 'type' => 'checkbox', - 'name' => 'pdf_delivery', - 'values' => array( - 'query' => array( - array('id' => 'on', 'name' => $this->l('Attach delivery slip PDF to email.'), 'val' => '1'), - ), - 'id' => 'id', - 'name' => 'name' - ), - ), - array( - 'type' => 'checkbox', - 'name' => 'shipped', - 'values' => array( - 'query' => array( - array('id' => 'on', 'name' => $this->l('Set the order as shipped.'), 'val' => '1'), - ), - 'id' => 'id', - 'name' => 'name' - ) - ), + // array( + // 'type' => 'checkbox', + // 'name' => 'pdf_delivery', + // 'values' => array( + // 'query' => array( + // array('id' => 'on', 'name' => $this->l('Attach delivery slip PDF to email.'), 'val' => '1'), + // ), + // 'id' => 'id', + // 'name' => 'name' + // ), + // ), + // array( + // 'type' => 'checkbox', + // 'name' => 'shipped', + // 'values' => array( + // 'query' => array( + // array('id' => 'on', 'name' => $this->l('Set the order as shipped.'), 'val' => '1'), + // ), + // 'id' => 'id', + // 'name' => 'name' + // ) + // ), array( 'type' => 'checkbox', 'name' => 'paid', @@ -435,17 +435,17 @@ class AdminStatusesControllerCore extends AdminController 'name' => 'name' ) ), - array( - 'type' => 'checkbox', - 'name' => 'delivery', - 'values' => array( - 'query' => array( - array('id' => 'on', 'name' => $this->l('Show delivery PDF.'), 'val' => '1'), - ), - 'id' => 'id', - 'name' => 'name' - ) - ), + // array( + // 'type' => 'checkbox', + // 'name' => 'delivery', + // 'values' => array( + // 'query' => array( + // array('id' => 'on', 'name' => $this->l('Show delivery PDF.'), 'val' => '1'), + // ), + // 'id' => 'id', + // 'name' => 'name' + // ) + // ), array( 'type' => 'select_template', 'is_customer_template' => 1,