mirror of
https://github.com/invoiceninja/invoiceninja.git
synced 2025-06-23 20:00:33 -04:00
Fixes for custom quote columns
This commit is contained in:
parent
851f81e1d6
commit
b47253ba45
@ -39,7 +39,11 @@ class TriggeredActions extends AbstractService
|
|||||||
public function run()
|
public function run()
|
||||||
{
|
{
|
||||||
if ($this->request->has('auto_bill') && $this->request->input('auto_bill') == 'true') {
|
if ($this->request->has('auto_bill') && $this->request->input('auto_bill') == 'true') {
|
||||||
$this->invoice->service()->autoBill(); //update notification sends automatically for this.
|
try {
|
||||||
|
$this->invoice->service()->autoBill();
|
||||||
|
} catch(\Exception $e) {
|
||||||
|
|
||||||
|
} //update notification sends automatically for this.
|
||||||
}
|
}
|
||||||
|
|
||||||
if ($this->request->has('paid') && $this->request->input('paid') == 'true') {
|
if ($this->request->has('paid') && $this->request->input('paid') == 'true') {
|
||||||
|
@ -743,8 +743,6 @@ class Design extends BaseDesign
|
|||||||
*/
|
*/
|
||||||
public function buildTableHeader(string $type): array
|
public function buildTableHeader(string $type): array
|
||||||
{
|
{
|
||||||
$this->processTaxColumns($type);
|
|
||||||
// $this->processCustomColumns($type);
|
|
||||||
|
|
||||||
$elements = [];
|
$elements = [];
|
||||||
|
|
||||||
@ -757,10 +755,16 @@ class Design extends BaseDesign
|
|||||||
|
|
||||||
$table_type = "{$type}_columns";
|
$table_type = "{$type}_columns";
|
||||||
|
|
||||||
|
$column_type = $type;
|
||||||
|
|
||||||
if ($type == 'product' && $this->entity instanceof Quote && !$this->settings_object->getSetting('sync_invoice_quote_columns')) {
|
if ($type == 'product' && $this->entity instanceof Quote && !$this->settings_object->getSetting('sync_invoice_quote_columns')) {
|
||||||
$table_type = "product_quote_columns";
|
$table_type = "product_quote_columns";
|
||||||
|
$column_type = 'product_quote';
|
||||||
}
|
}
|
||||||
|
|
||||||
|
$this->processTaxColumns($column_type);
|
||||||
|
|
||||||
|
|
||||||
foreach ($this->context['pdf_variables'][$table_type] as $column) {
|
foreach ($this->context['pdf_variables'][$table_type] as $column) {
|
||||||
if (array_key_exists($column, $aliases)) {
|
if (array_key_exists($column, $aliases)) {
|
||||||
$elements[] = ['element' => 'th', 'content' => $aliases[$column] . '_label', 'properties' => ['data-ref' => "{$type}_table-" . substr($aliases[$column], 1) . '-th', 'hidden' => $this->settings_object->getSetting('hide_empty_columns_on_pdf')]];
|
$elements[] = ['element' => 'th', 'content' => $aliases[$column] . '_label', 'properties' => ['data-ref' => "{$type}_table-" . substr($aliases[$column], 1) . '-th', 'hidden' => $this->settings_object->getSetting('hide_empty_columns_on_pdf')]];
|
||||||
|
@ -150,8 +150,11 @@ trait DesignHelpers
|
|||||||
*/
|
*/
|
||||||
public function processTaxColumns(string $type): void
|
public function processTaxColumns(string $type): void
|
||||||
{
|
{
|
||||||
if ($type == 'product') {
|
$column_type = $type;
|
||||||
|
if ($type == 'product' || $type == 'product_quote') {
|
||||||
$type_id = 1;
|
$type_id = 1;
|
||||||
|
$column_type = 'product_quote';
|
||||||
|
$type = 'product';
|
||||||
}
|
}
|
||||||
|
|
||||||
if ($type == 'task') {
|
if ($type == 'task') {
|
||||||
@ -163,7 +166,7 @@ trait DesignHelpers
|
|||||||
// This sprintf() will help us convert "task" or "product" into "$task" or "$product" without
|
// This sprintf() will help us convert "task" or "product" into "$task" or "$product" without
|
||||||
// evaluating the variable.
|
// evaluating the variable.
|
||||||
|
|
||||||
if (in_array(sprintf('%s%s.tax', '$', $type), (array) $this->context['pdf_variables']["{$type}_columns"])) {
|
if (in_array(sprintf('%s%s.tax', '$', $type), (array) $this->context['pdf_variables']["{$column_type}_columns"])) {
|
||||||
$line_items = collect($this->entity->line_items)->filter(function ($item) use ($type_id) {
|
$line_items = collect($this->entity->line_items)->filter(function ($item) use ($type_id) {
|
||||||
return $item->type_id = $type_id;
|
return $item->type_id = $type_id;
|
||||||
});
|
});
|
||||||
@ -186,10 +189,10 @@ trait DesignHelpers
|
|||||||
array_push($taxes, sprintf('%s%s.tax_rate3', '$', $type));
|
array_push($taxes, sprintf('%s%s.tax_rate3', '$', $type));
|
||||||
}
|
}
|
||||||
|
|
||||||
$key = array_search(sprintf('%s%s.tax', '$', $type), $this->context['pdf_variables']["{$type}_columns"], true);
|
$key = array_search(sprintf('%s%s.tax', '$', $type), $this->context['pdf_variables']["{$column_type}_columns"], true);
|
||||||
|
|
||||||
if ($key !== false) {
|
if ($key !== false) {
|
||||||
array_splice($this->context['pdf_variables']["{$type}_columns"], $key, 1, $taxes);
|
array_splice($this->context['pdf_variables']["{$column_type}_columns"], $key, 1, $taxes);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
Loading…
x
Reference in New Issue
Block a user