mirror of
https://github.com/invoiceninja/invoiceninja.git
synced 2025-06-02 11:44:34 -04:00
Fixes for exports
This commit is contained in:
parent
aca580780a
commit
e54dec8762
@ -127,18 +127,18 @@ class PurchaseOrderItemExport extends BaseExport
|
|||||||
|
|
||||||
if (str_contains($key, "item.")) {
|
if (str_contains($key, "item.")) {
|
||||||
|
|
||||||
$key = str_replace("item.", "", $key);
|
$tmp_key = str_replace("item.", "", $key);
|
||||||
|
|
||||||
if($key == 'type_id') {
|
if($tmp_key == 'type_id') {
|
||||||
$keyval = 'type';
|
$tmp_key = 'type';
|
||||||
}
|
}
|
||||||
|
|
||||||
if($key == 'tax_id') {
|
if($tmp_key == 'tax_id') {
|
||||||
$keyval = 'tax_category';
|
$tmp_key = 'tax_category';
|
||||||
}
|
}
|
||||||
|
|
||||||
if (property_exists($item, $key)) {
|
if (property_exists($item, $tmp_key)) {
|
||||||
$item_array[$key] = $item->{$key};
|
$item_array[$key] = $item->{$tmp_key};
|
||||||
} else {
|
} else {
|
||||||
$item_array[$key] = '';
|
$item_array[$key] = '';
|
||||||
}
|
}
|
||||||
|
@ -133,16 +133,16 @@ class QuoteItemExport extends BaseExport
|
|||||||
|
|
||||||
if (str_contains($key, "item.")) {
|
if (str_contains($key, "item.")) {
|
||||||
|
|
||||||
$key = str_replace("item.", "", $key);
|
$tmp_key = str_replace("item.", "", $key);
|
||||||
|
|
||||||
if($key == 'type_id')
|
if($tmp_key == 'type_id')
|
||||||
$key = 'type';
|
$tmp_key = 'type';
|
||||||
|
|
||||||
if($key == 'tax_id')
|
if($tmp_key == 'tax_id')
|
||||||
$key = 'tax_category';
|
$tmp_key = 'tax_category';
|
||||||
|
|
||||||
if (property_exists($item, $key)) {
|
if (property_exists($item, $tmp_key)) {
|
||||||
$item_array[$key] = $item->{$key};
|
$item_array[$key] = $item->{$tmp_key};
|
||||||
}
|
}
|
||||||
else {
|
else {
|
||||||
$item_array[$key] = '';
|
$item_array[$key] = '';
|
||||||
|
@ -180,8 +180,6 @@ class StoreClientRequest extends Request
|
|||||||
public function messages()
|
public function messages()
|
||||||
{
|
{
|
||||||
return [
|
return [
|
||||||
// 'unique' => ctrans('validation.unique', ['attribute' => ['email','number']),
|
|
||||||
//'required' => trans('validation.required', ['attribute' => 'email']),
|
|
||||||
'contacts.*.email.required' => ctrans('validation.email', ['attribute' => 'email']),
|
'contacts.*.email.required' => ctrans('validation.email', ['attribute' => 'email']),
|
||||||
'currency_code' => 'Currency code does not exist',
|
'currency_code' => 'Currency code does not exist',
|
||||||
];
|
];
|
||||||
|
@ -26,12 +26,18 @@ class StoreGroupSettingRequest extends Request
|
|||||||
*/
|
*/
|
||||||
public function authorize() : bool
|
public function authorize() : bool
|
||||||
{
|
{
|
||||||
return auth()->user()->can('create', GroupSetting::class) && auth()->user()->account->hasFeature(Account::FEATURE_API);
|
/** @var \App\Models\User $user */
|
||||||
|
$user = auth()->user();
|
||||||
|
|
||||||
|
return $user->can('create', GroupSetting::class) && $user->account->hasFeature(Account::FEATURE_API);
|
||||||
}
|
}
|
||||||
|
|
||||||
public function rules()
|
public function rules()
|
||||||
{
|
{
|
||||||
$rules['name'] = 'required|unique:group_settings,name,null,null,company_id,'.auth()->user()->companyId();
|
/** @var \App\Models\User $user */
|
||||||
|
$user = auth()->user();
|
||||||
|
|
||||||
|
$rules['name'] = 'required|unique:group_settings,name,null,null,company_id,'.$user->companyId();
|
||||||
|
|
||||||
$rules['settings'] = new ValidClientGroupSettingsRule();
|
$rules['settings'] = new ValidClientGroupSettingsRule();
|
||||||
|
|
||||||
|
@ -1171,7 +1171,7 @@ class ReportCsvGenerationTest extends TestCase
|
|||||||
public function testQuoteItemsCustomColumnsCsvGeneration()
|
public function testQuoteItemsCustomColumnsCsvGeneration()
|
||||||
{
|
{
|
||||||
|
|
||||||
\App\Models\Quote::factory()->create([
|
$q = \App\Models\Quote::factory()->create([
|
||||||
'user_id' => $this->user->id,
|
'user_id' => $this->user->id,
|
||||||
'company_id' => $this->company->id,
|
'company_id' => $this->company->id,
|
||||||
'client_id' => $this->client->id,
|
'client_id' => $this->client->id,
|
||||||
@ -1217,7 +1217,6 @@ class ReportCsvGenerationTest extends TestCase
|
|||||||
|
|
||||||
$csv = $response->streamedContent();
|
$csv = $response->streamedContent();
|
||||||
|
|
||||||
|
|
||||||
$this->assertEquals('bob', $this->getFirstValueByColumn($csv, 'Client Name'));
|
$this->assertEquals('bob', $this->getFirstValueByColumn($csv, 'Client Name'));
|
||||||
$this->assertEquals('1234', $this->getFirstValueByColumn($csv, 'Quote Number'));
|
$this->assertEquals('1234', $this->getFirstValueByColumn($csv, 'Quote Number'));
|
||||||
$this->assertEquals('10', $this->getFirstValueByColumn($csv, 'Item Quantity'));
|
$this->assertEquals('10', $this->getFirstValueByColumn($csv, 'Item Quantity'));
|
||||||
|
Loading…
x
Reference in New Issue
Block a user