mirror of
https://github.com/invoiceninja/invoiceninja.git
synced 2024-11-10 21:22:58 +01:00
commit
776ba51dff
@ -1 +1 @@
|
||||
5.4.8
|
||||
5.4.9
|
@ -67,7 +67,7 @@ class InvoiceFilters extends QueryFilters
|
||||
return $this->builder;
|
||||
}
|
||||
|
||||
public function number(string $number) :Builder
|
||||
public function number(string $number = '') :Builder
|
||||
{
|
||||
return $this->builder->where('number', $number);
|
||||
}
|
||||
|
@ -101,16 +101,12 @@ class InvoiceSum
|
||||
private function calculateCustomValues()
|
||||
{
|
||||
|
||||
// $this->total_taxes += $this->valuerTax($this->invoice->custom_surcharge1, $this->invoice->custom_surcharge_tax1);
|
||||
$this->total_custom_values += $this->valuer($this->invoice->custom_surcharge1);
|
||||
|
||||
// $this->total_taxes += $this->valuerTax($this->invoice->custom_surcharge2, $this->invoice->custom_surcharge_tax2);
|
||||
$this->total_custom_values += $this->valuer($this->invoice->custom_surcharge2);
|
||||
|
||||
// $this->total_taxes += $this->valuerTax($this->invoice->custom_surcharge3, $this->invoice->custom_surcharge_tax3);
|
||||
$this->total_custom_values += $this->valuer($this->invoice->custom_surcharge3);
|
||||
|
||||
// $this->total_taxes += $this->valuerTax($this->invoice->custom_surcharge4, $this->invoice->custom_surcharge_tax4);
|
||||
$this->total_custom_values += $this->valuer($this->invoice->custom_surcharge4);
|
||||
|
||||
$this->total += $this->total_custom_values;
|
||||
@ -155,7 +151,7 @@ class InvoiceSum
|
||||
*/
|
||||
private function calculateBalance()
|
||||
{
|
||||
//$this->invoice->balance = $this->balance($this->getTotal(), $this->invoice);
|
||||
|
||||
$this->setCalculatedAttributes();
|
||||
|
||||
return $this;
|
||||
@ -174,22 +170,6 @@ class InvoiceSum
|
||||
{
|
||||
$this->total += $this->total_taxes;
|
||||
|
||||
// if (is_numeric($this->invoice->custom_value1)) {
|
||||
// $this->total += $this->invoice->custom_value1;
|
||||
// }
|
||||
|
||||
// if (is_numeric($this->invoice->custom_value2)) {
|
||||
// $this->total += $this->invoice->custom_value2;
|
||||
// }
|
||||
|
||||
// if (is_numeric($this->invoice->custom_value3)) {
|
||||
// $this->total += $this->invoice->custom_value3;
|
||||
// }
|
||||
|
||||
// if (is_numeric($this->invoice->custom_value4)) {
|
||||
// $this->total += $this->invoice->custom_value4;
|
||||
// }
|
||||
|
||||
return $this;
|
||||
}
|
||||
|
||||
|
@ -601,7 +601,18 @@ class CreditController extends BaseController
|
||||
}
|
||||
break;
|
||||
case 'email':
|
||||
// EmailCredit::dispatch($credit, $credit->company);
|
||||
|
||||
$credit->invitations->load('contact.client.country', 'credit.client.country', 'credit.company')->each(function ($invitation) use ($credit) {
|
||||
EmailEntity::dispatch($invitation, $credit->company, 'credit');
|
||||
});
|
||||
|
||||
|
||||
if (! $bulk) {
|
||||
return response()->json(['message'=>'email sent'], 200);
|
||||
}
|
||||
break;
|
||||
|
||||
case 'send_email':
|
||||
|
||||
$credit->invitations->load('contact.client.country', 'credit.client.country', 'credit.company')->each(function ($invitation) use ($credit) {
|
||||
EmailEntity::dispatch($invitation, $credit->company, 'credit');
|
||||
|
@ -745,13 +745,7 @@ class InvoiceController extends BaseController
|
||||
$this->itemResponse($invoice);
|
||||
}
|
||||
break;
|
||||
// case 'reverse':
|
||||
// $invoice = $invoice->service()->handleReversal()->deletePdf()->save();
|
||||
|
||||
// if (! $bulk) {
|
||||
// $this->itemResponse($invoice);
|
||||
// }
|
||||
// break;
|
||||
case 'email':
|
||||
//check query parameter for email_type and set the template else use calculateTemplate
|
||||
|
||||
@ -769,6 +763,24 @@ class InvoiceController extends BaseController
|
||||
}
|
||||
break;
|
||||
|
||||
case 'send_email':
|
||||
//check query parameter for email_type and set the template else use calculateTemplate
|
||||
|
||||
|
||||
if (request()->has('email_type') && property_exists($invoice->company->settings, request()->input('email_type'))) {
|
||||
$this->reminder_template = $invoice->client->getSetting(request()->input('email_type'));
|
||||
} else {
|
||||
$this->reminder_template = $invoice->calculateTemplate('invoice');
|
||||
}
|
||||
|
||||
BulkInvoiceJob::dispatch($invoice, $this->reminder_template);
|
||||
|
||||
if (! $bulk) {
|
||||
return response()->json(['message' => 'email sent'], 200);
|
||||
}
|
||||
break;
|
||||
|
||||
|
||||
default:
|
||||
return response()->json(['message' => ctrans('texts.action_unavailable', ['action' => $action])], 400);
|
||||
break;
|
||||
|
@ -367,6 +367,10 @@ class PurchaseOrderController extends BaseController
|
||||
|
||||
$purchase_order = $this->purchase_order_repository->save($request->all(), $purchase_order);
|
||||
|
||||
$purchase_order = $purchase_order->service()
|
||||
->triggeredActions($request)
|
||||
->save();
|
||||
|
||||
event(new PurchaseOrderWasUpdated($purchase_order, $purchase_order->company, Ninja::eventVars(auth()->user() ? auth()->user()->id : null)));
|
||||
|
||||
return $this->itemResponse($purchase_order);
|
||||
@ -644,6 +648,15 @@ class PurchaseOrderController extends BaseController
|
||||
}
|
||||
break;
|
||||
|
||||
case 'send_email':
|
||||
//check query parameter for email_type and set the template else use calculateTemplate
|
||||
PurchaseOrderEmail::dispatch($purchase_order, $purchase_order->company);
|
||||
|
||||
if (! $bulk) {
|
||||
return response()->json(['message' => 'email sent'], 200);
|
||||
}
|
||||
break;
|
||||
|
||||
case 'add_to_inventory':
|
||||
|
||||
$purchase_order->service()->add_to_inventory();
|
||||
|
@ -722,6 +722,13 @@ class QuoteController extends BaseController
|
||||
|
||||
return response()->json(['message'=> ctrans('texts.sent_message')], 200);
|
||||
break;
|
||||
|
||||
case 'send_email':
|
||||
$quote->service()->sendEmail();
|
||||
|
||||
return response()->json(['message'=> ctrans('texts.sent_message')], 200);
|
||||
break;
|
||||
|
||||
case 'mark_sent':
|
||||
$quote->service()->markSent()->save();
|
||||
|
||||
|
@ -42,9 +42,6 @@ class StoreExpenseRequest extends Request
|
||||
if(!empty($this->client_id))
|
||||
$rules['client_id'] = 'bail|sometimes|exists:clients,id,company_id,'.auth()->user()->company()->id;
|
||||
|
||||
if(!empty($this->purchase_order_id))
|
||||
$rules['purchase_order_id'] = 'bail|sometimes|exists:purchase_orders,id,company_id,'.auth()->user()->company()->id;
|
||||
|
||||
return $this->globalRules($rules);
|
||||
}
|
||||
|
||||
@ -62,10 +59,6 @@ class StoreExpenseRequest extends Request
|
||||
$input['currency_id'] = (string)auth()->user()->company()->settings->currency_id;
|
||||
}
|
||||
|
||||
if (array_key_exists('purchase_order_id', $input) && is_string($input['purchase_order_id'])) {
|
||||
$input['purchase_order_id'] = $this->decodePrimaryKey($input['purchase_order_id']);
|
||||
}
|
||||
|
||||
if(array_key_exists('color', $input) && is_null($input['color']))
|
||||
$input['color'] = '';
|
||||
|
||||
|
@ -28,13 +28,25 @@ class PurchaseOrderExpense
|
||||
{
|
||||
|
||||
$expense = ExpenseFactory::create($this->purchase_order->company_id, $this->purchase_order->user_id);
|
||||
$expense->amount = $this->purchase_order->amount;
|
||||
|
||||
$expense->amount = $this->purchase_order->uses_inclusive_taxes ? $this->purchase_order->amount : ($this->purchase_order->amount - $this->purchase_order->total_taxes);
|
||||
|
||||
$expense->date = now();
|
||||
$expense->vendor_id = $this->purchase_order->vendor_id;
|
||||
$expense->public_notes = $this->purchase_order->public_notes;
|
||||
$expense->purchase_order_id = $this->purchase_order->id;
|
||||
$expense->uses_inclusive_taxes = $this->purchase_order->uses_inclusive_taxes;
|
||||
$expense->calculate_tax_by_amount = true;
|
||||
|
||||
$tax_map = $this->purchase_order->calc()->getTaxMap();
|
||||
|
||||
$expense->tax_amount1 = $this->purchase_order->total_taxes;
|
||||
$expense->tax_name1 = ctrans("texts.tax");
|
||||
|
||||
$expense->save();
|
||||
|
||||
$this->purchase_order->expense_id = $expense->id;
|
||||
$this->purchase_order->save();
|
||||
|
||||
return $expense;
|
||||
|
||||
}
|
||||
|
@ -130,6 +130,9 @@ class PurchaseOrderService
|
||||
{
|
||||
$this->markSent();
|
||||
|
||||
if($this->purchase_order->expense()->exists())
|
||||
return $this;
|
||||
|
||||
$expense = (new PurchaseOrderExpense($this->purchase_order))->run();
|
||||
|
||||
return $expense;
|
||||
|
@ -14,8 +14,8 @@ return [
|
||||
'require_https' => env('REQUIRE_HTTPS', true),
|
||||
'app_url' => rtrim(env('APP_URL', ''), '/'),
|
||||
'app_domain' => env('APP_DOMAIN', 'invoicing.co'),
|
||||
'app_version' => '5.4.8',
|
||||
'app_tag' => '5.4.8',
|
||||
'app_version' => '5.4.9',
|
||||
'app_tag' => '5.4.9',
|
||||
'minimum_client_version' => '5.0.16',
|
||||
'terms_version' => '1.0.1',
|
||||
'api_secret' => env('API_SECRET', ''),
|
||||
|
Loading…
Reference in New Issue
Block a user