mirror of
https://github.com/invoiceninja/invoiceninja.git
synced 2025-07-09 03:14:30 -04:00
Merge pull request #8875 from turbo124/v5-develop
Updates for missing props
This commit is contained in:
commit
02da1d5436
@ -28,4 +28,15 @@ class ProcessInvoicesInBulkRequest extends FormRequest
|
||||
'invoices' => ['array'],
|
||||
];
|
||||
}
|
||||
|
||||
public function prepareForValidation()
|
||||
{
|
||||
$input = $this->all();
|
||||
|
||||
if(isset($input['invoices'])){
|
||||
$input['invoices'] = array_unique($input['invoices']);
|
||||
}
|
||||
|
||||
$this->replace($input);
|
||||
}
|
||||
}
|
||||
|
@ -40,7 +40,7 @@ class RegisterRequest extends FormRequest
|
||||
$rules = [];
|
||||
|
||||
foreach ($this->company()->client_registration_fields as $field) {
|
||||
if ($field['visible']) {
|
||||
if ($field['visible'] ?? true) {
|
||||
$rules[$field['key']] = $field['required'] ? ['bail','required'] : ['sometimes'];
|
||||
}
|
||||
}
|
||||
|
@ -51,7 +51,7 @@ class StorePaymentRequest extends Request
|
||||
$credits_total = 0;
|
||||
|
||||
if (isset($input['client_id']) && is_string($input['client_id'])) {
|
||||
$input['client_id'] = $this->decodePrimaryKey($input['client_id']);
|
||||
$input['client_id'] = $this->decodePrimaryKey($input['client_id'], true);
|
||||
}
|
||||
|
||||
if (array_key_exists('assigned_user_id', $input) && is_string($input['assigned_user_id'])) {
|
||||
|
@ -1014,17 +1014,17 @@ html {
|
||||
*/
|
||||
protected function generateEntityImagesMarkup()
|
||||
{
|
||||
// if (!$this->client->getSetting('embed_documents') && !$this->company->account->hasFeature(Account::FEATURE_DOCUMENTS)) {
|
||||
// return '';
|
||||
// }
|
||||
if (!$this->client->getSetting('embed_documents') || !$this->company->account->hasFeature(Account::FEATURE_DOCUMENTS)) {
|
||||
return '';
|
||||
}
|
||||
|
||||
$dom = new \DOMDocument('1.0', 'UTF-8');
|
||||
|
||||
$container = $dom->createElement('div');
|
||||
$container->setAttribute('style', 'display:grid; grid-auto-flow: row; grid-template-columns: repeat(2, 1fr); grid-template-rows: repeat(2, 1fr);justify-items: center;');
|
||||
|
||||
foreach ($this->entity->documents as $document) {
|
||||
if (!$document->isImage()) {
|
||||
foreach ($this->entity->documents()->where('is_public',true)->get() as $document) {
|
||||
if (!$document->isImage()) {
|
||||
continue;
|
||||
}
|
||||
|
||||
|
@ -62,8 +62,27 @@ trait MakesHash
|
||||
return $hashids->encode($value);
|
||||
}
|
||||
|
||||
public function decodePrimaryKey($value)
|
||||
public function decodePrimaryKey($value, $return_string_failure = false)
|
||||
{
|
||||
|
||||
try {
|
||||
$hashids = new Hashids(config('ninja.hash_salt'), 10);
|
||||
|
||||
$decoded_array = $hashids->decode($value);
|
||||
|
||||
if(isset($decoded_array[0]) ?? false) {
|
||||
return $decoded_array[0];
|
||||
} elseif($return_string_failure) {
|
||||
return "Invalid Primary Key";
|
||||
} else {
|
||||
throw new \Exception('Invalid Primary Key');
|
||||
}
|
||||
|
||||
} catch (\Exception $e) {
|
||||
return response()->json(['error'=>'Invalid primary key'], 400);
|
||||
}
|
||||
|
||||
/*
|
||||
try {
|
||||
$hashids = new Hashids(config('ninja.hash_salt'), 10);
|
||||
|
||||
@ -77,6 +96,7 @@ trait MakesHash
|
||||
} catch (\Exception $e) {
|
||||
return response()->json(['error'=>'Invalid primary key'], 400);
|
||||
}
|
||||
*/
|
||||
}
|
||||
|
||||
public function transformKeys($keys)
|
||||
|
@ -12,18 +12,19 @@
|
||||
|
||||
namespace App\Utils;
|
||||
|
||||
use App\Models\Country;
|
||||
use App\Models\CreditInvitation;
|
||||
use App\Models\InvoiceInvitation;
|
||||
use App\Models\PurchaseOrderInvitation;
|
||||
use App\Models\QuoteInvitation;
|
||||
use App\Models\RecurringInvoiceInvitation;
|
||||
use App\Utils\Traits\AppSetup;
|
||||
use App\Utils\Traits\DesignCalculator;
|
||||
use App\Utils\Traits\MakesDates;
|
||||
use Exception;
|
||||
use App\Models\Account;
|
||||
use App\Models\Country;
|
||||
use App\Utils\Traits\AppSetup;
|
||||
use App\Models\QuoteInvitation;
|
||||
use App\Models\CreditInvitation;
|
||||
use App\Utils\Traits\MakesDates;
|
||||
use App\Models\InvoiceInvitation;
|
||||
use Illuminate\Support\Facades\App;
|
||||
use Illuminate\Support\Facades\Cache;
|
||||
use App\Utils\Traits\DesignCalculator;
|
||||
use App\Models\PurchaseOrderInvitation;
|
||||
use App\Models\RecurringInvoiceInvitation;
|
||||
|
||||
/**
|
||||
* Note the premise used here is that any currencies will be formatted back to the company currency and not
|
||||
@ -775,31 +776,37 @@ html {
|
||||
*/
|
||||
protected function generateEntityImagesMarkup()
|
||||
{
|
||||
if ($this->company->getSetting('embed_documents') === false) {
|
||||
|
||||
if (!$this->vendor->getSetting('embed_documents') || !$this->company->account->hasFeature(Account::FEATURE_DOCUMENTS)) {
|
||||
return '';
|
||||
}
|
||||
|
||||
$dom = new \DOMDocument('1.0', 'UTF-8');
|
||||
|
||||
$container = $dom->createElement('div');
|
||||
$container->setAttribute('style', 'display:grid; grid-auto-flow: row; grid-template-columns: repeat(4, 1fr); grid-template-rows: repeat(2, 1fr);');
|
||||
|
||||
foreach ($this->entity->documents as $document) {
|
||||
$container->setAttribute('style', 'display:grid; grid-auto-flow: row; grid-template-columns: repeat(2, 1fr); grid-template-rows: repeat(2, 1fr);justify-items: center;');
|
||||
|
||||
foreach ($this->entity->documents()->where('is_public',true)->get() as $document) {
|
||||
if (!$document->isImage()) {
|
||||
continue;
|
||||
}
|
||||
|
||||
$image = $dom->createElement('img');
|
||||
|
||||
$image->setAttribute('src', $document->generateUrl());
|
||||
$image->setAttribute('style', 'max-height: 100px; margin-top: 20px;');
|
||||
$image->setAttribute('src', "data:image/png;base64,".base64_encode($document->getFile()));
|
||||
$image->setAttribute('style', 'max-width: 50%; margin-top: 20px;');
|
||||
|
||||
$container->appendChild($image);
|
||||
}
|
||||
|
||||
$dom->appendChild($container);
|
||||
|
||||
return $dom->saveHTML();
|
||||
$html = $dom->saveHTML();
|
||||
|
||||
$dom = null;
|
||||
|
||||
return $html;
|
||||
|
||||
}
|
||||
|
||||
/**
|
||||
|
@ -3679,9 +3679,9 @@ $LANG = array(
|
||||
'send_date' => 'Send Date',
|
||||
'auto_bill_on' => 'Auto Bill On',
|
||||
'minimum_under_payment_amount' => 'Minimum Under Payment Amount',
|
||||
'allow_over_payment' => 'Allow Over Payment',
|
||||
'allow_over_payment' => 'Allow Overpayment',
|
||||
'allow_over_payment_help' => 'Support paying extra to accept tips',
|
||||
'allow_under_payment' => 'Allow Under Payment',
|
||||
'allow_under_payment' => 'Allow Underpayment',
|
||||
'allow_under_payment_help' => 'Support paying at minimum the partial/deposit amount',
|
||||
'test_mode' => 'Test Mode',
|
||||
'calculated_rate' => 'Calculated Rate',
|
||||
@ -3978,8 +3978,8 @@ $LANG = array(
|
||||
'account_balance' => 'Account Balance',
|
||||
'thanks' => 'Thanks',
|
||||
'minimum_required_payment' => 'Minimum required payment is :amount',
|
||||
'under_payments_disabled' => 'Company doesn\'t support under payments.',
|
||||
'over_payments_disabled' => 'Company doesn\'t support over payments.',
|
||||
'under_payments_disabled' => 'Company doesn\'t support underpayments.',
|
||||
'over_payments_disabled' => 'Company doesn\'t support overpayments.',
|
||||
'saved_at' => 'Saved at :time',
|
||||
'credit_payment' => 'Credit applied to Invoice :invoice_number',
|
||||
'credit_subject' => 'New credit :number from :account',
|
||||
@ -4654,8 +4654,8 @@ $LANG = array(
|
||||
'search_purchase_order' => 'Search Purchase Order',
|
||||
'search_purchase_orders' => 'Search Purchase Orders',
|
||||
'login_url' => 'Login URL',
|
||||
'enable_applying_payments' => 'Enable Applying Payments',
|
||||
'enable_applying_payments_help' => 'Support separately creating and applying payments',
|
||||
'enable_applying_payments' => 'Manual Overpayments',
|
||||
'enable_applying_payments_help' => 'Support adding an overpayment amount manually on a payment',
|
||||
'stock_quantity' => 'Stock Quantity',
|
||||
'notification_threshold' => 'Notification Threshold',
|
||||
'track_inventory' => 'Track Inventory',
|
||||
|
Loading…
x
Reference in New Issue
Block a user