1
0
mirror of https://github.com/invoiceninja/invoiceninja.git synced 2024-09-20 00:11:35 +02:00

Custom fields

This commit is contained in:
Hillel Coren 2014-04-22 00:39:42 +03:00
parent add9cb1569
commit 9683f1d1b5
9 changed files with 98 additions and 7 deletions

View File

@ -330,6 +330,7 @@ class InvoiceController extends \BaseController {
{
if (Auth::user()->confirmed)
{
$message = trans('texts.emailed_invoice');
$this->mailer->sendInvoice($invoice);
Session::flash('message', $message);
}

View File

@ -24,6 +24,7 @@ class AddCustomFields extends Migration {
$table->string('custom_client_label2');
});
Schema::table('clients', function($table)
{
$table->string('custom_value1');

View File

@ -311,6 +311,12 @@ return array(
'pro_plan_success' => 'Thanks for joining! Once the invoice is paid your Pro Plan membership will begin.',
'unsaved_changes' => 'You have unsaved changes',
'custom_fields' => 'Custom fields',
'company_fields' => 'Company Fields',
'client_fields' => 'Client Fields',
'field_label' => 'Field Label',
'field_value' => 'Field Value',
'edit' => 'Edit',
);

View File

@ -310,6 +310,12 @@ return array(
'pro_plan_success' => 'Thanks for joining! Once the invoice is paid your Pro Plan membership will begin.',
'unsaved_changes' => 'You have unsaved changes',
'custom_fields' => 'Custom fields',
'company_fields' => 'Company Fields',
'client_fields' => 'Client Fields',
'field_label' => 'Field Label',
'field_value' => 'Field Value',
'edit' => 'Edit',
);

View File

@ -311,6 +311,12 @@ return array(
'pro_plan_success' => 'Merci pour votre inscription ! Une fois la facture réglée, votre adhésion au Plan Pro commencera.',
'unsaved_changes' => 'You have unsaved changes',
'custom_fields' => 'Custom fields',
'company_fields' => 'Company Fields',
'client_fields' => 'Client Fields',
'field_label' => 'Field Label',
'field_value' => 'Field Value',
'edit' => 'Edit',
);

View File

@ -311,6 +311,12 @@ return array(
'pro_plan_success' => 'Thanks for joining! Once the invoice is paid your Pro Plan membership will begin.',
'unsaved_changes' => 'You have unsaved changes',
'custom_fields' => 'Custom fields',
'company_fields' => 'Company Fields',
'client_fields' => 'Client Fields',
'field_label' => 'Field Label',
'field_value' => 'Field Value',
'edit' => 'Edit',
);

View File

@ -311,6 +311,12 @@ return array(
'pro_plan_success' => 'Thanks for joining! Once the invoice is paid your Pro Plan membership will begin.',
'unsaved_changes' => 'You have unsaved changes',
'custom_fields' => 'Custom fields',
'company_fields' => 'Company Fields',
'client_fields' => 'Client Fields',
'field_label' => 'Field Label',
'field_value' => 'Field Value',
'edit' => 'Edit',
);

View File

@ -299,6 +299,12 @@ return array(
'pro_plan_success' => 'Thanks for joining! Once the invoice is paid your Pro Plan membership will begin.',
'unsaved_changes' => 'You have unsaved changes',
'custom_fields' => 'Custom fields',
'company_fields' => 'Company Fields',
'client_fields' => 'Client Fields',
'field_label' => 'Field Label',
'field_value' => 'Field Value',
'edit' => 'Edit',
);

View File

@ -57,23 +57,76 @@ class Invoice extends EntityModel
return $this->invoice_status_id >= INVOICE_STATUS_PAID;
}
public function hidePrivateFields()
{
$this->setVisible(['invoice_number', 'discount', 'po_number', 'invoice_date', 'due_date', 'terms', 'public_notes', 'amount', 'balance', 'invoice_items', 'client', 'tax_name', 'tax_rate', 'account', 'invoice_design_id']);
$this->setVisible([
'invoice_number',
'discount',
'po_number',
'invoice_date',
'due_date',
'terms',
'public_notes',
'amount',
'balance',
'invoice_items',
'client',
'tax_name',
'tax_rate',
'account',
'invoice_design_id']);
$this->client->setVisible(['name', 'address1', 'address2', 'city', 'state', 'postal_code', 'work_phone', 'payment_terms', 'contacts', 'country', 'currency_id' ]);
$this->account->setVisible(['name', 'address1', 'address2', 'city', 'state', 'postal_code', 'work_phone', 'work_email', 'country', 'currency_id']);
$this->client->setVisible([
'name',
'address1',
'address2',
'city',
'state',
'postal_code',
'work_phone',
'payment_terms',
'contacts',
'country',
'currency_id',
'custom_value1',
'custom_value2']);
$this->account->setVisible([
'name',
'address1',
'address2',
'city',
'state',
'postal_code',
'work_phone',
'work_email',
'country',
'currency_id',
'custom_label1',
'custom_value1',
'custom_label2',
'custom_value2',
'custom_client_label1',
'custom_client_label2']);
foreach ($this->invoice_items as $invoiceItem)
{
$invoiceItem->setVisible(['product_key', 'notes', 'cost', 'qty', 'tax_name', 'tax_rate']);
$invoiceItem->setVisible([
'product_key',
'notes',
'cost',
'qty',
'tax_name',
'tax_rate']);
}
foreach ($this->client->contacts as $contact)
{
$contact->setVisible(['first_name', 'last_name', 'email', 'phone']);
$contact->setVisible([
'first_name',
'last_name',
'email',
'phone']);
}
return $this;