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

Added default quote terms

This commit is contained in:
Hillel Coren 2015-10-29 16:42:05 +02:00
parent 404435a145
commit aa0a35f9d8
24 changed files with 226 additions and 165 deletions

View File

@ -8,17 +8,15 @@ class InvoiceInvitationWasEmailed extends Event {
use SerializesModels;
public $invoice;
public $invitation;
/**
* Create a new event instance.
*
* @return void
*/
public function __construct($invoice, $invitation)
public function __construct($invitation)
{
$this->invoice = $invoice;
$this->invitation = $invitation;
}

View File

@ -8,7 +8,6 @@ class QuoteInvitationWasEmailed extends Event {
use SerializesModels;
public $quote;
public $invitation;
/**
@ -16,9 +15,8 @@ class QuoteInvitationWasEmailed extends Event {
*
* @return void
*/
public function __construct($quote, $invitation)
public function __construct($invitation)
{
$this->quote = $quote;
$this->invitation = $invitation;
}

View File

@ -521,8 +521,10 @@ class AccountController extends BaseController
$account->invoice_number_counter = Input::get('invoice_number_counter');
$account->quote_number_prefix = Input::get('quote_number_prefix');
$account->share_counter = Input::get('share_counter') ? true : false;
$account->pdf_email_attachment = Input::get('pdf_email_attachment') ? true : false;
$account->invoice_terms = Input::get('invoice_terms');
$account->invoice_footer = Input::get('invoice_footer');
$account->quote_terms = Input::get('quote_terms');
if (Input::has('recurring_hour')) {
$account->recurring_hour = Input::get('recurring_hour');
@ -801,12 +803,6 @@ class AccountController extends BaseController
private function saveNotifications()
{
$account = Auth::user()->account;
$account->invoice_terms = Input::get('invoice_terms');
$account->invoice_footer = Input::get('invoice_footer');
$account->email_footer = Input::get('email_footer');
$account->save();
$user = Auth::user();
$user->notify_sent = Input::get('notify_sent');
$user->notify_viewed = Input::get('notify_viewed');
@ -847,6 +843,7 @@ class AccountController extends BaseController
$account->country_id = Input::get('country_id') ? Input::get('country_id') : null;
$account->size_id = Input::get('size_id') ? Input::get('size_id') : null;
$account->industry_id = Input::get('industry_id') ? Input::get('industry_id') : null;
$account->email_footer = Input::get('email_footer');
$account->save();
/* Logo image file */

View File

@ -558,11 +558,10 @@ class InvoiceController extends BaseController
{
$action = Input::get('bulk_action') ?: Input::get('action');;
$ids = Input::get('bulk_public_id') ?: (Input::get('public_id') ?: Input::get('ids'));
$statusId = Input::get('statusId', INVOICE_STATUS_SENT);
$count = $this->invoiceService->bulk($ids, $action, $statusId);
$count = $this->invoiceService->bulk($ids, $action);
if ($count > 0) {
$key = $action == 'mark' ? "updated_{$entityType}" : "{$action}d_{$entityType}";
$key = $action == 'markSent' ? "updated_{$entityType}" : "{$action}d_{$entityType}";
$message = Utils::pluralize($key, $count);
Session::flash('message', $message);
}

View File

@ -134,12 +134,11 @@ class QuoteController extends BaseController
return Redirect::to('invoices/'.$clone->public_id);
}
$statusId = Input::get('statusId');
$ids = Input::get('bulk_public_id') ?: (Input::get('public_id') ?: Input::get('ids'));
$count = $this->invoiceService->bulk($ids, $action, $statusId);
$count = $this->invoiceService->bulk($ids, $action);
if ($count > 0) {
$key = $action == 'mark' ? "updated_quote" : "{$action}d_quote";
$key = $action == 'markSent' ? "updated_quote" : "{$action}d_quote";
$message = Utils::pluralize($key, $count);
Session::flash('message', $message);
}

View File

@ -146,7 +146,7 @@ class ActivityListener
public function emailedInvoice(InvoiceInvitationWasEmailed $event)
{
$this->activityRepo->create(
$event->invoice,
$event->invitation->invoice,
ACTIVITY_TYPE_EMAIL_INVOICE,
false,
false,
@ -224,7 +224,7 @@ class ActivityListener
public function emailedQuote(QuoteInvitationWasEmailed $event)
{
$this->activityRepo->create(
$event->quote,
$event->invitation->invoice,
ACTIVITY_TYPE_EMAIL_QUOTE,
false,
false,

View File

@ -25,12 +25,6 @@ class InvoiceListener
$invoice->updatePaidStatus();
}
public function emailedInvoice(InvoiceWasEmailed $event)
{
$invoice = $event->invoice;
$invoice->markSent();
}
public function viewedInvoice(InvoiceInvitationWasViewed $event)
{
$invitation = $event->invitation;

View File

@ -1,16 +1,12 @@
<?php namespace app\Listeners;
use Carbon;
use App\Events\QuoteWasEmailed;
use App\Events\QuoteInvitationWasViewed;
use App\Events\QuoteInvitationWasEmailed;
class QuoteListener
{
public function emailedQuote(QuoteWasEmailed $event)
{
$quote = $event->quote;
$quote->markSent();
}
public function viewedQuote(QuoteInvitationWasViewed $event)
{
$invitation = $event->invitation;

View File

@ -73,6 +73,14 @@ class Invitation extends EntityModel
return $this->invitation_key;
}
public function markSent($messageId = null)
{
$this->message_id = $messageId;
$this->email_error = null;
$this->sent_date = Carbon::now()->toDateTimeString();
$this->save();
}
public function markViewed()
{
$invoice = $this->invoice;

View File

@ -9,6 +9,8 @@ use App\Events\QuoteWasCreated;
use App\Events\QuoteWasUpdated;
use App\Events\InvoiceWasCreated;
use App\Events\InvoiceWasUpdated;
use App\Events\InvoiceInvitationWasEmailed;
use App\Events\QuoteInvitationWasEmailed;
class Invoice extends EntityModel implements BalanceAffecting
{
@ -145,12 +147,33 @@ class Invoice extends EntityModel implements BalanceAffecting
return $this->hasMany('App\Models\Invitation')->orderBy('invitations.contact_id');
}
public function markSent()
public function markInvitationsSent($notify = false)
{
foreach ($this->invitations as $invitation) {
$this->markInvitationSent($invitation, false, $notify);
}
}
public function markInvitationSent($invitation, $messageId = false, $notify = true)
{
if (!$this->isSent()) {
$this->invoice_status_id = INVOICE_STATUS_SENT;
$this->save();
}
$invitation->markSent($messageId);
// if the user marks it as sent rather than acually sending it
// then we won't track it in the activity log
if (!$notify) {
return;
}
if ($this->is_quote) {
event(new QuoteInvitationWasEmailed($invitation));
} else {
event(new InvoiceInvitationWasEmailed($invitation));
}
}
public function markViewed()
@ -166,7 +189,7 @@ class Invoice extends EntityModel implements BalanceAffecting
if ($this->isPaid() && $this->balance > 0) {
$this->invoice_status_id = ($this->balance == $this->amount ? INVOICE_STATUS_SENT : INVOICE_STATUS_PARTIAL);
$this->save();
} elseif ($this->invoice_status_id && $this->amount && $this->balance == 0 && $this->invoice_status_id != INVOICE_STATUS_PAID) {
} elseif ($this->invoice_status_id && $this->amount > 0 && $this->balance == 0 && $this->invoice_status_id != INVOICE_STATUS_PAID) {
$this->invoice_status_id = INVOICE_STATUS_PAID;
$this->save();
}

View File

@ -11,10 +11,7 @@ use App\Models\Activity;
use App\Models\Gateway;
use App\Events\InvoiceWasEmailed;
use App\Events\InvoiceInvitationWasEmailed;
use App\Events\QuoteWasEmailed;
use App\Events\QuoteInvitationWasEmailed;
class ContactMailer extends Mailer
{
@ -103,15 +100,10 @@ class ContactMailer extends Mailer
$subject = $this->processVariables($subject, $variables);
$fromEmail = $user->email;
$response = $this->sendTo($invitation->contact->email, $fromEmail, $account->getDisplayName(), $subject, ENTITY_INVOICE, $data);
if ($response === true) {
if ($invoice->is_quote) {
event(new QuoteInvitationWasEmailed($invoice, $invitation));
} else {
event(new InvoiceInvitationWasEmailed($invoice, $invitation));
}
return true;
} else {
return false;

View File

@ -50,16 +50,16 @@ class Mailer
{
if (isset($data['invitation'])) {
$invitation = $data['invitation'];
$invoice = $invitation->invoice;
$messageId = false;
// Track the Postmark message id
if (isset($_ENV['POSTMARK_API_TOKEN']) && $response) {
$json = $response->json();
$invitation->message_id = $json['MessageID'];
$messageId = $json['MessageID'];
}
$invitation->email_error = null;
$invitation->sent_date = \Carbon::now()->toDateTimeString();
$invitation->save();
$invoice->markInvitationSent($invitation, $messageId);
}
return true;

View File

@ -243,7 +243,7 @@ class InvoiceRepository extends BaseRepository
if ((isset($data['set_default_terms']) && $data['set_default_terms'])
|| (isset($data['set_default_footer']) && $data['set_default_footer'])) {
if (isset($data['set_default_terms']) && $data['set_default_terms']) {
$account->invoice_terms = trim($data['terms']);
$account->{"{$entityType}_terms"} = trim($data['terms']);
}
if (isset($data['set_default_footer']) && $data['set_default_footer']) {
$account->invoice_footer = trim($data['invoice_footer']);
@ -530,10 +530,9 @@ class InvoiceRepository extends BaseRepository
return $clone;
}
public function mark($invoice, $statusId)
public function markSent($invoice)
{
$invoice->invoice_status_id = $statusId;
$invoice->save();
$invoice->markInvitationsSent();
}
public function findInvoiceByInvitation($invitationKey)

View File

@ -48,7 +48,6 @@ class EventServiceProvider extends ServiceProvider {
],
'App\Events\InvoiceWasEmailed' => [
'App\Listeners\NotificationListener@emailedInvoice',
'App\Listeners\InvoiceListener@emailedInvoice',
],
'App\Events\InvoiceInvitationWasEmailed' => [
'App\Listeners\ActivityListener@emailedInvoice',
@ -77,7 +76,6 @@ class EventServiceProvider extends ServiceProvider {
'App\Listeners\ActivityListener@restoredQuote',
],
'App\Events\QuoteWasEmailed' => [
'App\Listeners\QuoteListener@emailedQuote',
'App\Listeners\NotificationListener@emailedQuote',
],
'App\Events\QuoteInvitationWasEmailed' => [

View File

@ -11,7 +11,7 @@ class BaseService
return null;
}
public function bulk($ids, $action, $param = null)
public function bulk($ids, $action)
{
if ( ! $ids) {
return 0;
@ -20,7 +20,7 @@ class BaseService
$entities = $this->getRepo()->findByPublicIdsWithTrashed($ids);
foreach ($entities as $entity) {
$this->getRepo()->$action($entity, $param);
$this->getRepo()->$action($entity);
}
return count($entities);

143
composer.lock generated
View File

@ -770,16 +770,16 @@
},
{
"name": "doctrine/cache",
"version": "v1.4.2",
"version": "v1.5.0",
"source": {
"type": "git",
"url": "https://github.com/doctrine/cache.git",
"reference": "8c434000f420ade76a07c64cbe08ca47e5c101ca"
"reference": "eb8a73619af4f1c8711e2ce482f5de3643258a1f"
},
"dist": {
"type": "zip",
"url": "https://api.github.com/repos/doctrine/cache/zipball/8c434000f420ade76a07c64cbe08ca47e5c101ca",
"reference": "8c434000f420ade76a07c64cbe08ca47e5c101ca",
"url": "https://api.github.com/repos/doctrine/cache/zipball/eb8a73619af4f1c8711e2ce482f5de3643258a1f",
"reference": "eb8a73619af4f1c8711e2ce482f5de3643258a1f",
"shasum": ""
},
"require": {
@ -800,8 +800,8 @@
}
},
"autoload": {
"psr-0": {
"Doctrine\\Common\\Cache\\": "lib/"
"psr-4": {
"Doctrine\\Common\\Cache\\": "lib/Doctrine/Common/Cache"
}
},
"notification-url": "https://packagist.org/downloads/",
@ -836,7 +836,7 @@
"cache",
"caching"
],
"time": "2015-08-31 12:36:41"
"time": "2015-10-28 11:27:45"
},
{
"name": "doctrine/collections",
@ -2057,16 +2057,16 @@
},
{
"name": "laravel/socialite",
"version": "v2.0.13",
"version": "v2.0.14",
"source": {
"type": "git",
"url": "https://github.com/laravel/socialite.git",
"reference": "5995d2c9c60b47362412a84286e2a0707e0db386"
"reference": "b15f4be0ac739405120d74b837af423aa71502d9"
},
"dist": {
"type": "zip",
"url": "https://api.github.com/repos/laravel/socialite/zipball/5995d2c9c60b47362412a84286e2a0707e0db386",
"reference": "5995d2c9c60b47362412a84286e2a0707e0db386",
"url": "https://api.github.com/repos/laravel/socialite/zipball/b15f4be0ac739405120d74b837af423aa71502d9",
"reference": "b15f4be0ac739405120d74b837af423aa71502d9",
"shasum": ""
},
"require": {
@ -2107,7 +2107,7 @@
"laravel",
"oauth"
],
"time": "2015-09-24 20:59:56"
"time": "2015-10-16 15:39:46"
},
{
"name": "laravelcollective/html",
@ -2245,16 +2245,16 @@
},
{
"name": "league/oauth1-client",
"version": "1.6.0",
"version": "1.6.1",
"source": {
"type": "git",
"url": "https://github.com/thephpleague/oauth1-client.git",
"reference": "4d4edd9b6014f882e319231a9b3351e3a1dfdc81"
"reference": "cef3ceda13c78f89c323e4d5e6301c0eb7cea422"
},
"dist": {
"type": "zip",
"url": "https://api.github.com/repos/thephpleague/oauth1-client/zipball/4d4edd9b6014f882e319231a9b3351e3a1dfdc81",
"reference": "4d4edd9b6014f882e319231a9b3351e3a1dfdc81",
"url": "https://api.github.com/repos/thephpleague/oauth1-client/zipball/cef3ceda13c78f89c323e4d5e6301c0eb7cea422",
"reference": "cef3ceda13c78f89c323e4d5e6301c0eb7cea422",
"shasum": ""
},
"require": {
@ -2304,7 +2304,7 @@
"tumblr",
"twitter"
],
"time": "2015-08-22 09:49:14"
"time": "2015-10-23 04:02:07"
},
{
"name": "lokielse/omnipay-alipay",
@ -2357,16 +2357,16 @@
},
{
"name": "maximebf/debugbar",
"version": "v1.10.4",
"version": "v1.10.5",
"source": {
"type": "git",
"url": "https://github.com/maximebf/php-debugbar.git",
"reference": "7b2006e6e095126b5a061ec33fca3d90ea8a8219"
"reference": "30e53e8a28284b69dd223c9f5ee8957befd72636"
},
"dist": {
"type": "zip",
"url": "https://api.github.com/repos/maximebf/php-debugbar/zipball/7b2006e6e095126b5a061ec33fca3d90ea8a8219",
"reference": "7b2006e6e095126b5a061ec33fca3d90ea8a8219",
"url": "https://api.github.com/repos/maximebf/php-debugbar/zipball/30e53e8a28284b69dd223c9f5ee8957befd72636",
"reference": "30e53e8a28284b69dd223c9f5ee8957befd72636",
"shasum": ""
},
"require": {
@ -2409,7 +2409,7 @@
"keywords": [
"debug"
],
"time": "2015-02-05 07:51:20"
"time": "2015-10-19 20:35:12"
},
{
"name": "mfauveau/omnipay-pacnet",
@ -4827,24 +4827,23 @@
},
{
"name": "symfony/class-loader",
"version": "v2.7.5",
"version": "v2.7.6",
"source": {
"type": "git",
"url": "https://github.com/symfony/class-loader.git",
"reference": "d957ea6295d7016e20d7eff33a6c1deef819c0d4"
"reference": "320f8d2a9cdbcbeb24be602c124aae9d998474a4"
},
"dist": {
"type": "zip",
"url": "https://api.github.com/repos/symfony/class-loader/zipball/d957ea6295d7016e20d7eff33a6c1deef819c0d4",
"reference": "d957ea6295d7016e20d7eff33a6c1deef819c0d4",
"url": "https://api.github.com/repos/symfony/class-loader/zipball/320f8d2a9cdbcbeb24be602c124aae9d998474a4",
"reference": "320f8d2a9cdbcbeb24be602c124aae9d998474a4",
"shasum": ""
},
"require": {
"php": ">=5.3.9"
},
"require-dev": {
"symfony/finder": "~2.0,>=2.0.5",
"symfony/phpunit-bridge": "~2.7"
"symfony/finder": "~2.0,>=2.0.5"
},
"type": "library",
"extra": {
@ -4873,7 +4872,7 @@
],
"description": "Symfony ClassLoader Component",
"homepage": "https://symfony.com",
"time": "2015-08-26 17:56:37"
"time": "2015-10-23 14:47:27"
},
{
"name": "symfony/console",
@ -4996,16 +4995,16 @@
},
{
"name": "symfony/event-dispatcher",
"version": "v2.7.5",
"version": "v2.7.6",
"source": {
"type": "git",
"url": "https://github.com/symfony/event-dispatcher.git",
"reference": "ae4dcc2a8d3de98bd794167a3ccda1311597c5d9"
"reference": "87a5db5ea887763fa3a31a5471b512ff1596d9b8"
},
"dist": {
"type": "zip",
"url": "https://api.github.com/repos/symfony/event-dispatcher/zipball/ae4dcc2a8d3de98bd794167a3ccda1311597c5d9",
"reference": "ae4dcc2a8d3de98bd794167a3ccda1311597c5d9",
"url": "https://api.github.com/repos/symfony/event-dispatcher/zipball/87a5db5ea887763fa3a31a5471b512ff1596d9b8",
"reference": "87a5db5ea887763fa3a31a5471b512ff1596d9b8",
"shasum": ""
},
"require": {
@ -5016,7 +5015,6 @@
"symfony/config": "~2.0,>=2.0.5",
"symfony/dependency-injection": "~2.6",
"symfony/expression-language": "~2.6",
"symfony/phpunit-bridge": "~2.7",
"symfony/stopwatch": "~2.3"
},
"suggest": {
@ -5050,28 +5048,25 @@
],
"description": "Symfony EventDispatcher Component",
"homepage": "https://symfony.com",
"time": "2015-09-22 13:49:29"
"time": "2015-10-11 09:39:48"
},
{
"name": "symfony/filesystem",
"version": "v2.7.5",
"version": "v2.7.6",
"source": {
"type": "git",
"url": "https://github.com/symfony/filesystem.git",
"reference": "a17f8a17c20e8614c15b8e116e2f4bcde102cfab"
"reference": "56fd6df73be859323ff97418d97edc1d756df6df"
},
"dist": {
"type": "zip",
"url": "https://api.github.com/repos/symfony/filesystem/zipball/a17f8a17c20e8614c15b8e116e2f4bcde102cfab",
"reference": "a17f8a17c20e8614c15b8e116e2f4bcde102cfab",
"url": "https://api.github.com/repos/symfony/filesystem/zipball/56fd6df73be859323ff97418d97edc1d756df6df",
"reference": "56fd6df73be859323ff97418d97edc1d756df6df",
"shasum": ""
},
"require": {
"php": ">=5.3.9"
},
"require-dev": {
"symfony/phpunit-bridge": "~2.7"
},
"type": "library",
"extra": {
"branch-alias": {
@ -5099,7 +5094,7 @@
],
"description": "Symfony Filesystem Component",
"homepage": "https://symfony.com",
"time": "2015-09-09 17:42:36"
"time": "2015-10-18 20:23:18"
},
{
"name": "symfony/finder",
@ -6494,16 +6489,16 @@
},
{
"name": "phpunit/phpunit",
"version": "4.8.13",
"version": "4.8.16",
"source": {
"type": "git",
"url": "https://github.com/sebastianbergmann/phpunit.git",
"reference": "be067d6105286b74272facefc2697038f8807b77"
"reference": "625f8c345606ed0f3a141dfb88f4116f0e22978e"
},
"dist": {
"type": "zip",
"url": "https://api.github.com/repos/sebastianbergmann/phpunit/zipball/be067d6105286b74272facefc2697038f8807b77",
"reference": "be067d6105286b74272facefc2697038f8807b77",
"url": "https://api.github.com/repos/sebastianbergmann/phpunit/zipball/625f8c345606ed0f3a141dfb88f4116f0e22978e",
"reference": "625f8c345606ed0f3a141dfb88f4116f0e22978e",
"shasum": ""
},
"require": {
@ -6562,7 +6557,7 @@
"testing",
"xunit"
],
"time": "2015-10-14 13:49:40"
"time": "2015-10-23 06:48:33"
},
{
"name": "phpunit/phpunit-mock-objects",
@ -6993,16 +6988,16 @@
},
{
"name": "symfony/browser-kit",
"version": "v2.7.5",
"version": "v2.7.6",
"source": {
"type": "git",
"url": "https://github.com/symfony/browser-kit.git",
"reference": "277a2457776d4cc25706fbdd9d1e4ab2dac884e4"
"reference": "07d664a052572ccc28eb2ab7dbbe82155b1ad367"
},
"dist": {
"type": "zip",
"url": "https://api.github.com/repos/symfony/browser-kit/zipball/277a2457776d4cc25706fbdd9d1e4ab2dac884e4",
"reference": "277a2457776d4cc25706fbdd9d1e4ab2dac884e4",
"url": "https://api.github.com/repos/symfony/browser-kit/zipball/07d664a052572ccc28eb2ab7dbbe82155b1ad367",
"reference": "07d664a052572ccc28eb2ab7dbbe82155b1ad367",
"shasum": ""
},
"require": {
@ -7011,8 +7006,7 @@
},
"require-dev": {
"symfony/css-selector": "~2.0,>=2.0.5",
"symfony/phpunit-bridge": "~2.7",
"symfony/process": "~2.0,>=2.0.5"
"symfony/process": "~2.3.34|~2.7,>=2.7.6"
},
"suggest": {
"symfony/process": ""
@ -7044,28 +7038,25 @@
],
"description": "Symfony BrowserKit Component",
"homepage": "https://symfony.com",
"time": "2015-09-06 08:36:38"
"time": "2015-10-23 14:47:27"
},
{
"name": "symfony/css-selector",
"version": "v2.7.5",
"version": "v2.7.6",
"source": {
"type": "git",
"url": "https://github.com/symfony/css-selector.git",
"reference": "abe19cc0429a06be0c133056d1f9859854860970"
"reference": "e1b865b26be4a56d22a8dee398375044a80c865b"
},
"dist": {
"type": "zip",
"url": "https://api.github.com/repos/symfony/css-selector/zipball/abe19cc0429a06be0c133056d1f9859854860970",
"reference": "abe19cc0429a06be0c133056d1f9859854860970",
"url": "https://api.github.com/repos/symfony/css-selector/zipball/e1b865b26be4a56d22a8dee398375044a80c865b",
"reference": "e1b865b26be4a56d22a8dee398375044a80c865b",
"shasum": ""
},
"require": {
"php": ">=5.3.9"
},
"require-dev": {
"symfony/phpunit-bridge": "~2.7"
},
"type": "library",
"extra": {
"branch-alias": {
@ -7097,28 +7088,27 @@
],
"description": "Symfony CssSelector Component",
"homepage": "https://symfony.com",
"time": "2015-09-22 13:49:29"
"time": "2015-10-11 09:39:48"
},
{
"name": "symfony/dom-crawler",
"version": "v2.7.5",
"version": "v2.7.6",
"source": {
"type": "git",
"url": "https://github.com/symfony/dom-crawler.git",
"reference": "2e185ca136399f902b948694987e62c80099c052"
"reference": "5fef7d8b80d8f9992df99d8ee283f420484c9612"
},
"dist": {
"type": "zip",
"url": "https://api.github.com/repos/symfony/dom-crawler/zipball/2e185ca136399f902b948694987e62c80099c052",
"reference": "2e185ca136399f902b948694987e62c80099c052",
"url": "https://api.github.com/repos/symfony/dom-crawler/zipball/5fef7d8b80d8f9992df99d8ee283f420484c9612",
"reference": "5fef7d8b80d8f9992df99d8ee283f420484c9612",
"shasum": ""
},
"require": {
"php": ">=5.3.9"
},
"require-dev": {
"symfony/css-selector": "~2.3",
"symfony/phpunit-bridge": "~2.7"
"symfony/css-selector": "~2.3"
},
"suggest": {
"symfony/css-selector": ""
@ -7150,28 +7140,25 @@
],
"description": "Symfony DomCrawler Component",
"homepage": "https://symfony.com",
"time": "2015-09-20 21:13:58"
"time": "2015-10-11 09:39:48"
},
{
"name": "symfony/yaml",
"version": "v2.7.5",
"version": "v2.7.6",
"source": {
"type": "git",
"url": "https://github.com/symfony/yaml.git",
"reference": "31cb2ad0155c95b88ee55fe12bc7ff92232c1770"
"reference": "eca9019c88fbe250164affd107bc8057771f3f4d"
},
"dist": {
"type": "zip",
"url": "https://api.github.com/repos/symfony/yaml/zipball/31cb2ad0155c95b88ee55fe12bc7ff92232c1770",
"reference": "31cb2ad0155c95b88ee55fe12bc7ff92232c1770",
"url": "https://api.github.com/repos/symfony/yaml/zipball/eca9019c88fbe250164affd107bc8057771f3f4d",
"reference": "eca9019c88fbe250164affd107bc8057771f3f4d",
"shasum": ""
},
"require": {
"php": ">=5.3.9"
},
"require-dev": {
"symfony/phpunit-bridge": "~2.7"
},
"type": "library",
"extra": {
"branch-alias": {
@ -7199,7 +7186,7 @@
],
"description": "Symfony Yaml Component",
"homepage": "https://symfony.com",
"time": "2015-09-14 14:14:09"
"time": "2015-10-11 09:39:48"
}
],
"aliases": [],

View File

@ -0,0 +1,44 @@
<?php
use Illuminate\Database\Schema\Blueprint;
use Illuminate\Database\Migrations\Migration;
class AddDefaultQuoteTerms extends Migration {
/**
* Run the migrations.
*
* @return void
*/
public function up()
{
Schema::table('accounts', function($table)
{
$table->text('quote_terms')->nullable();
});
$accounts = DB::table('accounts')
->orderBy('id')
->get(['id', 'invoice_terms']);
foreach ($accounts as $account) {
DB::table('accounts')
->where('id', $account->id)
->update(['quote_terms' => $account->invoice_terms]);
}
}
/**
* Reverse the migrations.
*
* @return void
*/
public function down()
{
Schema::table('accounts', function($table)
{
$table->dropColumn('quote_terms');
});
}
}

View File

@ -194,7 +194,6 @@ return array(
'email_paid' => 'Email me when an invoice is <b>paid</b>',
'site_updates' => 'Site Updates',
'custom_messages' => 'Custom Messages',
'default_invoice_terms' => 'Set default <b>invoice terms</b>',
'default_email_footer' => 'Set default <b>email signature</b>',
'import_clients' => 'Import Client Data',
'csv_file' => 'Select CSV file',
@ -535,7 +534,6 @@ return array(
'match_address' => '*Address must match address associated with credit card.',
'click_once' => '*Please click "PAY NOW" only once - transaction may take up to 1 minute to process.',
'default_invoice_footer' => 'Set default <b>invoice footer</b>',
'invoice_footer' => 'Invoice Footer',
'save_as_default_footer' => 'Save as default footer',
@ -884,6 +882,11 @@ return array(
'payment' => 'Payment',
'system' => 'System',
'signature' => 'Email Signature',
'default_messages' => 'Default Messages',
'quote_terms' => 'Quote Terms',
'default_quote_terms' => 'Default Quote Terms',
'default_invoice_terms' => 'Default Invoice Terms',
'default_invoice_footer' => 'Default Invoice Footer',
);

View File

@ -33,7 +33,9 @@
{!! Former::text('vat_number') !!}
{!! Former::text('work_email') !!}
{!! Former::text('work_phone') !!}
{!! Former::file('logo')->max(2, 'MB')->accept('image')->inlineHelp(trans('texts.logo_help')) !!}
{!! Former::textarea('email_footer')->label(trans('texts.signature'))->rows(4) !!}
{!! Former::file('logo')->max(2, 'MB')->accept('image')->inlineHelp(trans('texts.logo_help')) !!}
@if ($account->hasLogo())
<center>

View File

@ -127,7 +127,6 @@
</div>
</div>
<div class="panel panel-default">
<div class="panel-heading">
<h3 class="panel-title">{!! trans('texts.custom_fields') !!}</h3>
@ -190,6 +189,46 @@
</div>
</div>
<div class="panel panel-default">
<div class="panel-heading">
<h3 class="panel-title">{!! trans('texts.default_messages') !!}</h3>
</div>
<div class="panel-body form-padding-right">
<div role="tabpanel">
<ul class="nav nav-tabs" role="tablist" style="border: none">
<li role="presentation" class="active"><a href="#invoiceTerms" aria-controls="invoiceTerms" role="tab" data-toggle="tab">{{ trans('texts.invoice_terms') }}</a></li>
<li role="presentation"><a href="#invoiceFooter" aria-controls="invoiceFooter" role="tab" data-toggle="tab">{{ trans('texts.invoice_footer') }}</a></li>
<li role="presentation"><a href="#quoteTerms" aria-controls="quoteTerms" role="tab" data-toggle="tab">{{ trans('texts.quote_terms') }}</a></li>
</ul>
</div>
<div class="tab-content">
<div role="tabpanel" class="tab-pane active" id="invoiceTerms">
<div class="panel-body">
{!! Former::textarea('invoice_terms')
->label(trans('texts.default_invoice_terms'))
->rows(4) !!}
</div>
</div>
<div role="tabpanel" class="tab-pane" id="invoiceFooter">
<div class="panel-body">
{!! Former::textarea('invoice_footer')
->label(trans('texts.default_invoice_footer'))
->rows(4) !!}
</div>
</div>
<div role="tabpanel" class="tab-pane" id="quoteTerms">
<div class="panel-body">
{!! Former::textarea('quote_terms')
->label(trans('texts.default_quote_terms'))
->rows(4) !!}
</div>
</div>
</div>
</div>
</div>
@if (Auth::user()->isPro())
<center>

View File

@ -48,20 +48,7 @@
</div>
</div>
-->
<div class="panel panel-default">
<div class="panel-heading">
<h3 class="panel-title">{!! trans('texts.custom_messages') !!}</h3>
</div>
<div class="panel-body">
{!! Former::textarea('invoice_terms')->label(trans('texts.default_invoice_terms'))->rows(4)
->onchange("$('#invoice_terms').val(wordWrapText($('#invoice_terms').val(), 300))") !!}
{!! Former::textarea('invoice_footer')->label(trans('texts.default_invoice_footer'))->rows(4)
->onchange("$('#invoice_footer').val(wordWrapText($('#invoice_footer').val(), 600))") !!}
{!! Former::textarea('email_footer')->label(trans('texts.default_email_footer'))->rows(4) !!}
</div>
</div>
{!! Former::actions(
Button::success(trans('texts.save'))
->submit()->large()

View File

@ -225,7 +225,7 @@
<ul class="nav nav-tabs" role="tablist" style="border: none">
<li role="presentation" class="active"><a href="#notes" aria-controls="notes" role="tab" data-toggle="tab">{{ trans('texts.note_to_client') }}</a></li>
<li role="presentation"><a href="#terms" aria-controls="terms" role="tab" data-toggle="tab">{{ trans('texts.invoice_terms') }}</a></li>
<li role="presentation"><a href="#terms" aria-controls="terms" role="tab" data-toggle="tab">{{ trans("texts.{$entityType}_terms") }}</a></li>
<li role="presentation"><a href="#footer" aria-controls="footer" role="tab" data-toggle="tab">{{ trans('texts.invoice_footer') }}</a></li>
</ul>
@ -845,7 +845,7 @@
@if (!$invoice)
if (!invoice.terms) {
invoice.terms = wordWrapText('{!! str_replace(["\r\n","\r","\n"], '\n', addslashes($account->invoice_terms)) !!}', 300);
invoice.terms = wordWrapText('{!! str_replace(["\r\n","\r","\n"], '\n', addslashes($account->{"{$entityType}e_terms"})) !!}', 300);
}
if (!invoice.invoice_footer) {
invoice.invoice_footer = wordWrapText('{!! str_replace(["\r\n","\r","\n"], '\n', addslashes($account->invoice_footer)) !!}', 600);
@ -1011,7 +1011,7 @@
}
function onMarkClick() {
submitBulkAction('mark');
submitBulkAction('markSent');
}
function onCloneClick() {

View File

@ -202,8 +202,8 @@ function InvoiceModel(data) {
self.is_amount_discount = ko.observable(0);
self.frequency_id = ko.observable(4); // default to monthly
self.terms = ko.observable('');
self.default_terms = ko.observable(account.invoice_terms);
self.terms_placeholder = ko.observable({{ !$invoice->id && $account->invoice_terms ? 'account.invoice_terms' : false}});
self.default_terms = ko.observable(account.{{ $entityType }}_terms);
self.terms_placeholder = ko.observable({{ !$invoice->id && $account->{"{$entityType}_terms"} ? "account.{$entityType}_terms" : false}});
self.set_default_terms = ko.observable(false);
self.invoice_footer = ko.observable('');
self.default_footer = ko.observable(account.invoice_footer);

View File

@ -5,7 +5,6 @@
{!! Former::open($entityType . 's/bulk')->addClass('listForm') !!}
<div style="display:none">
{!! Former::text('action') !!}
{!! Former::text('statusId') !!}
{!! Former::text('public_id') !!}
</div>
@ -84,10 +83,9 @@
submitForm('convert');
}
function markEntity(id, statusId) {
function markEntity(id) {
$('#public_id').val(id);
$('#statusId').val(statusId);
submitForm('mark');
submitForm('markSent');
}
function stopTask(id) {