mirror of
https://github.com/invoiceninja/invoiceninja.git
synced 2025-07-09 03:14:30 -04:00
Merge pull request #9145 from turbo124/v5-develop
Fixes for links to forum in setup.
This commit is contained in:
commit
8d7d6f4ae2
@ -37,6 +37,7 @@ class ProductSalesExport extends BaseExport
|
||||
'product_key' => 'product_key',
|
||||
'notes' => 'notes',
|
||||
'quantity' => 'quantity',
|
||||
'currency' => 'currency',
|
||||
'cost' => 'price',
|
||||
'price' => 'cost',
|
||||
'markup' => 'markup',
|
||||
@ -163,6 +164,7 @@ class ProductSalesExport extends BaseExport
|
||||
private function buildRow($invoice, $invoice_item) :array
|
||||
{
|
||||
$transformed_entity = (array)$invoice_item;
|
||||
$transformed_entity['price'] = ($invoice_item->product_cost ?? 1 ) * ($invoice->exchange_rate ?? 1) ;
|
||||
|
||||
$entity = [];
|
||||
|
||||
@ -171,6 +173,8 @@ class ProductSalesExport extends BaseExport
|
||||
|
||||
if (array_key_exists($key, $transformed_entity)) {
|
||||
$entity[$keyval] = $transformed_entity[$key];
|
||||
} elseif($key == 'currency') {
|
||||
$entity['currency'] = $invoice->client->currency()->code;
|
||||
} else {
|
||||
$entity[$keyval] = '';
|
||||
}
|
||||
@ -184,9 +188,9 @@ class ProductSalesExport extends BaseExport
|
||||
|
||||
private function decorateAdvancedFields(Invoice $invoice, $entity) :array
|
||||
{
|
||||
$product = $this->getProduct($entity['product_key']);
|
||||
|
||||
$entity['cost'] = $product->cost ?? 0;
|
||||
|
||||
//$product = $this->getProduct($entity['product_key']);
|
||||
// $entity['cost'] = $product->cost ?? 0;
|
||||
/** @var float $unit_cost */
|
||||
$unit_cost = $entity['cost'] == 0 ? 1 : $entity['cost'];
|
||||
|
||||
|
@ -71,7 +71,6 @@ class PreviewController extends BaseController
|
||||
|
||||
$ps = new PdfService($invitation, 'product', [
|
||||
'client' => $client ?? false,
|
||||
// 'vendor' => $vendor ?? false,
|
||||
"{$entity_prop}s" => [$entity_obj],
|
||||
]);
|
||||
|
||||
|
@ -191,7 +191,7 @@ class PreviewPurchaseOrderController extends BaseController
|
||||
$invitation->setRelation($request->entity, $entity_obj);
|
||||
|
||||
}
|
||||
|
||||
|
||||
$ps = new PdfService($invitation, 'purchase_order', [
|
||||
'client' => $entity_obj->client ?? false,
|
||||
'vendor' => $vendor ?? false,
|
||||
|
@ -387,7 +387,6 @@ class RecurringInvoiceController extends BaseController
|
||||
|
||||
$recurring_invoice->service()
|
||||
->triggeredActions($request)
|
||||
// ->deletePdf()
|
||||
->save();
|
||||
|
||||
event(new RecurringInvoiceWasUpdated($recurring_invoice, $recurring_invoice->company, Ninja::eventVars(auth()->user() ? auth()->user()->id : null)));
|
||||
|
@ -58,7 +58,11 @@ class PreviewPurchaseOrderRequest extends Request
|
||||
$input['amount'] = 0;
|
||||
$input['balance'] = 0;
|
||||
$input['number'] = isset($input['number']) ? $input['number'] : ctrans('texts.live_preview').' #'.rand(0, 1000); //30-06-2023
|
||||
|
||||
|
||||
if($input['entity_id'] ?? false) {
|
||||
$input['entity_id'] = $this->decodePrimaryKey($input['entity_id'], true);
|
||||
}
|
||||
|
||||
$this->replace($input);
|
||||
}
|
||||
|
||||
|
@ -117,6 +117,14 @@ class PurchaseOrder extends BaseModel
|
||||
use SoftDeletes;
|
||||
use MakesDates;
|
||||
|
||||
protected $hidden = [
|
||||
'id',
|
||||
'private_notes',
|
||||
'user_id',
|
||||
'vendor_id',
|
||||
'company_id',
|
||||
];
|
||||
|
||||
protected $fillable = [
|
||||
'number',
|
||||
'discount',
|
||||
|
@ -343,6 +343,21 @@ class RecurringInvoice extends BaseModel
|
||||
}
|
||||
}
|
||||
|
||||
public function calculateStatus()
|
||||
{
|
||||
|
||||
if($this->remaining_cycles == 0) {
|
||||
return self::STATUS_COMPLETED;
|
||||
}
|
||||
elseif ($this->status_id == self::STATUS_ACTIVE && Carbon::parse($this->next_send_date)->isFuture()) {
|
||||
return self::STATUS_PENDING;
|
||||
}
|
||||
else {
|
||||
return $this->status_id;
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
public function nextSendDate() :?Carbon
|
||||
{
|
||||
if (! $this->next_send_date_client) {
|
||||
|
@ -365,6 +365,7 @@ class BaseRepository
|
||||
|
||||
$model = $model->calc()->getRecurringInvoice();
|
||||
|
||||
$model->status_id = $model->calculateStatus();
|
||||
|
||||
if ($this->new_model) {
|
||||
event('eloquent.created: App\Models\RecurringInvoice', $model);
|
||||
|
@ -221,7 +221,6 @@ class PdfConfiguration
|
||||
$this->vendor = $this->entity->vendor;
|
||||
$this->vendor_contact = $this->service->invitation->contact;
|
||||
$this->path = $this->vendor->purchase_order_filepath($this->service->invitation);
|
||||
$this->entity_design_id = 'invoice_design_id';
|
||||
$this->entity_design_id = 'purchase_order_design_id';
|
||||
$this->settings = $this->vendor->company->settings;
|
||||
$this->settings_object = $this->vendor;
|
||||
@ -274,6 +273,7 @@ class PdfConfiguration
|
||||
*/
|
||||
private function setDesign(): self
|
||||
{
|
||||
|
||||
$design_id = $this->entity->design_id ?: $this->decodePrimaryKey($this->settings_object->getSetting($this->entity_design_id));
|
||||
|
||||
$this->design = Design::withTrashed()->find($design_id) ?? Design::withTrashed()->find(2);
|
||||
|
@ -12,7 +12,7 @@
|
||||
<p class="text-sm text-center">{{ ctrans('texts.if_you_need_help') }}
|
||||
<a
|
||||
target="_blank"
|
||||
href="https://www.invoiceninja.com/forums/forum/support/"
|
||||
href="https://forum.invoiceninja.com"
|
||||
class="button-link underline">
|
||||
{{ ctrans('texts.support_forum') }}
|
||||
</a>
|
||||
|
Loading…
x
Reference in New Issue
Block a user