From 55e76bcb802e12987d7afa9a79fcf37eaec0d746 Mon Sep 17 00:00:00 2001 From: Kim Keown Date: Sun, 16 Oct 2016 15:42:38 -0600 Subject: [PATCH] Expense Item description - Follow-up to pull request #22 (#23) * mysql.sql suggested revision Line 330 Follow-up for pull request #22: $cl_item_name for expenses.php and expense_edit.php was changed to textarea to allow a larger expense description input area. However, database input size had been overlooked and was fortunately noticed upon review. Updated revision of mysql.sql to replace varchar(255) with a text property to allow a detailed description of the expense. Line 330 `name` text NOT NULL, # expense item name (what is an expense for) * dbinstall.php revision Line 612 Follow-up to pull request #22: Previously expenses.php and expense_edit.php $cl_item_name field was revised to 'textarea' to provide a larger input box and longer description of the expense. However, database character allowance had been overlooked and was fortunately noticed upon review. - Update mysql.sql to replace varchar(255) with the 'text' property to increase allowable entry length. Limit character input via expenses.php and expense_edit.php $cl_item_name textarea 'maxlength'. - Update dbinstall.php with an identical revision. Line 612 Original: `name` varchar(255) NOT NULL, `name` text NOT NULL, * mysql.sql revision Line 330 Follow-up to pull request #22: Previously expenses.php and expense_edit.php $cl_item_name field was revised to 'textarea' to provide a larger input box and longer description of the expense. However, database character allowance had been overlooked and was fortunately noticed upon review. - Update mysql.sql to replace tt_expense_items 'name' property varchar(255) with the text property to increase allowable entry length. Limit character input via expenses.php and expense_edit.php $cl_item_name textarea 'maxlength'. Update dbinstall.php with an identical revision. Line 330 (Original: `name` varchar(255) NOT NULL,) `name` text NOT NULL, * expense_edit.php revision Line 122 Follow-up to pull request #22: Previously expenses.php and expense_edit.php $cl_item_name field was revised to 'textarea' to provide a larger input box and longer expense description. However, database character allowance had been overlooked and was fortunately noticed upon review. Accordingly, the textarea maxlength revision was removed. - Update mysql.sql to replace tt_expense_items 'name' property varchar(255) with the text property to increase allowable entry length. - Update dbinstall.php with an identical revision. - Update expenses.php and expense_edit.php $cl_item_name textarea to include a maxlength property of 800 characters. The expense record is useful for recording any added debit or fixed-rate charge, and a generous character limit will allow a detailed description that can be easily understood in billing logs and reports. Line 122 Original: $form->addInput(array('type'=>'textarea', 'name'=>'item_name','style'=>'width: 250px; height:'.NOTE_INPUT_HEIGHT.'px;','value'=>$cl_item_name)); Revised: $form->addInput(array('type'=>'textarea','maxlength'=>'800','name'=>'item_name','style'=>'width: 250px; height:'.NOTE_INPUT_HEIGHT.'px;','value'=>$cl_item_name)); * expenses.php revision Line 130 Follow-up to pull request #22: Previously expenses.php and expense_edit.php $cl_item_name field was revised to 'textarea' to provide a larger input box and longer expense description. However, database character allowance had been overlooked and was fortunately noticed upon review. Accordingly, the textarea maxlength revision was removed. - Update mysql.sql to replace tt_expense_items 'name' property varchar(255) with the text property to increase allowable entry length. - Update dbinstall.php with an identical revision. - Update expenses.php and expense_edit.php $cl_item_name textarea to include a maxlength property of 800 characters. The expense record is useful for recording any added debit or fixed-rate charge, and a generous character limit will allow for a detailed description that can be easily understood within billing logs and reports. Line 130 Original: $form->addInput(array('type'=>'textarea', 'name'=>'item_name','style'=>'width: 250px; height:'.NOTE_INPUT_HEIGHT.'px;','value'=>$cl_item_name)); Revised: $form->addInput(array('type'=>'textarea','maxlength'=>'800','name'=>'item_name','style'=>'width: 250px; height:'.NOTE_INPUT_HEIGHT.'px;','value'=>$cl_item_name)); --- dbinstall.php | 15 +++++++++++++-- expense_edit.php | 2 +- expenses.php | 2 +- mysql.sql | 6 +++++- 4 files changed, 20 insertions(+), 5 deletions(-) diff --git a/dbinstall.php b/dbinstall.php index 6561649e..9f579947 100755 --- a/dbinstall.php +++ b/dbinstall.php @@ -605,7 +605,18 @@ if ($_POST) { setChange("ALTER TABLE tt_fav_reports ADD COLUMN `show_client` tinyint(4) NOT NULL default '0'"); setChange("ALTER TABLE tt_fav_reports ADD COLUMN `show_invoice` tinyint(4) NOT NULL default '0'"); setChange("ALTER TABLE tt_fav_reports ADD COLUMN `group_by` varchar(20) default NULL"); - setChange("CREATE TABLE `tt_expense_items` (`id` bigint NOT NULL auto_increment, `date` date NOT NULL, `user_id` int(11) NOT NULL, `client_id` int(11) default NULL, `project_id` int(11) default NULL, `name` varchar(255) NOT NULL, `cost` decimal(10,2) default '0.00', `invoice_id` int(11) default NULL, PRIMARY KEY (`id`))"); + + setChange("CREATE TABLE `tt_expense_items` (`id` bigint NOT NULL auto_increment, `date` date NOT NULL, + `user_id` int(11) NOT NULL, `client_id` int(11) default NULL, `project_id` int(11) default NULL, + + /* Kimberly Keown suggested revision to increase character length of expenses.php and expense_edit.php $cl_item_name textarea. + Updated mysql.sql also. + Original: `name` varchar(255) NOT NULL, */ + `name` text NOT NULL, + + `cost` decimal(10,2) default '0.00', `invoice_id` int(11) default NULL, + PRIMARY KEY (`id`))"); + setChange("create index date_idx on tt_expense_items(date)"); setChange("create index user_idx on tt_expense_items(user_id)"); setChange("create index client_idx on tt_expense_items(client_id)"); @@ -785,4 +796,4 @@ if ($_POST) { - \ No newline at end of file + diff --git a/expense_edit.php b/expense_edit.php index 4a32afca..db26f1b6 100644 --- a/expense_edit.php +++ b/expense_edit.php @@ -119,7 +119,7 @@ if (MODE_PROJECTS == $user->tracking_mode || MODE_PROJECTS_AND_TASKS == $user->t 'empty'=>array(''=>$i18n->getKey('dropdown.select')))); } } -$form->addInput(array('type'=>'textarea', 'name'=>'item_name','style'=>'width: 250px; height:'.NOTE_INPUT_HEIGHT.'px;','value'=>$cl_item_name)); +$form->addInput(array('type'=>'textarea','maxlength'=>'800','name'=>'item_name','style'=>'width: 250px; height:'.NOTE_INPUT_HEIGHT.'px;','value'=>$cl_item_name)); $form->addInput(array('type'=>'text','maxlength'=>'40','name'=>'cost','style'=>'width: 100px;','value'=>$cl_cost)); $form->addInput(array('type'=>'datefield','name'=>'date','maxlength'=>'20','value'=>$cl_date)); // Hidden control for record id. diff --git a/expenses.php b/expenses.php index cea13e6b..4cfc0ea5 100644 --- a/expenses.php +++ b/expenses.php @@ -127,7 +127,7 @@ if (MODE_PROJECTS == $user->tracking_mode || MODE_PROJECTS_AND_TASKS == $user->t 'empty'=>array(''=>$i18n->getKey('dropdown.select')))); } } -$form->addInput(array('type'=>'textarea', 'name'=>'item_name','style'=>'width: 250px; height:'.NOTE_INPUT_HEIGHT.'px;','value'=>$cl_item_name)); +$form->addInput(array('type'=>'textarea','maxlength'=>'800','name'=>'item_name','style'=>'width: 250px; height:'.NOTE_INPUT_HEIGHT.'px;','value'=>$cl_item_name)); $form->addInput(array('type'=>'text','maxlength'=>'40','name'=>'cost','style'=>'width: 100px;','value'=>$cl_cost)); $form->addInput(array('type'=>'calendar','name'=>'date','highlight'=>'expenses','value'=>$cl_date)); // calendar $form->addInput(array('type'=>'hidden','name'=>'browser_today','value'=>'')); // User current date, which gets filled in on btn_submit click. diff --git a/mysql.sql b/mysql.sql index a4773775..48a2b0d0 100644 --- a/mysql.sql +++ b/mysql.sql @@ -326,7 +326,11 @@ CREATE TABLE `tt_expense_items` ( `user_id` int(11) NOT NULL, # user id the expense item is reported by `client_id` int(11) default NULL, # client id `project_id` int(11) default NULL, # project id - `name` varchar(255) NOT NULL, # expense item name (what is an expense for) + +# Kimberly Keown suggested revision to increase character length of expenses.php and expense_edit.php $cl_item_name textareas. +# Original: `name` varchar(255) NOT NULL, # expense item name (what is an expense for) + `name` text NOT NULL, # expense item name (what is an expense for) + `cost` decimal(10,2) default '0.00', # item cost (including taxes, etc.) `invoice_id` int(11) default NULL, # invoice id `status` tinyint(4) default '1', # item status -- 2.20.1