mirror of
https://github.com/invoiceninja/invoiceninja.git
synced 2025-05-24 02:14:21 -04:00
Set public/private for documents
This commit is contained in:
parent
eec0920d1d
commit
f3b1e93873
@ -966,16 +966,17 @@ class InvoiceController extends BaseController
|
||||
*/
|
||||
public function upload(UploadInvoiceRequest $request, Invoice $invoice)
|
||||
{
|
||||
|
||||
if (! $this->checkFeature(Account::FEATURE_DOCUMENTS)) {
|
||||
return $this->featureFailure();
|
||||
}
|
||||
|
||||
if ($request->has('documents')) {
|
||||
$this->saveDocuments($request->file('documents'), $invoice);
|
||||
$this->saveDocuments($request->file('documents'), $invoice, $request->input('is_public', true));
|
||||
}
|
||||
|
||||
if ($request->has('file')) {
|
||||
$this->saveDocuments($request->file('documents'), $invoice);
|
||||
$this->saveDocuments($request->file('documents'), $invoice, $request->input('is_public', true));
|
||||
}
|
||||
|
||||
return $this->itemResponse($invoice->fresh());
|
||||
|
@ -44,6 +44,8 @@ class UploadInvoiceRequest extends Request
|
||||
$rules['file'] = $this->file_validation;
|
||||
}
|
||||
|
||||
$rules['is_public'] = 'sometimes|boolean';
|
||||
|
||||
return $rules;
|
||||
}
|
||||
|
||||
|
@ -53,7 +53,7 @@ class UploadFile implements ShouldQueue
|
||||
|
||||
public $disk;
|
||||
|
||||
public function __construct($file, $type, $user, $company, $entity, $disk = null, $is_public = false)
|
||||
public function __construct($file, $type, $user, $company, $entity, $disk = null, $is_public = true)
|
||||
{
|
||||
$this->file = $file;
|
||||
$this->type = $type;
|
||||
|
@ -20,7 +20,7 @@ use Illuminate\Database\Eloquent\Model;
|
||||
* @property string $hash
|
||||
* @property float $fee_total
|
||||
* @property int|null $fee_invoice_id
|
||||
* @property mixed $data
|
||||
* @property \stdClass $data
|
||||
* @property int|null $payment_id
|
||||
* @property \Illuminate\Support\Carbon|null $created_at
|
||||
* @property \Illuminate\Support\Carbon|null $updated_at
|
||||
@ -38,6 +38,13 @@ class PaymentHash extends Model
|
||||
'data' => 'object',
|
||||
];
|
||||
|
||||
/**
|
||||
* @class \App\Models\PaymentHash $this
|
||||
* @property \App\Models\PaymentHash $data
|
||||
* @class \stdClass $data
|
||||
* @property string $raw_value
|
||||
*/
|
||||
|
||||
|
||||
/**
|
||||
* @return mixed
|
||||
@ -75,9 +82,8 @@ class PaymentHash extends Model
|
||||
|
||||
public function withData(string $property, $value): self
|
||||
{
|
||||
$this->data = array_merge((array) $this->data, [$property => $value]);
|
||||
$this->save();
|
||||
|
||||
return $this;
|
||||
$this->data = array_merge((array) $this->data, [$property => $value]); // @phpstan-ignore-line
|
||||
$this->save();// @phpstan-ignore-line
|
||||
return $this; // @phpstan-ignore-line
|
||||
}
|
||||
}
|
||||
|
@ -88,14 +88,15 @@ class CheckoutWebhook implements ShouldQueue
|
||||
|
||||
$driver = $this->company_gateway->driver($payment_hash->fee_invoice->client)->init()->setPaymentMethod();
|
||||
|
||||
$payment_hash->data = array_merge((array) $payment_hash->data, $this->webhook_array);
|
||||
$payment_hash->save();
|
||||
$driver->setPaymentHash($payment_hash);
|
||||
$payment_hash->data = array_merge((array) $payment_hash->data, $this->webhook_array); // @phpstan-ignore-line
|
||||
$payment_hash->save();
|
||||
$driver->setPaymentHash($payment_hash);
|
||||
|
||||
// @phpstan-ignore-line
|
||||
$data = [
|
||||
'payment_method' => isset($this->webhook_array['source']['id']) ? $this->webhook_array['source']['id'] : '',
|
||||
'payment_type' => PaymentType::CREDIT_CARD_OTHER,
|
||||
'amount' => $payment_hash->data->raw_value,
|
||||
'amount' => $payment_hash->data->raw_value, // @phpstan-ignore-line
|
||||
'transaction_reference' => $payment_object['id'],
|
||||
'gateway_type_id' => GatewayType::CREDIT_CARD,
|
||||
];
|
||||
|
@ -66,8 +66,6 @@ class Webhook
|
||||
|
||||
/**
|
||||
* Lists the workflows in Checkout
|
||||
*
|
||||
* @return void
|
||||
*/
|
||||
public function getWorkFlows()
|
||||
{
|
||||
|
Loading…
x
Reference in New Issue
Block a user