10-12-2016, 07:40 PM
I'd like to suggest a different way of handling inventorylines in the Smarty template (did not post this in the PackingSlip thread because I think it should be more generic):
In "Smarty/templates/Inventory" we have "InventoryEditView.tpl" and "InventoryCreateView.tpl" (and I think also detailview) we have this line:
That limits the use of inventorylines to only these modules, but why? First of all, this is a special Inventory template, why would it even ask if it should show inventorylines? That's its job, right? And if we still want to impose an 'if' statement here, why not make it more general. Make every module that has inventory capabilities set a smarty variable called 'HAS_INVENTORY' (or something like that) in its EditView.php file and then use that in the 'if' statement. Right now, when creating the packingslip module I'm struggling because the only way to create packingslips using the system templates is to include my modulename in the file, which I don't want to do (shouldn't change core files for module development).
So, I'd be happy to create a PR for this if there are no objections.
In "Smarty/templates/Inventory" we have "InventoryEditView.tpl" and "InventoryCreateView.tpl" (and I think also detailview) we have this line:
PHP Code:
{if $MODULE eq 'PurchaseOrder' || $MODULE eq 'SalesOrder' || $MODULE eq 'Quotes' || $MODULE eq 'Invoice'}
That limits the use of inventorylines to only these modules, but why? First of all, this is a special Inventory template, why would it even ask if it should show inventorylines? That's its job, right? And if we still want to impose an 'if' statement here, why not make it more general. Make every module that has inventory capabilities set a smarty variable called 'HAS_INVENTORY' (or something like that) in its EditView.php file and then use that in the 'if' statement. Right now, when creating the packingslip module I'm struggling because the only way to create packingslips using the system templates is to include my modulename in the file, which I don't want to do (shouldn't change core files for module development).
So, I'd be happy to create a PR for this if there are no objections.