Merge pull request #769 from abhishek-webkul/gli-1063

Removed: Delivery related fields from Orders > Statuses list page and new Order State form
This commit is contained in:
Rohit Jain
2024-01-25 16:52:23 +05:30
committed by GitHub
4 changed files with 98 additions and 136 deletions

View File

@@ -43,97 +43,70 @@
</thead>
<tbody>
{foreach from=$order->getDocuments() item=document}
{if get_class($document) eq 'OrderInvoice'}
{if isset($document->is_delivery)}
<tr id="delivery_{$document->id}">
{else}
<tr id="invoice_{$document->id}">
{/if}
{elseif get_class($document) eq 'OrderSlip'}
<tr id="orderslip_{$document->id}">
{/if}
<td>{dateFormat date=$document->date_add}</td>
<td>
{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}
</td>
<td>
{if get_class($document) eq 'OrderInvoice'}
{if isset($document->is_delivery)}
<a class="_blank" title="{l s='See the document'}" href="{$link->getAdminLink('AdminPdf')|escape:'html':'UTF-8'}&amp;submitAction=generateDeliverySlipPDF&amp;id_order_invoice={$document->id}">
{else}
<a class="_blank" title="{l s='See the document'}" href="{$link->getAdminLink('AdminPdf')|escape:'html':'UTF-8'}&amp;submitAction=generateInvoicePDF&amp;id_order_invoice={$document->id}">
{/if}
{elseif get_class($document) eq 'OrderSlip'}
<a class="_blank" title="{l s='See the document'}" href="{$link->getAdminLink('AdminPdf')|escape:'html':'UTF-8'}&amp;submitAction=generateOrderSlipPDF&amp;id_order_slip={$document->id}">
{/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}
</a>
</td>
<td>
<td>{dateFormat date=$document->date_add}</td>
<td>
{if get_class($document) eq 'OrderInvoice'}
{if isset($document->is_delivery)}
--
{else}
{displayPrice price=$document->total_paid_tax_incl currency=$currency->id}&nbsp;
{if $document->getTotalPaid()}
<span>
{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}
</span>
{/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}
</td>
<td class="text-right document_action">
</td>
<td>
{if get_class($document) eq 'OrderInvoice'}
{if !isset($document->is_delivery)}
{if $document->getRestPaid()}
<a href="#form_add_payment_panel" class="js-set-payment btn btn-default anchor" data-amount="{$document->getRestPaid()}" data-id-invoice="{$document->id}" title="{l s='Set payment form'}">
<i class="icon-money"></i>
{l s='Enter payment'}
</a>
{/if}
<a href="#" class="btn btn-default" onclick="$('#invoiceNote{$document->id}').show(); return false;" title="{if $document->note eq ''}{l s='Add note'}{else}{l s='Edit note'}{/if}">
{if $document->note eq ''}
<i class="icon-plus-sign-alt"></i>
{l s='Add note'}
{else}
<i class="icon-pencil"></i>
{l s='Edit note'}
{/if}
</a>
{/if}
<a class="_blank" title="{l s='See the document'}" href="{$link->getAdminLink('AdminPdf')|escape:'html':'UTF-8'}&amp;submitAction=generateInvoicePDF&amp;id_order_invoice={$document->id}">
{elseif get_class($document) eq 'OrderSlip'}
<a class="_blank" title="{l s='See the document'}" href="{$link->getAdminLink('AdminPdf')|escape:'html':'UTF-8'}&amp;submitAction=generateOrderSlipPDF&amp;id_order_slip={$document->id}">
{/if}
</td>
</tr>
{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}
</a>
</td>
<td>
{if get_class($document) eq 'OrderInvoice'}
{displayPrice price=$document->total_paid_tax_incl currency=$currency->id}&nbsp;
{if $document->getTotalPaid()}
<span>
{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}
</span>
{/if}
{elseif get_class($document) eq 'OrderSlip'}
{displayPrice price=$document->total_products_tax_incl+$document->total_shipping_tax_incl currency=$currency->id}
{/if}
</td>
<td class="text-right document_action">
{if get_class($document) eq 'OrderInvoice'}
{if $document->getRestPaid()}
<a href="#form_add_payment_panel" class="js-set-payment btn btn-default anchor" data-amount="{$document->getRestPaid()}" data-id-invoice="{$document->id}" title="{l s='Set payment form'}">
<i class="icon-money"></i>
{l s='Enter payment'}
</a>
{/if}
<a href="#" class="btn btn-default" onclick="$('#invoiceNote{$document->id}').show(); return false;" title="{if $document->note eq ''}{l s='Add note'}{else}{l s='Edit note'}{/if}">
{if $document->note eq ''}
<i class="icon-plus-sign-alt"></i>
{l s='Add note'}
{else}
<i class="icon-pencil"></i>
{l s='Edit note'}
{/if}
</a>
{/if}
</td>
</tr>
{if get_class($document) eq 'OrderInvoice'}
{if !isset($document->is_delivery)}
<tr id="invoiceNote{$document->id}" style="display:none">
<td colspan="5">
<form action="{$current_index}&amp;viewOrder&amp;id_order={$order->id}{if isset($smarty.get.token)}&amp;token={$smarty.get.token|escape:'html':'UTF-8'}{/if}" method="post">
@@ -155,7 +128,6 @@
</form>
</td>
</tr>
{/if}
{/if}
{foreachelse}
<tr>

View File

@@ -32,10 +32,10 @@
</a>
{/if}
{* Generate HTML code for printing Delivery Icon with link *}
{if $order->delivery_number}
{* {if $order->delivery_number}
<a class="btn btn-default _blank" href="{$link->getAdminLink('AdminPdf')|escape:'html':'UTF-8'}&amp;submitAction=generateDeliverySlipPDF&amp;id_order={$order->id}">
<i class="icon-truck"></i>
</a>
{/if}
{/if} *}
</span>
</span>

View File

@@ -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;

View File

@@ -99,16 +99,6 @@ class AdminStatusesControllerCore extends AdminController
'orderby' => false,
'class' => 'fixed-width-sm'
),
'delivery' => array(
'title' => $this->l('Delivery'),
'align' => 'text-center',
'active' => 'delivery',
'type' => 'bool',
'ajax' => true,
'orderby' => false,
'class' => 'fixed-width-sm'
)
,
'invoice' => array(
'title' => $this->l('Invoice'),
'align' => 'text-center',
@@ -412,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',
@@ -445,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,