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,7 +8,6 @@ class InvoiceInvitationWasEmailed extends Event {
use SerializesModels; use SerializesModels;
public $invoice;
public $invitation; public $invitation;
/** /**
@ -16,9 +15,8 @@ class InvoiceInvitationWasEmailed extends Event {
* *
* @return void * @return void
*/ */
public function __construct($invoice, $invitation) public function __construct($invitation)
{ {
$this->invoice = $invoice;
$this->invitation = $invitation; $this->invitation = $invitation;
} }

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

@ -73,6 +73,14 @@ class Invitation extends EntityModel
return $this->invitation_key; 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() public function markViewed()
{ {
$invoice = $this->invoice; $invoice = $this->invoice;

View File

@ -9,6 +9,8 @@ use App\Events\QuoteWasCreated;
use App\Events\QuoteWasUpdated; use App\Events\QuoteWasUpdated;
use App\Events\InvoiceWasCreated; use App\Events\InvoiceWasCreated;
use App\Events\InvoiceWasUpdated; use App\Events\InvoiceWasUpdated;
use App\Events\InvoiceInvitationWasEmailed;
use App\Events\QuoteInvitationWasEmailed;
class Invoice extends EntityModel implements BalanceAffecting 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'); 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()) { if (!$this->isSent()) {
$this->invoice_status_id = INVOICE_STATUS_SENT; $this->invoice_status_id = INVOICE_STATUS_SENT;
$this->save(); $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() public function markViewed()
@ -166,7 +189,7 @@ class Invoice extends EntityModel implements BalanceAffecting
if ($this->isPaid() && $this->balance > 0) { if ($this->isPaid() && $this->balance > 0) {
$this->invoice_status_id = ($this->balance == $this->amount ? INVOICE_STATUS_SENT : INVOICE_STATUS_PARTIAL); $this->invoice_status_id = ($this->balance == $this->amount ? INVOICE_STATUS_SENT : INVOICE_STATUS_PARTIAL);
$this->save(); $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->invoice_status_id = INVOICE_STATUS_PAID;
$this->save(); $this->save();
} }

View File

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

View File

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

View File

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

View File

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

View File

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

143
composer.lock generated
View File

@ -770,16 +770,16 @@
}, },
{ {
"name": "doctrine/cache", "name": "doctrine/cache",
"version": "v1.4.2", "version": "v1.5.0",
"source": { "source": {
"type": "git", "type": "git",
"url": "https://github.com/doctrine/cache.git", "url": "https://github.com/doctrine/cache.git",
"reference": "8c434000f420ade76a07c64cbe08ca47e5c101ca" "reference": "eb8a73619af4f1c8711e2ce482f5de3643258a1f"
}, },
"dist": { "dist": {
"type": "zip", "type": "zip",
"url": "https://api.github.com/repos/doctrine/cache/zipball/8c434000f420ade76a07c64cbe08ca47e5c101ca", "url": "https://api.github.com/repos/doctrine/cache/zipball/eb8a73619af4f1c8711e2ce482f5de3643258a1f",
"reference": "8c434000f420ade76a07c64cbe08ca47e5c101ca", "reference": "eb8a73619af4f1c8711e2ce482f5de3643258a1f",
"shasum": "" "shasum": ""
}, },
"require": { "require": {
@ -800,8 +800,8 @@
} }
}, },
"autoload": { "autoload": {
"psr-0": { "psr-4": {
"Doctrine\\Common\\Cache\\": "lib/" "Doctrine\\Common\\Cache\\": "lib/Doctrine/Common/Cache"
} }
}, },
"notification-url": "https://packagist.org/downloads/", "notification-url": "https://packagist.org/downloads/",
@ -836,7 +836,7 @@
"cache", "cache",
"caching" "caching"
], ],
"time": "2015-08-31 12:36:41" "time": "2015-10-28 11:27:45"
}, },
{ {
"name": "doctrine/collections", "name": "doctrine/collections",
@ -2057,16 +2057,16 @@
}, },
{ {
"name": "laravel/socialite", "name": "laravel/socialite",
"version": "v2.0.13", "version": "v2.0.14",
"source": { "source": {
"type": "git", "type": "git",
"url": "https://github.com/laravel/socialite.git", "url": "https://github.com/laravel/socialite.git",
"reference": "5995d2c9c60b47362412a84286e2a0707e0db386" "reference": "b15f4be0ac739405120d74b837af423aa71502d9"
}, },
"dist": { "dist": {
"type": "zip", "type": "zip",
"url": "https://api.github.com/repos/laravel/socialite/zipball/5995d2c9c60b47362412a84286e2a0707e0db386", "url": "https://api.github.com/repos/laravel/socialite/zipball/b15f4be0ac739405120d74b837af423aa71502d9",
"reference": "5995d2c9c60b47362412a84286e2a0707e0db386", "reference": "b15f4be0ac739405120d74b837af423aa71502d9",
"shasum": "" "shasum": ""
}, },
"require": { "require": {
@ -2107,7 +2107,7 @@
"laravel", "laravel",
"oauth" "oauth"
], ],
"time": "2015-09-24 20:59:56" "time": "2015-10-16 15:39:46"
}, },
{ {
"name": "laravelcollective/html", "name": "laravelcollective/html",
@ -2245,16 +2245,16 @@
}, },
{ {
"name": "league/oauth1-client", "name": "league/oauth1-client",
"version": "1.6.0", "version": "1.6.1",
"source": { "source": {
"type": "git", "type": "git",
"url": "https://github.com/thephpleague/oauth1-client.git", "url": "https://github.com/thephpleague/oauth1-client.git",
"reference": "4d4edd9b6014f882e319231a9b3351e3a1dfdc81" "reference": "cef3ceda13c78f89c323e4d5e6301c0eb7cea422"
}, },
"dist": { "dist": {
"type": "zip", "type": "zip",
"url": "https://api.github.com/repos/thephpleague/oauth1-client/zipball/4d4edd9b6014f882e319231a9b3351e3a1dfdc81", "url": "https://api.github.com/repos/thephpleague/oauth1-client/zipball/cef3ceda13c78f89c323e4d5e6301c0eb7cea422",
"reference": "4d4edd9b6014f882e319231a9b3351e3a1dfdc81", "reference": "cef3ceda13c78f89c323e4d5e6301c0eb7cea422",
"shasum": "" "shasum": ""
}, },
"require": { "require": {
@ -2304,7 +2304,7 @@
"tumblr", "tumblr",
"twitter" "twitter"
], ],
"time": "2015-08-22 09:49:14" "time": "2015-10-23 04:02:07"
}, },
{ {
"name": "lokielse/omnipay-alipay", "name": "lokielse/omnipay-alipay",
@ -2357,16 +2357,16 @@
}, },
{ {
"name": "maximebf/debugbar", "name": "maximebf/debugbar",
"version": "v1.10.4", "version": "v1.10.5",
"source": { "source": {
"type": "git", "type": "git",
"url": "https://github.com/maximebf/php-debugbar.git", "url": "https://github.com/maximebf/php-debugbar.git",
"reference": "7b2006e6e095126b5a061ec33fca3d90ea8a8219" "reference": "30e53e8a28284b69dd223c9f5ee8957befd72636"
}, },
"dist": { "dist": {
"type": "zip", "type": "zip",
"url": "https://api.github.com/repos/maximebf/php-debugbar/zipball/7b2006e6e095126b5a061ec33fca3d90ea8a8219", "url": "https://api.github.com/repos/maximebf/php-debugbar/zipball/30e53e8a28284b69dd223c9f5ee8957befd72636",
"reference": "7b2006e6e095126b5a061ec33fca3d90ea8a8219", "reference": "30e53e8a28284b69dd223c9f5ee8957befd72636",
"shasum": "" "shasum": ""
}, },
"require": { "require": {
@ -2409,7 +2409,7 @@
"keywords": [ "keywords": [
"debug" "debug"
], ],
"time": "2015-02-05 07:51:20" "time": "2015-10-19 20:35:12"
}, },
{ {
"name": "mfauveau/omnipay-pacnet", "name": "mfauveau/omnipay-pacnet",
@ -4827,24 +4827,23 @@
}, },
{ {
"name": "symfony/class-loader", "name": "symfony/class-loader",
"version": "v2.7.5", "version": "v2.7.6",
"source": { "source": {
"type": "git", "type": "git",
"url": "https://github.com/symfony/class-loader.git", "url": "https://github.com/symfony/class-loader.git",
"reference": "d957ea6295d7016e20d7eff33a6c1deef819c0d4" "reference": "320f8d2a9cdbcbeb24be602c124aae9d998474a4"
}, },
"dist": { "dist": {
"type": "zip", "type": "zip",
"url": "https://api.github.com/repos/symfony/class-loader/zipball/d957ea6295d7016e20d7eff33a6c1deef819c0d4", "url": "https://api.github.com/repos/symfony/class-loader/zipball/320f8d2a9cdbcbeb24be602c124aae9d998474a4",
"reference": "d957ea6295d7016e20d7eff33a6c1deef819c0d4", "reference": "320f8d2a9cdbcbeb24be602c124aae9d998474a4",
"shasum": "" "shasum": ""
}, },
"require": { "require": {
"php": ">=5.3.9" "php": ">=5.3.9"
}, },
"require-dev": { "require-dev": {
"symfony/finder": "~2.0,>=2.0.5", "symfony/finder": "~2.0,>=2.0.5"
"symfony/phpunit-bridge": "~2.7"
}, },
"type": "library", "type": "library",
"extra": { "extra": {
@ -4873,7 +4872,7 @@
], ],
"description": "Symfony ClassLoader Component", "description": "Symfony ClassLoader Component",
"homepage": "https://symfony.com", "homepage": "https://symfony.com",
"time": "2015-08-26 17:56:37" "time": "2015-10-23 14:47:27"
}, },
{ {
"name": "symfony/console", "name": "symfony/console",
@ -4996,16 +4995,16 @@
}, },
{ {
"name": "symfony/event-dispatcher", "name": "symfony/event-dispatcher",
"version": "v2.7.5", "version": "v2.7.6",
"source": { "source": {
"type": "git", "type": "git",
"url": "https://github.com/symfony/event-dispatcher.git", "url": "https://github.com/symfony/event-dispatcher.git",
"reference": "ae4dcc2a8d3de98bd794167a3ccda1311597c5d9" "reference": "87a5db5ea887763fa3a31a5471b512ff1596d9b8"
}, },
"dist": { "dist": {
"type": "zip", "type": "zip",
"url": "https://api.github.com/repos/symfony/event-dispatcher/zipball/ae4dcc2a8d3de98bd794167a3ccda1311597c5d9", "url": "https://api.github.com/repos/symfony/event-dispatcher/zipball/87a5db5ea887763fa3a31a5471b512ff1596d9b8",
"reference": "ae4dcc2a8d3de98bd794167a3ccda1311597c5d9", "reference": "87a5db5ea887763fa3a31a5471b512ff1596d9b8",
"shasum": "" "shasum": ""
}, },
"require": { "require": {
@ -5016,7 +5015,6 @@
"symfony/config": "~2.0,>=2.0.5", "symfony/config": "~2.0,>=2.0.5",
"symfony/dependency-injection": "~2.6", "symfony/dependency-injection": "~2.6",
"symfony/expression-language": "~2.6", "symfony/expression-language": "~2.6",
"symfony/phpunit-bridge": "~2.7",
"symfony/stopwatch": "~2.3" "symfony/stopwatch": "~2.3"
}, },
"suggest": { "suggest": {
@ -5050,28 +5048,25 @@
], ],
"description": "Symfony EventDispatcher Component", "description": "Symfony EventDispatcher Component",
"homepage": "https://symfony.com", "homepage": "https://symfony.com",
"time": "2015-09-22 13:49:29" "time": "2015-10-11 09:39:48"
}, },
{ {
"name": "symfony/filesystem", "name": "symfony/filesystem",
"version": "v2.7.5", "version": "v2.7.6",
"source": { "source": {
"type": "git", "type": "git",
"url": "https://github.com/symfony/filesystem.git", "url": "https://github.com/symfony/filesystem.git",
"reference": "a17f8a17c20e8614c15b8e116e2f4bcde102cfab" "reference": "56fd6df73be859323ff97418d97edc1d756df6df"
}, },
"dist": { "dist": {
"type": "zip", "type": "zip",
"url": "https://api.github.com/repos/symfony/filesystem/zipball/a17f8a17c20e8614c15b8e116e2f4bcde102cfab", "url": "https://api.github.com/repos/symfony/filesystem/zipball/56fd6df73be859323ff97418d97edc1d756df6df",
"reference": "a17f8a17c20e8614c15b8e116e2f4bcde102cfab", "reference": "56fd6df73be859323ff97418d97edc1d756df6df",
"shasum": "" "shasum": ""
}, },
"require": { "require": {
"php": ">=5.3.9" "php": ">=5.3.9"
}, },
"require-dev": {
"symfony/phpunit-bridge": "~2.7"
},
"type": "library", "type": "library",
"extra": { "extra": {
"branch-alias": { "branch-alias": {
@ -5099,7 +5094,7 @@
], ],
"description": "Symfony Filesystem Component", "description": "Symfony Filesystem Component",
"homepage": "https://symfony.com", "homepage": "https://symfony.com",
"time": "2015-09-09 17:42:36" "time": "2015-10-18 20:23:18"
}, },
{ {
"name": "symfony/finder", "name": "symfony/finder",
@ -6494,16 +6489,16 @@
}, },
{ {
"name": "phpunit/phpunit", "name": "phpunit/phpunit",
"version": "4.8.13", "version": "4.8.16",
"source": { "source": {
"type": "git", "type": "git",
"url": "https://github.com/sebastianbergmann/phpunit.git", "url": "https://github.com/sebastianbergmann/phpunit.git",
"reference": "be067d6105286b74272facefc2697038f8807b77" "reference": "625f8c345606ed0f3a141dfb88f4116f0e22978e"
}, },
"dist": { "dist": {
"type": "zip", "type": "zip",
"url": "https://api.github.com/repos/sebastianbergmann/phpunit/zipball/be067d6105286b74272facefc2697038f8807b77", "url": "https://api.github.com/repos/sebastianbergmann/phpunit/zipball/625f8c345606ed0f3a141dfb88f4116f0e22978e",
"reference": "be067d6105286b74272facefc2697038f8807b77", "reference": "625f8c345606ed0f3a141dfb88f4116f0e22978e",
"shasum": "" "shasum": ""
}, },
"require": { "require": {
@ -6562,7 +6557,7 @@
"testing", "testing",
"xunit" "xunit"
], ],
"time": "2015-10-14 13:49:40" "time": "2015-10-23 06:48:33"
}, },
{ {
"name": "phpunit/phpunit-mock-objects", "name": "phpunit/phpunit-mock-objects",
@ -6993,16 +6988,16 @@
}, },
{ {
"name": "symfony/browser-kit", "name": "symfony/browser-kit",
"version": "v2.7.5", "version": "v2.7.6",
"source": { "source": {
"type": "git", "type": "git",
"url": "https://github.com/symfony/browser-kit.git", "url": "https://github.com/symfony/browser-kit.git",
"reference": "277a2457776d4cc25706fbdd9d1e4ab2dac884e4" "reference": "07d664a052572ccc28eb2ab7dbbe82155b1ad367"
}, },
"dist": { "dist": {
"type": "zip", "type": "zip",
"url": "https://api.github.com/repos/symfony/browser-kit/zipball/277a2457776d4cc25706fbdd9d1e4ab2dac884e4", "url": "https://api.github.com/repos/symfony/browser-kit/zipball/07d664a052572ccc28eb2ab7dbbe82155b1ad367",
"reference": "277a2457776d4cc25706fbdd9d1e4ab2dac884e4", "reference": "07d664a052572ccc28eb2ab7dbbe82155b1ad367",
"shasum": "" "shasum": ""
}, },
"require": { "require": {
@ -7011,8 +7006,7 @@
}, },
"require-dev": { "require-dev": {
"symfony/css-selector": "~2.0,>=2.0.5", "symfony/css-selector": "~2.0,>=2.0.5",
"symfony/phpunit-bridge": "~2.7", "symfony/process": "~2.3.34|~2.7,>=2.7.6"
"symfony/process": "~2.0,>=2.0.5"
}, },
"suggest": { "suggest": {
"symfony/process": "" "symfony/process": ""
@ -7044,28 +7038,25 @@
], ],
"description": "Symfony BrowserKit Component", "description": "Symfony BrowserKit Component",
"homepage": "https://symfony.com", "homepage": "https://symfony.com",
"time": "2015-09-06 08:36:38" "time": "2015-10-23 14:47:27"
}, },
{ {
"name": "symfony/css-selector", "name": "symfony/css-selector",
"version": "v2.7.5", "version": "v2.7.6",
"source": { "source": {
"type": "git", "type": "git",
"url": "https://github.com/symfony/css-selector.git", "url": "https://github.com/symfony/css-selector.git",
"reference": "abe19cc0429a06be0c133056d1f9859854860970" "reference": "e1b865b26be4a56d22a8dee398375044a80c865b"
}, },
"dist": { "dist": {
"type": "zip", "type": "zip",
"url": "https://api.github.com/repos/symfony/css-selector/zipball/abe19cc0429a06be0c133056d1f9859854860970", "url": "https://api.github.com/repos/symfony/css-selector/zipball/e1b865b26be4a56d22a8dee398375044a80c865b",
"reference": "abe19cc0429a06be0c133056d1f9859854860970", "reference": "e1b865b26be4a56d22a8dee398375044a80c865b",
"shasum": "" "shasum": ""
}, },
"require": { "require": {
"php": ">=5.3.9" "php": ">=5.3.9"
}, },
"require-dev": {
"symfony/phpunit-bridge": "~2.7"
},
"type": "library", "type": "library",
"extra": { "extra": {
"branch-alias": { "branch-alias": {
@ -7097,28 +7088,27 @@
], ],
"description": "Symfony CssSelector Component", "description": "Symfony CssSelector Component",
"homepage": "https://symfony.com", "homepage": "https://symfony.com",
"time": "2015-09-22 13:49:29" "time": "2015-10-11 09:39:48"
}, },
{ {
"name": "symfony/dom-crawler", "name": "symfony/dom-crawler",
"version": "v2.7.5", "version": "v2.7.6",
"source": { "source": {
"type": "git", "type": "git",
"url": "https://github.com/symfony/dom-crawler.git", "url": "https://github.com/symfony/dom-crawler.git",
"reference": "2e185ca136399f902b948694987e62c80099c052" "reference": "5fef7d8b80d8f9992df99d8ee283f420484c9612"
}, },
"dist": { "dist": {
"type": "zip", "type": "zip",
"url": "https://api.github.com/repos/symfony/dom-crawler/zipball/2e185ca136399f902b948694987e62c80099c052", "url": "https://api.github.com/repos/symfony/dom-crawler/zipball/5fef7d8b80d8f9992df99d8ee283f420484c9612",
"reference": "2e185ca136399f902b948694987e62c80099c052", "reference": "5fef7d8b80d8f9992df99d8ee283f420484c9612",
"shasum": "" "shasum": ""
}, },
"require": { "require": {
"php": ">=5.3.9" "php": ">=5.3.9"
}, },
"require-dev": { "require-dev": {
"symfony/css-selector": "~2.3", "symfony/css-selector": "~2.3"
"symfony/phpunit-bridge": "~2.7"
}, },
"suggest": { "suggest": {
"symfony/css-selector": "" "symfony/css-selector": ""
@ -7150,28 +7140,25 @@
], ],
"description": "Symfony DomCrawler Component", "description": "Symfony DomCrawler Component",
"homepage": "https://symfony.com", "homepage": "https://symfony.com",
"time": "2015-09-20 21:13:58" "time": "2015-10-11 09:39:48"
}, },
{ {
"name": "symfony/yaml", "name": "symfony/yaml",
"version": "v2.7.5", "version": "v2.7.6",
"source": { "source": {
"type": "git", "type": "git",
"url": "https://github.com/symfony/yaml.git", "url": "https://github.com/symfony/yaml.git",
"reference": "31cb2ad0155c95b88ee55fe12bc7ff92232c1770" "reference": "eca9019c88fbe250164affd107bc8057771f3f4d"
}, },
"dist": { "dist": {
"type": "zip", "type": "zip",
"url": "https://api.github.com/repos/symfony/yaml/zipball/31cb2ad0155c95b88ee55fe12bc7ff92232c1770", "url": "https://api.github.com/repos/symfony/yaml/zipball/eca9019c88fbe250164affd107bc8057771f3f4d",
"reference": "31cb2ad0155c95b88ee55fe12bc7ff92232c1770", "reference": "eca9019c88fbe250164affd107bc8057771f3f4d",
"shasum": "" "shasum": ""
}, },
"require": { "require": {
"php": ">=5.3.9" "php": ">=5.3.9"
}, },
"require-dev": {
"symfony/phpunit-bridge": "~2.7"
},
"type": "library", "type": "library",
"extra": { "extra": {
"branch-alias": { "branch-alias": {
@ -7199,7 +7186,7 @@
], ],
"description": "Symfony Yaml Component", "description": "Symfony Yaml Component",
"homepage": "https://symfony.com", "homepage": "https://symfony.com",
"time": "2015-09-14 14:14:09" "time": "2015-10-11 09:39:48"
} }
], ],
"aliases": [], "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>', 'email_paid' => 'Email me when an invoice is <b>paid</b>',
'site_updates' => 'Site Updates', 'site_updates' => 'Site Updates',
'custom_messages' => 'Custom Messages', 'custom_messages' => 'Custom Messages',
'default_invoice_terms' => 'Set default <b>invoice terms</b>',
'default_email_footer' => 'Set default <b>email signature</b>', 'default_email_footer' => 'Set default <b>email signature</b>',
'import_clients' => 'Import Client Data', 'import_clients' => 'Import Client Data',
'csv_file' => 'Select CSV file', 'csv_file' => 'Select CSV file',
@ -535,7 +534,6 @@ return array(
'match_address' => '*Address must match address associated with credit card.', '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.', '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', 'invoice_footer' => 'Invoice Footer',
'save_as_default_footer' => 'Save as default footer', 'save_as_default_footer' => 'Save as default footer',
@ -884,6 +882,11 @@ return array(
'payment' => 'Payment', 'payment' => 'Payment',
'system' => 'System', '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,8 +33,10 @@
{!! Former::text('vat_number') !!} {!! Former::text('vat_number') !!}
{!! Former::text('work_email') !!} {!! Former::text('work_email') !!}
{!! Former::text('work_phone') !!} {!! Former::text('work_phone') !!}
{!! Former::textarea('email_footer')->label(trans('texts.signature'))->rows(4) !!}
{!! Former::file('logo')->max(2, 'MB')->accept('image')->inlineHelp(trans('texts.logo_help')) !!} {!! Former::file('logo')->max(2, 'MB')->accept('image')->inlineHelp(trans('texts.logo_help')) !!}
@if ($account->hasLogo()) @if ($account->hasLogo())
<center> <center>
{!! HTML::image($account->getLogoPath().'?no_cache='.time(), 'Logo', ['width' => 200]) !!} &nbsp; {!! HTML::image($account->getLogoPath().'?no_cache='.time(), 'Logo', ['width' => 200]) !!} &nbsp;

View File

@ -127,7 +127,6 @@
</div> </div>
</div> </div>
<div class="panel panel-default"> <div class="panel panel-default">
<div class="panel-heading"> <div class="panel-heading">
<h3 class="panel-title">{!! trans('texts.custom_fields') !!}</h3> <h3 class="panel-title">{!! trans('texts.custom_fields') !!}</h3>
@ -190,6 +189,46 @@
</div> </div>
</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()) @if (Auth::user()->isPro())
<center> <center>

View File

@ -49,19 +49,6 @@
</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( {!! Former::actions(
Button::success(trans('texts.save')) Button::success(trans('texts.save'))
->submit()->large() ->submit()->large()

View File

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

View File

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

View File

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