1
0
mirror of https://github.com/invoiceninja/invoiceninja.git synced 2024-11-08 12:12:48 +01:00

bug fixes

This commit is contained in:
Hillel Coren 2014-01-22 09:11:33 +00:00
parent 5b13f2d8ef
commit 6f9a04ca64
4 changed files with 51 additions and 35 deletions

View File

@ -203,9 +203,11 @@ class AccountController extends \BaseController {
$count = 0;
$hasHeaders = Input::get('header_checkbox');
$countries = Country::remember(DEFAULT_QUERY_CACHE)->all();
$countries = Country::remember(DEFAULT_QUERY_CACHE)->get();
$countryMap = [];
foreach ($countries as $country) {
foreach ($countries as $country)
{
$countryMap[strtolower($country->name)] = $country->id;
}
@ -219,6 +221,7 @@ class AccountController extends \BaseController {
$client = Client::createNew();
$contact = Contact::createNew();
$contact->is_primary = true;
$count++;
foreach ($row as $index => $value)
@ -226,56 +229,56 @@ class AccountController extends \BaseController {
$field = $map[$index];
$value = trim($value);
if ($field == Client::$fieldName)
if ($field == Client::$fieldName && !$client->name)
{
$client->name = $value;
}
else if ($field == Client::$fieldPhone)
else if ($field == Client::$fieldPhone && !$client->work_phone)
{
$client->work_phone = $value;
}
else if ($field == Client::$fieldAddress1)
else if ($field == Client::$fieldAddress1 && !$client->address1)
{
$client->address1 = $value;
}
else if ($field == Client::$fieldAddress2)
else if ($field == Client::$fieldAddress2 && !$client->address2)
{
$client->address2 = $value;
}
else if ($field == Client::$fieldCity)
else if ($field == Client::$fieldCity && !$client->city)
{
$client->city = $value;
}
else if ($field == Client::$fieldState)
else if ($field == Client::$fieldState && !$client->state)
{
$client->state = $value;
}
else if ($field == Client::$fieldPostalCode)
else if ($field == Client::$fieldPostalCode && !$client->postal_code)
{
$client->postal_code = $value;
}
else if ($field == Client::$fieldCountry)
else if ($field == Client::$fieldCountry && !$client->country_id)
{
$value = strtolower($value);
$client->country_id = isset($countryMap[$value]) ? $countryMap[$value] : null;
}
else if ($field == Client::$fieldNotes)
else if ($field == Client::$fieldNotes && !$client->private_notes)
{
$client->notes = $value;
$client->private_notes = $value;
}
else if ($field == Contact::$fieldFirstName)
else if ($field == Contact::$fieldFirstName && !$contact->first_name)
{
$contact->first_name = $value;
}
else if ($field == Contact::$fieldLastName)
else if ($field == Contact::$fieldLastName && !$contact->last_name)
{
$contact->last_name = $value;
}
else if ($field == Contact::$fieldPhone)
else if ($field == Contact::$fieldPhone && !$contact->phone)
{
$contact->phone = $value;
}
else if ($field == Contact::$fieldEmail)
else if ($field == Contact::$fieldEmail && !$contact->email)
{
$contact->email = $value;
}
@ -347,10 +350,10 @@ class AccountController extends \BaseController {
'mobile' => Contact::$fieldPhone,
'phone' => Client::$fieldPhone,
'name|organization' => Client::$fieldName,
'address|address1' => Client::$fieldAddress1,
'address2' => Client::$fieldAddress2,
'street|address|address1' => Client::$fieldAddress1,
'street2|address2' => Client::$fieldAddress2,
'city' => Client::$fieldCity,
'state' => Client::$fieldState,
'state|province' => Client::$fieldState,
'zip|postal|code' => Client::$fieldPostalCode,
'country' => Client::$fieldCountry,
'note' => Client::$fieldNotes,
@ -360,6 +363,11 @@ class AccountController extends \BaseController {
{
foreach(explode("|", $search) as $string)
{
if (strpos($title, 'sec') === 0)
{
continue;
}
if (strpos($title, $string) !== false)
{
$mapped[$i] = $column;

View File

@ -55,8 +55,10 @@ Route::get('/send_emails', function() {
});
*/
//Route::get('/', 'HomeController@showComingSoon');
Route::get('/', 'HomeController@showWelcome');
Route::get('/', function() {
return Redirect::to('http://signup.invoiceninja.com');
});
Route::get('/rocksteady', 'HomeController@showWelcome');

View File

@ -13,7 +13,7 @@
{{ Former::open($url)->method($method)->addClass('main_form')->rules(array(
'client' => 'required',
'email' => 'required',
'product_key' => 'max:14',
'product_key' => 'max:20',
)); }}
<div data-bind="with: invoice">
@ -47,7 +47,7 @@
<div class="col-lg-8 col-lg-offset-4">
<label for="test" class="checkbox" data-bind="attr: {for: $index() + '_check'}">
<input type="checkbox" value="1" data-bind="checked: send_invoice, attr: {id: $index() + '_check'}">
<span data-bind="text: email.display"/>
<span data-bind="html: email.display"/>
</label>
</div>
</div>
@ -80,7 +80,7 @@
<div class="col-md-3" id="col_2">
{{ Former::text('invoice_number')->label('Invoice #')->data_bind("value: invoice_number, valueUpdate: 'afterkeydown'") }}
{{ Former::text('po_number')->label('PO #')->data_bind("value: po_number, valueUpdate: 'afterkeydown'") }}
{{ Former::text('discount')->data_bind("value: discount, valueUpdate: 'afterkeydown'") }}
{{ Former::text('discount')->data_bind("value: discount, valueUpdate: 'afterkeydown'")->append('%') }}
{{-- Former::select('currency_id')->label('Currency')->addOption('', '')->fromQuery($currencies, 'name', 'id')->data_bind("value: currency_id") --}}
<div class="form-group" style="margin-bottom: 8px">
@ -115,7 +115,7 @@
<td style="min-width:20px;" class="hide-border td-icon">
<i data-bind="visible: actionsVisible() &amp;&amp; $parent.invoice_items().length > 1" class="fa fa-sort"></i>
</td>
<td style="min-width:120px">
<td style="min-width:160px">
{{ Former::text('product_key')->useDatalist(Product::getProductKeys($products), 'key')->onkeyup('onItemChange()')
->raw()->data_bind("value: product_key, valueUpdate: 'afterkeydown'")->addClass('datalist') }}
</td>
@ -1208,7 +1208,7 @@
self.email.display = ko.computed(function() {
var str = '';
if (self.first_name() || self.last_name()) {
str += self.first_name() + ' ' + self.last_name() + ' - ';
str += self.first_name() + ' ' + self.last_name() + '<br/>';
}
return str + self.email();
});

View File

@ -15,23 +15,23 @@ function generatePDF(invoice, checkMath) {
var invoiceDate = invoice.invoice_date ? invoice.invoice_date : '';
var dueDate = invoice.due_date ? invoice.due_date : '';
var marginLeft = 60;
var marginLeft = 50;
var accountTop = 30;
var headerTop = 140;
var headerLeft = 360;
var headerRight = 540;
var headerRight = 550;
var rowHeight = 15;
var tableRowHeight = 20;
var footerLeft = 420;
var tablePadding = 6;
var tableTop = 240;
var tableLeft = 60;
var descriptionLeft = 150;
var unitCostRight = 400;
var qtyRight = 470;
var taxRight = 470;
var lineTotalRight = 540;
var tableLeft = 50;
var descriptionLeft = 162;
var unitCostRight = 410;
var qtyRight = 480;
var taxRight = 480;
var lineTotalRight = 550;
var hasTaxes = false;
@ -297,7 +297,13 @@ function generatePDF(invoice, checkMath) {
console.log('%s %s %s', lineTotalRight, tableLeft, (lineTotalRight-tableLeft));
doc.text(tableLeft, x+16, invoice.public_notes);
doc.text(tableLeft, x+16 + (doc.splitTextToSize(invoice.public_notes, 340).length * rowHeight) + (rowHeight/2), invoice.terms);
if (invoice.terms) {
var termsX = x+16 + (doc.splitTextToSize(invoice.public_notes, 340).length * rowHeight) + (rowHeight/2);
doc.setFontType("bold");
doc.text(tableLeft, termsX, "Terms");
doc.setFontType("normal");
doc.text(tableLeft, termsX + rowHeight, invoice.terms);
}
x += 16;
doc.text(footerLeft, x, 'Subtotal');