config/accounts/sample.ini | 2
config/accounts/test.ini | 7
system/application/assets/css/admin-style.css | 6
system/application/assets/css/custom.css | 62 +
system/application/assets/css/style.css | 6
system/application/assets/js/custom.js | 3
system/application/assets/js/ezpz_tooltip.min.js | 2
system/application/assets/plugins/colorpicker/css/colorpicker.css | 161
+++
system/application/assets/plugins/colorpicker/css/layout.css | 218
++++
system/application/assets/plugins/colorpicker/images/blank.gif |binary
system/application/assets/plugins/colorpicker/images/colorpicker_background.png |binary
system/application/assets/plugins/colorpicker/images/colorpicker_hex.png |binary
system/application/assets/plugins/colorpicker/images/colorpicker_hsb_b.png |binary
system/application/assets/plugins/colorpicker/images/colorpicker_hsb_h.png |binary
system/application/assets/plugins/colorpicker/images/colorpicker_hsb_s.png |binary
system/application/assets/plugins/colorpicker/images/colorpicker_indic.gif |binary
system/application/assets/plugins/colorpicker/images/colorpicker_overlay.png |binary
system/application/assets/plugins/colorpicker/images/colorpicker_rgb_b.png |binary
system/application/assets/plugins/colorpicker/images/colorpicker_rgb_g.png |binary
system/application/assets/plugins/colorpicker/images/colorpicker_rgb_r.png |binary
system/application/assets/plugins/colorpicker/images/colorpicker_select.gif |binary
system/application/assets/plugins/colorpicker/images/colorpicker_submit.png |binary
system/application/assets/plugins/colorpicker/images/custom_background.png |binary
system/application/assets/plugins/colorpicker/images/custom_hex.png |binary
system/application/assets/plugins/colorpicker/images/custom_hsb_b.png |binary
system/application/assets/plugins/colorpicker/images/custom_hsb_h.png |binary
system/application/assets/plugins/colorpicker/images/custom_hsb_s.png |binary
system/application/assets/plugins/colorpicker/images/custom_indic.gif |binary
system/application/assets/plugins/colorpicker/images/custom_rgb_b.png |binary
system/application/assets/plugins/colorpicker/images/custom_rgb_g.png |binary
system/application/assets/plugins/colorpicker/images/custom_rgb_r.png |binary
system/application/assets/plugins/colorpicker/images/custom_submit.png |binary
system/application/assets/plugins/colorpicker/images/select.png |binary
system/application/assets/plugins/colorpicker/images/select2.png |binary
system/application/assets/plugins/colorpicker/images/slider.png |binary
system/application/assets/plugins/colorpicker/js/colorpicker.js | 484
++++++++++
system/application/assets/plugins/colorpicker/js/eye.js | 34
system/application/assets/plugins/colorpicker/js/layout.js | 67 +
system/application/assets/plugins/colorpicker/js/startup.js | 43
system/application/assets/plugins/colorpicker/js/utils.js | 252
+++++
system/application/controllers/account.php | 4
system/application/controllers/admin/active.php | 16
system/application/controllers/admin/carryforward.sql | 93 -
system/application/controllers/admin/create.php | 64 +
system/application/controllers/admin/database.sql | 110
--
system/application/controllers/admin/initialize.sql | 16
system/application/controllers/admin/manage.php | 32
system/application/controllers/admin/schema.sql | 93 +
system/application/controllers/admin/setting.php | 8
system/application/controllers/admin/welcome.php | 22
system/application/controllers/group.php | 32
system/application/controllers/help.php | 13
system/application/controllers/ledger.php | 30
system/application/controllers/report.php | 2
system/application/controllers/setting.php | 125
+-
system/application/controllers/tag.php | 38
system/application/controllers/voucher.php | 230
++++
system/application/controllers/welcome.php | 6
system/application/helpers/MY_date_helper.php | 20
system/application/helpers/MY_form_helper.php | 10
system/application/helpers/custom_helper.php | 2
system/application/libraries/MY_Form_validation.php | 2
system/application/libraries/Startup.php | 29
system/application/models/ledger_model.php | 24
system/application/views/admin/status.php | 7
system/application/views/group/add.php | 4
system/application/views/group/edit.php | 3
system/application/views/help/index.php | 34
system/application/views/ledger/add.php | 3
system/application/views/ledger/edit.php | 3
system/application/views/report/balancesheet.php | 2
system/application/views/report/profitandloss.php | 5
system/application/views/setting/printer.php | 17
system/application/views/tag/add.php | 4
system/application/views/tag/edit.php | 4
system/application/views/template.php | 8
system/application/views/voucher/add.php | 26
system/application/views/voucher/edit.php | 26
system/application/views/voucher/index.php | 25
system/application/views/welcome.php | 194
++++
system/application/views/welcome_message.php | 194
----
81 files changed, 2292 insertions(+), 635 deletions(-)
New commits:
commit 3483017e6ce547668a2b8970250d0e17b7406320
Author: Prashant P Shah <pshah.mumbai(a)gmail.com>
Date: Sun Jan 2 12:22:26 2011 +0530
Removed unwanted account config file
Signed-off-by: Prashant P Shah <pshah.mumbai(a)gmail.com>
diff --git a/config/accounts/sample.ini b/config/accounts/sample.ini
index 2f8fa22..0fed3c4 100644
--- a/config/accounts/sample.ini
+++ b/config/accounts/sample.ini
@@ -1,7 +1,7 @@
[database]
db_hostname = "localhost"
db_port = "3306"
-db_name = "wz_webzash"
+db_name = "webzash"
db_username = "root"
db_password = ""
diff --git a/config/accounts/test.ini b/config/accounts/test.ini
deleted file mode 100644
index c04d401..0000000
--- a/config/accounts/test.ini
+++ /dev/null
@@ -1,7 +0,0 @@
-[database]
-db_hostname = "localhost"
-db_port = "3306"
-db_name = "testing"
-db_username = "root"
-db_password = ""
-
commit 0b557582bc72c72f8bdd87e30532b4998e66fa7c
Author: Prashant P Shah <pshah.mumbai(a)gmail.com>
Date: Sun Jan 2 12:13:07 2011 +0530
Added default voucher type to custom helper functions
Signed-off-by: Prashant P Shah <pshah.mumbai(a)gmail.com>
diff --git a/system/application/controllers/voucher.php
b/system/application/controllers/voucher.php
index 4752758..4d1345c 100644
--- a/system/application/controllers/voucher.php
+++ b/system/application/controllers/voucher.php
@@ -116,7 +116,7 @@ class Voucher extends Controller {
$config['last_tag_open'] = '<li class="last">';
$config['last_tag_close'] = '</li>';
- if ($voucher_type_int > 5)
+ if (($voucher_type_int < 0) || ($voucher_type_int > 4))
{
$this->messages->add('Invalid voucher type.', 'error');
redirect('voucher/show/all');
diff --git a/system/application/helpers/custom_helper.php
b/system/application/helpers/custom_helper.php
index 5a3617f..7bb13ce 100644
--- a/system/application/helpers/custom_helper.php
+++ b/system/application/helpers/custom_helper.php
@@ -115,6 +115,7 @@ if ( ! function_exists('n_to_v'))
case 2: return "payment"; break;
case 3: return "contra"; break;
case 4: return "journal"; break;
+ default: return ""; break;
}
}
}
@@ -138,6 +139,7 @@ if ( ! function_exists('v_to_n'))
case "payment": return 2; break;
case "contra": return 3; break;
case "journal": return 4; break;
+ default: return 0; break;
}
}
}
commit dfa9985ddeb0264e4ad7749b35ef5a08056a2931
Author: Prashant P Shah <pshah.mumbai(a)gmail.com>
Date: Fri Dec 31 19:34:34 2010 +0530
Cleanup of html table alignments
Signed-off-by: Prashant P Shah <pshah.mumbai(a)gmail.com>
diff --git a/system/application/controllers/admin/create.php
b/system/application/controllers/admin/create.php
index ebd9a36..7b864aa 100644
--- a/system/application/controllers/admin/create.php
+++ b/system/application/controllers/admin/create.php
@@ -285,7 +285,7 @@ class Create extends Controller {
{
if (strlen($row) < 5)
continue;
- $newacc->query($row); var_dump($newacc->_error_message());
+ $newacc->query($row);
if ($newacc->_error_message() != "")
{
$newacc->trans_rollback();
diff --git a/system/application/views/report/balancesheet.php
b/system/application/views/report/balancesheet.php
index d9b40ad..2330189 100644
--- a/system/application/views/report/balancesheet.php
+++ b/system/application/views/report/balancesheet.php
@@ -42,7 +42,7 @@
$total = $liability_total;
- echo "<tr class=\"total-area\">";
+ echo "<tr valign=\"top\" class=\"total-area\">";
echo "<td>";
echo "<table border=0 cellpadding=5
class=\"balance-sheet-total-table\" width=\"100%\">";
echo "<tr valign=\"top\">";
diff --git a/system/application/views/report/profitandloss.php
b/system/application/views/report/profitandloss.php
index e21baf9..8e71052 100644
--- a/system/application/views/report/profitandloss.php
+++ b/system/application/views/report/profitandloss.php
@@ -47,7 +47,7 @@
/* Showing Gross P/L : Expenses */
$grosstotal = $gross_expense_total;
- echo "<tr class=\"total-area\">";
+ echo "<tr valign=\"top\" class=\"total-area\">";
echo "<td>";
echo "<table border=0 cellpadding=5 class=\"simple-table
profit-loss-total-table\" width=\"100%\">";
echo "<tr valign=\"top\">";
@@ -113,6 +113,7 @@
/* Net P/L : Expenses */
$net_expense_total = 0;
$net_expense_list_q = $this->db->query("SELECT * FROM groups WHERE parent_id
= 4 AND affects_gross != 1");
+ echo "<tr valign=\"top\">";
echo "<td>";
echo "<table border=0 cellpadding=5 class=\"simple-table
profit-loss-table\" width=\"100%\">";
echo "<thead><tr><th>Expenses (Net)</th><th
align=\"right\">Amount</th></tr></thead>";
@@ -150,7 +151,7 @@
/* Showing Net P/L : Expenses */
$nettotal = $net_expense_total;
- echo "<tr class=\"total-area\">";
+ echo "<tr valign=\"top\" class=\"total-area\">";
echo "<td>";
echo "<table border=0 cellpadding=5 class=\"simple-table
profit-loss-total-table\" width=\"100%\">";
echo "<tr valign=\"top\">";
commit 2fd54d856d2c17b04a917e3da4299b4c262c962c
Author: Prashant P Shah <pshah.mumbai(a)gmail.com>
Date: Fri Dec 31 18:42:38 2010 +0530
Cleanup of status message and welcome.php view file
Signed-off-by: Prashant P Shah <pshah.mumbai(a)gmail.com>
diff --git a/system/application/controllers/welcome.php
b/system/application/controllers/welcome.php
index f85e5af..633df35 100644
--- a/system/application/controllers/welcome.php
+++ b/system/application/controllers/welcome.php
@@ -63,7 +63,7 @@ class Welcome extends Controller {
/* Getting Log Messages */
$data['logs'] = $this->logger->read_recent_messages();
- $this->template->load('template', 'welcome_message', $data);
+ $this->template->load('template', 'welcome', $data);
return;
}
}
diff --git a/system/application/libraries/Startup.php
b/system/application/libraries/Startup.php
index dd5c724..3e00ad9 100644
--- a/system/application/libraries/Startup.php
+++ b/system/application/libraries/Startup.php
@@ -128,7 +128,7 @@ class Startup
$account_q = $CI->db->query('SELECT * FROM settings WHERE id = 1');
if ( ! ($account_d = $account_q->row()))
{
- $CI->messages->add('Invalid account details.', 'error');
+ $CI->messages->add('Invalid account settings.', 'error');
redirect('admin');
}
$CI->config->set_item('account_name', $account_d->name);
diff --git a/system/application/views/welcome.php b/system/application/views/welcome.php
new file mode 100644
index 0000000..9c0f59b
--- /dev/null
+++ b/system/application/views/welcome.php
@@ -0,0 +1,194 @@
+<style type="text/css">
+ #income-expense-graph-header {
+ width: 200px;
+ text-align: center;
+ padding-bottom:30px;
+ }
+ #income-expense-graph-data {
+ width: 200px;
+ height: 200px;
+ text-align: center;
+ }
+ #asset-liability-graph-header {
+ width: 200px;
+ text-align: center;
+ padding-bottom:30px;
+ }
+ #asset-liability-graph-data {
+ width: 200px;
+ height: 200px;
+ text-align: center;
+ }
+</style>
+
+<script type="text/javascript">
+jQuery(document).ready(function () {
+ jQuery('#income-expense-graph-data').tufteBar({
+ data: [
+ // First element is the y-value
+ // Other elements are arbitary - they are not used by the lib
+ // but are passed back into callback functions
+ [<?php echo -$income_total; ?>, {label: 'Incomes'}],
+ [<?php echo $expense_total; ?>, {label: 'Expenses'}]
+ ],
+
+ // Bar width in arbitrary units, 1.0 means the bars will be snuggled
+ // up next to each other
+ barWidth: 0.5,
+
+ // The label on top of the bar - can contain HTML
+ // formatNumber inserts commas as thousands separators in a number
+ barLabel: function(index) {
+ return $.tufteBar.formatNumber(this[0])
+ },
+
+ // The label on the x-axis - can contain HTML
+ axisLabel: function(index) { return this[1].label },
+
+ // The color of the bar
+ color: function(index) {
+ return ['#33CC66', '#C00000'][index % 2]
+ },
+ });
+
+ jQuery('#asset-liability-graph-data').tufteBar({
+ data: [
+ // First element is the y-value
+ // Other elements are arbitary - they are not used by the lib
+ // but are passed back into callback functions
+ [<?php echo $asset_total; ?>, {label: 'Assets'}],
+ [<?php echo -$liability_total; ?>, {label: 'Liabilities'}]
+ ],
+
+ // Bar width in arbitrary units, 1.0 means the bars will be snuggled
+ // up next to each other
+ barWidth: 0.5,
+
+ // The label on top of the bar - can contain HTML
+ // formatNumber inserts commas as thousands separators in a number
+ barLabel: function(index) {
+ return $.tufteBar.formatNumber(this[0])
+ },
+
+ // The label on the x-axis - can contain HTML
+ axisLabel: function(index) { return this[1].label },
+
+ // The color of the bar
+ color: function(index) {
+ return ['#33CC66', '#C00000'][index % 2]
+ },
+ });
+});
+</script>
+<div id="dashboard-summary">
+ <div id="dashboard-welcome-back" class="dashboard-item">
+ <div class="dashboard-title">Account Summary</div>
+ <div class="dashboard-content">
+ <table class="dashboard-summary-table">
+ <tbody>
+ <tr>
+ <td><div>Welcome back, <strong><?php echo
$this->config->item('account_name');?>
!</strong></div></td>
+ </tr>
+ <tr>
+ <td><div id="dashboard-draft">You have <?php echo
anchor("voucher/show/draft", $draft_count . " draft",
array('class' => 'anchor-link-a')); ?>
voucher(s)</div></td>
+ </tr>
+ </tbody>
+ </table>
+ </div>
+ </div>
+ <div class="clear"></div>
+ <div id="dashboard-cash-bank" class="dashboard-item">
+ <div class="dashboard-title">Bank and Cash A/C's</div>
+ <div class="dashboard-content">
+ <?php
+ if ($bank_cash_account)
+ {
+ echo "<table class=\"dashboard-cashbank-table\">";
+ echo "<tbody>";
+ foreach ($bank_cash_account as $id => $row)
+ {
+ echo "<tr>";
+ echo "<td>" . anchor('report/ledgerst/' .
$row['id'], $row['name'], array('title' => $row['name']
. ' Statement')) . "</td>";
+ echo "<td>" . convert_amount_dc($row['balance']) .
"</td>";
+ echo "</tr>";
+ }
+ echo "</tbody>";
+ echo "</table>";
+ } else {
+ echo "You have not created any bank or cash account";
+ }
+ ?>
+ </div>
+ </div>
+ <div id="dashboard-summary" class="dashboard-item">
+ <div class="dashboard-title">Account Summary</div>
+ <div class="dashboard-content">
+ <?php
+ echo "<table class=\"dashboard-summary-table\">";
+ echo "<tbody>";
+ echo "<tr><td>Assets Total</td><td>" .
convert_amount_dc($asset_total) . "</td></tr>";
+ echo "<tr><td>Liabilities Total</td><td>" .
convert_amount_dc($liability_total) . "</td></tr>";
+ echo "<tr><td>Incomes Total</td><td>" .
convert_amount_dc($income_total) . "</td></tr>";
+ echo "<tr><td>Expenses Total</td><td>" .
convert_amount_dc($expense_total) . "</td></tr>";
+ echo "</tbody>";
+ echo "</table>";
+ ?>
+ </div>
+ </div>
+ <div class="clear"></div>
+ <div>
+ <table border="0">
+ <tbody>
+ <tr>
+ <?php if ($show_income_expense) { ?>
+ <td width="300">
+ <div id="income-expense" class="graph">
+ <div id="income-expense-graph-header"><strong>Incomes Vs
Expenses</strong></div>
+ <div id="income-expense-graph-data"></div>
+ </div>
+ </td>
+ <?php } ?>
+ <?php if ($show_asset_liability) { ?>
+ <td width="300">
+ <div id="asset-liability" class="graph">
+ <div id="asset-liability-graph-header"><strong>Assets Vs
Liabilities</strong></div>
+ <div id="asset-liability-graph-data""></div>
+ </div>
+ </td>
+ <?php } ?>
+ </tr>
+ </tbody>
+ </table>
+ </div>
+</div>
+<div id="dashboard-log">
+ <div id="dashboard-recent-log" class="dashboard-log-item">
+ <div class="dashboard-log-title">Recent Activity <span
class="float-right"><?php echo anchor('log/feed',
img(array('src'=> asset_url() . "images/icons/rss.png",
'border' => '0', 'alt' => 'Log Feed',
'width' => '16px',))); ?></span></div>
+ <div class="dashboard-log-content">
+ <?php
+ if ($logs)
+ {
+ echo "<ul id=\"recent-activity-list\">";
+ foreach ($logs->result() as $row)
+ {
+ echo "<li>" . $row->message_title . "</li>";
+ }
+ echo "</ul>";
+ } else {
+ echo "No Recent Activity";
+ }
+ ?>
+ </div>
+ <?php
+ if ($logs)
+ {
+ echo "<div class=\"dashboard-log-footer\">";
+ echo "<span>";
+ echo anchor("log", "more...", array('class' =>
'anchor-link-a'));
+ echo "</span>";
+ }
+ ?>
+ </div>
+ </div>
+</div>
+<div class="clear"></div>
diff --git a/system/application/views/welcome_message.php
b/system/application/views/welcome_message.php
deleted file mode 100644
index 5f9e14e..0000000
--- a/system/application/views/welcome_message.php
+++ /dev/null
@@ -1,194 +0,0 @@
-<style type="text/css">
- #income-expense-graph-header {
- width: 200px;
- text-align: center;
- padding-bottom:30px;
- }
- #income-expense-graph-data {
- width: 200px;
- height: 200px;
- text-align: center;
- }
- #asset-liability-graph-header {
- width: 200px;
- text-align: center;
- padding-bottom:30px;
- }
- #asset-liability-graph-data {
- width: 200px;
- height: 200px;
- text-align: center;
- }
-</style>
-
-<script type="text/javascript">
-jQuery(document).ready(function () {
- jQuery('#income-expense-graph-data').tufteBar({
- data: [
- // First element is the y-value
- // Other elements are arbitary - they are not used by the lib
- // but are passed back into callback functions
- [<?php echo -$income_total; ?>, {label: 'Incomes'}],
- [<?php echo $expense_total; ?>, {label: 'Expenses'}]
- ],
-
- // Bar width in arbitrary units, 1.0 means the bars will be snuggled
- // up next to each other
- barWidth: 0.5,
-
- // The label on top of the bar - can contain HTML
- // formatNumber inserts commas as thousands separators in a number
- barLabel: function(index) {
- return $.tufteBar.formatNumber(this[0])
- },
-
- // The label on the x-axis - can contain HTML
- axisLabel: function(index) { return this[1].label },
-
- // The color of the bar
- color: function(index) {
- return ['#33CC66', '#C00000'][index % 2]
- },
- });
-
- jQuery('#asset-liability-graph-data').tufteBar({
- data: [
- // First element is the y-value
- // Other elements are arbitary - they are not used by the lib
- // but are passed back into callback functions
- [<?php echo $asset_total; ?>, {label: 'Assets'}],
- [<?php echo -$liability_total; ?>, {label: 'Liabilities'}]
- ],
-
- // Bar width in arbitrary units, 1.0 means the bars will be snuggled
- // up next to each other
- barWidth: 0.5,
-
- // The label on top of the bar - can contain HTML
- // formatNumber inserts commas as thousands separators in a number
- barLabel: function(index) {
- return $.tufteBar.formatNumber(this[0])
- },
-
- // The label on the x-axis - can contain HTML
- axisLabel: function(index) { return this[1].label },
-
- // The color of the bar
- color: function(index) {
- return ['#33CC66', '#C00000'][index % 2]
- },
- });
-});
-</script>
-<div id="dashboard-summary">
- <div id="dashboard-welcome-back" class="dashboard-item">
- <div class="dashboard-title">Account Summary</div>
- <div class="dashboard-content">
- <table class="dashboard-summary-table">
- <tbody>
- <tr>
- <td><div>Welcome back, <strong><?php echo
$this->config->item('account_name');?>
!</strong></div></td>
- </tr>
- <tr>
- <td><div id="dashboard-draft">You have <?php echo
anchor("voucher/show/draft", $draft_count . " draft",
array('class' => 'anchor-link-a')); ?>
voucher(s)</div></td>
- </tr>
- </tbody>
- </table>
- </div>
- </div>
- <div class="clear"></div>
- <div id="dashboard-cash-bank" class="dashboard-item">
- <div class="dashboard-title">Bank and Cash A/C's</div>
- <div class="dashboard-content">
- <?php
- if ($bank_cash_account)
- {
- echo "<table class=\"dashboard-cashbank-table\">";
- echo "<tbody>";
- foreach ($bank_cash_account as $id => $row)
- {
- echo "<tr>";
- echo "<td>" . anchor('report/ledgerst/' .
$row['id'], $row['name'], array('title' => $row['name']
. ' Statement')) . "</td>";
- echo "<td>" . convert_amount_dc($row['balance']) .
"</td>";
- echo "</tr>";
- }
- echo "</tbody>";
- echo "</table>";
- } else {
- echo "You have not created any bank or cash account";
- }
- ?>
- </div>
- </div>
- <div id="dashboard-summary" class="dashboard-item">
- <div class="dashboard-title">Account Summary</div>
- <div class="dashboard-content">
- <?php
- echo "<table class=\"dashboard-summary-table\">";
- echo "<tbody>";
- echo "<tr><td>Assets Total</td><td>" .
convert_amount_dc($asset_total) . "</td></tr>";
- echo "<tr><td>Liabilities Total</td><td>" .
convert_amount_dc($liability_total) . "</td></tr>";
- echo "<tr><td>Incomes Total</td><td>" .
convert_amount_dc($income_total) . "</td></tr>";
- echo "<tr><td>Expenses Total</td><td>" .
convert_amount_dc($expense_total) . "</td></tr>";
- echo "</tbody>";
- echo "</table>";
- ?>
- </div>
- </div>
- <div class="clear"></div>
- <div>
- <table border="0">
- <tbody>
- <tr>
- <?php if ($show_income_expense) { ?>
- <td width="300">
- <div id="income-expense" class="graph">
- <div id="income-expense-graph-header"><strong>Incomes Vs
Expenses</strong></div>
- <div id="income-expense-graph-data"></div>
- </div>
- </td>
- <?php } ?>
- <?php if ($show_asset_liability) { ?>
- <td width="300">
- <div id="asset-liability" class="graph">
- <div id="asset-liability-graph-header"><strong>Assets Vs
Liabilities</strong></div>
- <div id="asset-liability-graph-data""></div>
- </div>
- </td>
- <?php } ?>
- </tr>
- </tbody>
- </table>
- </div>
-</div>
-<div id="dashboard-log">
- <div id="dashboard-recent-log" class="dashboard-log-item">
- <div class="dashboard-log-title">Recent Activity <span
class="float-right"><?php echo anchor('log/feed',
img(array('src'=> asset_url() . "images/icons/rss.png",
'border' => '0', 'alt' => 'Log Feed',
'width' => '16px',))); ?></span></div>
- <div class="dashboard-log-content">
- <?php
- if ($logs)
- {
- echo "<ul id=\"recent-activity-list\">";
- foreach ($logs->result() as $row)
- {
- echo "<li>" . $row->message_title . "</li>";
- }
- echo "</ul>";
- } else {
- echo "No Recent Activity";
- }
- ?>
- </div>
- <?php
- if ($logs)
- {
- echo "<div class=\"dashboard-log-footer\">";
- echo "<span>";
- echo anchor("log", "more...", array('class' =>
'anchor-link-a'));
- echo "</span>";
- }
- ?>
- </div>
- </div>
-</div>
-<div class="clear"></div>
commit 168c210e74ca21cf48993701da7e9651018f1e38
Author: Prashant P Shah <pshah.mumbai(a)gmail.com>
Date: Thu Dec 30 13:25:22 2010 +0530
Added basic help page
Signed-off-by: Prashant P Shah <pshah.mumbai(a)gmail.com>
diff --git a/system/application/assets/css/custom.css
b/system/application/assets/css/custom.css
index 416e018..8a3ecfd 100644
--- a/system/application/assets/css/custom.css
+++ b/system/application/assets/css/custom.css
@@ -252,3 +252,37 @@ ul#pagination-flickr {
background-color:#FFC848;
text-align:left;
}
+
+/************************************ HELP ************************************/
+ul#qa-list {
+ margin:0;
+ padding:0;
+}
+
+ul#qa-list li {
+ list-style:none;
+ padding:3px 0 3px 0;
+}
+
+ul#qa-list li .qa-heading {
+ font-weight:bold;
+}
+
+ul#qa-list li ul li {
+ list-style:square;
+ padding:3px 0 3px 0;
+}
+
+.qa-section {
+ margin:0 0 30px 0;
+}
+
+.qa-question {
+ font-weight:bold;
+ border-bottom:1px solid #AAAAAA;
+ margin:0 0 5px 0;
+}
+
+.qa-answer {
+ margin:0 0 0 20px;
+}
diff --git a/system/application/controllers/help.php
b/system/application/controllers/help.php
new file mode 100644
index 0000000..bd87bbd
--- /dev/null
+++ b/system/application/controllers/help.php
@@ -0,0 +1,13 @@
+<?php
+
+class Help extends Controller {
+ function index()
+ {
+ $this->template->set('page_title', 'Help');
+ $this->template->load('template', 'help/index');
+ return;
+ }
+}
+
+/* End of file help.php */
+/* Location: ./system/application/controllers/help.php */
diff --git a/system/application/views/help/index.php
b/system/application/views/help/index.php
new file mode 100644
index 0000000..ce75d2d
--- /dev/null
+++ b/system/application/views/help/index.php
@@ -0,0 +1,34 @@
+<ul id="qa-list">
+<li><span class="qa-heading">Printing</span>
+ <ul>
+ <li><a href="#print-1" class="anchor-link-a">How do I
modify the voucher print format ?</a></li>
+ <li><a href="#print-2" class="anchor-link-a">How do I
modify the reports print format (balance sheet, profit and loss statement, trial balance,
ledger statement) ?</a></li>
+ </ul>
+</li>
+<li><span class="qa-heading">Email</span>
+ <ul>
+ <li><a href="#email-1" class="anchor-link-a">How do I
modify the voucher email format ?</a></li>
+ </ul>
+</li>
+</ul>
+
+<br /><br />
+
+<div class="qa-section" id="print-1">
+ <a name="print-1"></a>
+ <div class="qa-question">Q. How do I modify the voucher print format
?</div>
+ <div class="qa-answer">Voucher print template is located at
"system/application/views/voucher/printpreview.php". Modify this file to change
the voucher print format.</div>
+</div>
+
+<div class="qa-section" id="print-2">
+ <a name="print-2"></a>
+ <div class="qa-question">Q. How do I modify the reports print format
(balance sheet, profit and loss statement, trial balance, ledger statement) ?</div>
+ <div class="qa-answer">Report print template is located at
"system/application/views/report/report_template.php". Modify this file to
change the report print format.</div>
+</div>
+
+<div class="qa-section" id="email-1">
+ <a name="email-1"></a>
+ <div class="qa-question">Q. How do I modify the voucher email format
?</div>
+ <div class="qa-answer">Voucher email template is located at
"system/application/views/voucher/emailpreview.php". Modify this file to change
the voucher email format.</div>
+</div>
+
diff --git a/system/application/views/template.php
b/system/application/views/template.php
index 8683afb..018c33a 100644
--- a/system/application/views/template.php
+++ b/system/application/views/template.php
@@ -115,7 +115,7 @@ $(document).ready(function() {
<?php echo anchor('setting', 'Settings', array('title'
=> 'Settings')); ?>
</li>
<li>
- <?php echo anchor('', 'Help', array('title' =>
'Help', 'class' => 'last')); ?>
+ <?php echo anchor('help', 'Help', array('title' =>
'Help', 'class' => 'last')); ?>
</li>
</ul>
</div>
commit c9d296628feaee0b9df7f8b8289d0cb811c3f06c
Author: Prashant P Shah <pshah.mumbai(a)gmail.com>
Date: Thu Dec 30 11:52:46 2010 +0530
Altered database structure
- Removed print_page_layout and print_logo
- Added account_locked and manage_stocks
Signed-off-by: Prashant P Shah <pshah.mumbai(a)gmail.com>
diff --git a/system/application/controllers/admin/schema.sql
b/system/application/controllers/admin/schema.sql
index d7b5037..6d97e7c 100644
--- a/system/application/controllers/admin/schema.sql
+++ b/system/application/controllers/admin/schema.sql
@@ -16,39 +16,6 @@ CREATE TABLE IF NOT EXISTS ledgers (
PRIMARY KEY (id)
) ENGINE=InnoDB DEFAULT CHARSET=latin1 ROW_FORMAT=DYNAMIC AUTO_INCREMENT=1;
-CREATE TABLE IF NOT EXISTS settings (
- id int(1) NOT NULL,
- name varchar(100) NOT NULL,
- address varchar(255) NOT NULL,
- email varchar(100) NOT NULL,
- fy_start datetime NOT NULL,
- fy_end datetime NOT NULL,
- currency_symbol varchar(10) NOT NULL,
- date_format varchar(30) NOT NULL,
- timezone varchar(255) NOT NULL,
- email_protocol varchar(9) NOT NULL,
- email_host varchar(255) NOT NULL,
- email_port int(5) NOT NULL,
- email_username varchar(255) NOT NULL,
- email_password varchar(255) NOT NULL,
- print_paper_height float NOT NULL,
- print_paper_width float NOT NULL,
- print_margin_top float NOT NULL,
- print_margin_bottom float NOT NULL,
- print_margin_left float NOT NULL,
- print_margin_right float NOT NULL,
- print_orientation varchar(1) NOT NULL,
- print_page_format varchar(1) NOT NULL,
- print_page_layout text NOT NULL,
- print_logo varchar(255) NOT NULL,
- receipt_voucher_prefix varchar(10) NOT NULL,
- payment_voucher_prefix varchar(10) NOT NULL,
- contra_voucher_prefix varchar(10) NOT NULL,
- journal_voucher_prefix varchar(10) NOT NULL,
- voucher_number_padding int(5) NOT NULL,
- database_version int(10) NOT NULL
-) ENGINE=InnoDB DEFAULT CHARSET=latin1 ROW_FORMAT=DYNAMIC;
-
CREATE TABLE IF NOT EXISTS vouchers (
id int(11) NOT NULL AUTO_INCREMENT,
tag_id int(11) NOT NULL DEFAULT '0',
@@ -91,3 +58,36 @@ CREATE TABLE IF NOT EXISTS logs (
message_desc mediumtext NOT NULL,
PRIMARY KEY (id)
) ENGINE=InnoDB DEFAULT CHARSET=latin1 AUTO_INCREMENT=1;
+
+CREATE TABLE IF NOT EXISTS settings (
+ id int(1) NOT NULL,
+ name varchar(100) NOT NULL,
+ address varchar(255) NOT NULL,
+ email varchar(100) NOT NULL,
+ fy_start datetime NOT NULL,
+ fy_end datetime NOT NULL,
+ currency_symbol varchar(10) NOT NULL,
+ date_format varchar(30) NOT NULL,
+ timezone varchar(255) NOT NULL,
+ manage_stocks int(1) NOT NULL,
+ account_locked int(1) NOT NULL,
+ email_protocol varchar(9) NOT NULL,
+ email_host varchar(255) NOT NULL,
+ email_port int(5) NOT NULL,
+ email_username varchar(255) NOT NULL,
+ email_password varchar(255) NOT NULL,
+ print_paper_height float NOT NULL,
+ print_paper_width float NOT NULL,
+ print_margin_top float NOT NULL,
+ print_margin_bottom float NOT NULL,
+ print_margin_left float NOT NULL,
+ print_margin_right float NOT NULL,
+ print_orientation varchar(1) NOT NULL,
+ print_page_format varchar(1) NOT NULL,
+ receipt_voucher_prefix varchar(10) NOT NULL,
+ payment_voucher_prefix varchar(10) NOT NULL,
+ contra_voucher_prefix varchar(10) NOT NULL,
+ journal_voucher_prefix varchar(10) NOT NULL,
+ voucher_number_padding int(5) NOT NULL,
+ database_version int(10) NOT NULL
+) ENGINE=InnoDB DEFAULT CHARSET=latin1 ROW_FORMAT=DYNAMIC;
diff --git a/system/application/controllers/setting.php
b/system/application/controllers/setting.php
index 72e2adc..db3f28b 100644
--- a/system/application/controllers/setting.php
+++ b/system/application/controllers/setting.php
@@ -656,20 +656,6 @@ class Setting extends Controller {
'value' => 'T',
'checked' => FALSE,
);
- $data['page_layout'] = array(
- 'name' => 'page_layout',
- 'id' => 'page_layout',
- 'rows' => 10,
- 'cols' => 80,
- 'value' => '',
- );
- $data['logo'] = array(
- 'name' => 'logo',
- 'id' => 'logo',
- 'maxlength' => '100',
- 'size' => '40',
- 'value' => '',
- );
if ($account_data)
{
@@ -679,8 +665,6 @@ class Setting extends Controller {
$data['margin_bottom']['value'] =
($account_data->print_margin_bottom) ?
print_value($account_data->print_margin_bottom) : '';
$data['margin_left']['value'] = ($account_data->print_margin_left)
? print_value($account_data->print_margin_left) : '';
$data['margin_right']['value'] =
($account_data->print_margin_right) ? print_value($account_data->print_margin_right)
: '';
- $data['page_layout']['value'] = ($account_data->print_page_layout)
? print_value($account_data->print_page_layout) : '';
- $data['logo']['value'] = ($account_data->print_logo) ?
print_value($account_data->print_logo) : '';
if ($account_data->print_orientation)
{
if ($account_data->print_orientation == "P")
@@ -712,8 +696,6 @@ class Setting extends Controller {
$this->form_validation->set_rules('margin_bottom', 'Bottom
Margin', 'trim|required|numeric');
$this->form_validation->set_rules('margin_left', 'Left Margin',
'trim|required|numeric');
$this->form_validation->set_rules('margin_right', 'Right Margin',
'trim|required|numeric');
- $this->form_validation->set_rules('page_layout', 'Page Layout',
'trim|min_length[2]');
- $this->form_validation->set_rules('logo', 'Logo Path',
'trim');
/* Repopulating form */
if ($_POST)
@@ -724,8 +706,6 @@ class Setting extends Controller {
$data['margin_bottom']['value'] =
$this->input->post('margin_bottom', TRUE);
$data['margin_left']['value'] =
$this->input->post('margin_left', TRUE);
$data['margin_right']['value'] =
$this->input->post('margin_right', TRUE);
- $data['page_layout']['value'] =
$this->input->post('page_layout', TRUE);
- $data['logo']['value'] = $this->input->post('logo',
TRUE);
$data['orientation'] = $this->input->post('orientation', TRUE);
if ($data['orientation'] == "P")
@@ -762,8 +742,6 @@ class Setting extends Controller {
$data_margin_bottom = $this->input->post('margin_bottom', TRUE);
$data_margin_left = $this->input->post('margin_left', TRUE);
$data_margin_right = $this->input->post('margin_right', TRUE);
- $data_page_layout = $this->input->post('page_layout', TRUE);
- $data_logo = $this->input->post('logo', TRUE);
if ($this->input->post('orientation', TRUE) == "P")
{
@@ -780,7 +758,7 @@ class Setting extends Controller {
/* Update settings */
$this->db->trans_start();
- if ( ! $this->db->query("UPDATE settings SET print_paper_height = ?,
print_paper_width = ?, print_margin_top = ?, print_margin_bottom = ?, print_margin_left =
?, print_margin_right = ?, print_orientation = ?, print_page_format = ?, print_page_layout
= ?, print_logo = ? WHERE id = 1", array($data_paper_height, $data_paper_width,
$data_margin_top, $data_margin_bottom, $data_margin_left, $data_margin_right,
$data_orientation, $data_output_format, $data_page_layout, $data_logo)))
+ if ( ! $this->db->query("UPDATE settings SET print_paper_height = ?,
print_paper_width = ?, print_margin_top = ?, print_margin_bottom = ?, print_margin_left =
?, print_margin_right = ?, print_orientation = ?, print_page_format = ? WHERE id =
1", array($data_paper_height, $data_paper_width, $data_margin_top,
$data_margin_bottom, $data_margin_left, $data_margin_right, $data_orientation,
$data_output_format)))
{
$this->db->trans_rollback();
$this->messages->add('Error updating printer settings.',
'error');
diff --git a/system/application/views/setting/printer.php
b/system/application/views/setting/printer.php
index 8d9b748..f85ab90 100644
--- a/system/application/views/setting/printer.php
+++ b/system/application/views/setting/printer.php
@@ -85,23 +85,6 @@
echo form_fieldset_close();
echo "</p>";
-
- echo "<p>";
- echo form_label('Page Layout', 'page_layout');
- echo "<br />";
- echo form_textarea($page_layout);
- echo "<br />";
- echo "<span class=\"form-help-text\">HTML
Markup</span>";
- echo "</p>";
-
- echo "<p>";
- echo form_label('Logo Path', 'logo');
- echo "<br />";
- echo form_input($logo);
- echo "<br />";
- echo "<span class=\"form-help-text\">Path to Logo
file</span>";
- echo "</p>";
-
echo "<p>";
echo form_submit('submit', 'Update');
echo " ";
commit fe0ff45a397a56c535d2a44b88fbf2d7e3b37072
Author: Prashant P Shah <pshah.mumbai(a)gmail.com>
Date: Wed Dec 29 22:10:20 2010 +0530
Added Status message when everything is configured correctly
Signed-off-by: Prashant P Shah <pshah.mumbai(a)gmail.com>
diff --git a/system/application/views/admin/status.php
b/system/application/views/admin/status.php
index f40be1d..0ad7d82 100644
--- a/system/application/views/admin/status.php
+++ b/system/application/views/admin/status.php
@@ -11,6 +11,13 @@
}
echo "</ul>";
echo "</div>";
+ } else {
+ echo "<div id=\"success-box\">";
+ echo "<ul>";
+ echo "<li>Everything is configured correctly.</li>";
+ echo "</ul>";
+ echo "</div>";
+
}
}
commit 2f527c4a95cd72fe7f7594b61ba5562f3a7e416d
Author: Prashant P Shah <pshah.mumbai(a)gmail.com>
Date: Wed Dec 29 19:32:05 2010 +0530
Refactored database schema files
- Combined account creation and carry forward into same database schema
- Seperated the account group and ledger initial data
- Return from creation or carry forward script on error
Signed-off-by: Prashant P Shah <pshah.mumbai(a)gmail.com>
diff --git a/system/application/controllers/admin/carryforward.sql
b/system/application/controllers/admin/carryforward.sql
deleted file mode 100644
index d7b5037..0000000
--- a/system/application/controllers/admin/carryforward.sql
+++ /dev/null
@@ -1,93 +0,0 @@
-CREATE TABLE IF NOT EXISTS groups (
- id int(11) NOT NULL AUTO_INCREMENT,
- parent_id int(11) NOT NULL,
- name varchar(100) NOT NULL,
- affects_gross int(1) NOT NULL DEFAULT '0',
- PRIMARY KEY (id)
-) ENGINE=InnoDB DEFAULT CHARSET=latin1 AUTO_INCREMENT=1;
-
-CREATE TABLE IF NOT EXISTS ledgers (
- id int(11) NOT NULL AUTO_INCREMENT,
- group_id int(11) NOT NULL,
- name varchar(100) NOT NULL,
- op_balance decimal(15,2) NOT NULL DEFAULT '0.00',
- op_balance_dc char(1) NOT NULL,
- type char(1) NOT NULL,
- PRIMARY KEY (id)
-) ENGINE=InnoDB DEFAULT CHARSET=latin1 ROW_FORMAT=DYNAMIC AUTO_INCREMENT=1;
-
-CREATE TABLE IF NOT EXISTS settings (
- id int(1) NOT NULL,
- name varchar(100) NOT NULL,
- address varchar(255) NOT NULL,
- email varchar(100) NOT NULL,
- fy_start datetime NOT NULL,
- fy_end datetime NOT NULL,
- currency_symbol varchar(10) NOT NULL,
- date_format varchar(30) NOT NULL,
- timezone varchar(255) NOT NULL,
- email_protocol varchar(9) NOT NULL,
- email_host varchar(255) NOT NULL,
- email_port int(5) NOT NULL,
- email_username varchar(255) NOT NULL,
- email_password varchar(255) NOT NULL,
- print_paper_height float NOT NULL,
- print_paper_width float NOT NULL,
- print_margin_top float NOT NULL,
- print_margin_bottom float NOT NULL,
- print_margin_left float NOT NULL,
- print_margin_right float NOT NULL,
- print_orientation varchar(1) NOT NULL,
- print_page_format varchar(1) NOT NULL,
- print_page_layout text NOT NULL,
- print_logo varchar(255) NOT NULL,
- receipt_voucher_prefix varchar(10) NOT NULL,
- payment_voucher_prefix varchar(10) NOT NULL,
- contra_voucher_prefix varchar(10) NOT NULL,
- journal_voucher_prefix varchar(10) NOT NULL,
- voucher_number_padding int(5) NOT NULL,
- database_version int(10) NOT NULL
-) ENGINE=InnoDB DEFAULT CHARSET=latin1 ROW_FORMAT=DYNAMIC;
-
-CREATE TABLE IF NOT EXISTS vouchers (
- id int(11) NOT NULL AUTO_INCREMENT,
- tag_id int(11) NOT NULL DEFAULT '0',
- number int(11) NOT NULL,
- date datetime NOT NULL,
- dr_total decimal(15,2) NOT NULL DEFAULT '0.00',
- cr_total decimal(15,2) NOT NULL DEFAULT '0.00',
- narration text NOT NULL,
- draft int(1) NOT NULL,
- type int(2) NOT NULL,
- PRIMARY KEY (id)
-) ENGINE=InnoDB DEFAULT CHARSET=latin1 AUTO_INCREMENT=1;
-
-CREATE TABLE IF NOT EXISTS voucher_items (
- id int(11) NOT NULL AUTO_INCREMENT,
- voucher_id int(11) NOT NULL,
- ledger_id int(11) NOT NULL,
- amount decimal(15,2) NOT NULL DEFAULT '0.00',
- dc char(1) NOT NULL,
- PRIMARY KEY (id)
-) ENGINE=InnoDB DEFAULT CHARSET=latin1 AUTO_INCREMENT=1;
-
-CREATE TABLE IF NOT EXISTS tags (
- id int(11) NOT NULL AUTO_INCREMENT,
- title varchar(50) NOT NULL,
- color varchar(6) NOT NULL,
- background varchar(6) NOT NULL,
- PRIMARY KEY (id)
-) ENGINE=InnoDB DEFAULT CHARSET=latin1 AUTO_INCREMENT=1;
-
-CREATE TABLE IF NOT EXISTS logs (
- id int(11) NOT NULL AUTO_INCREMENT,
- date datetime NOT NULL,
- level int(1) NOT NULL,
- host_ip varchar(25) NOT NULL,
- user varchar(25) NOT NULL,
- url varchar(255) NOT NULL,
- user_agent varchar(100) NOT NULL,
- message_title varchar(255) NOT NULL,
- message_desc mediumtext NOT NULL,
- PRIMARY KEY (id)
-) ENGINE=InnoDB DEFAULT CHARSET=latin1 AUTO_INCREMENT=1;
diff --git a/system/application/controllers/admin/create.php
b/system/application/controllers/admin/create.php
index 5fc5d05..ebd9a36 100644
--- a/system/application/controllers/admin/create.php
+++ b/system/application/controllers/admin/create.php
@@ -234,7 +234,7 @@ class Create extends Controller {
{
if ($newacc->query("CREATE DATABASE " .
mysql_real_escape_string($data_database_name)))
{
- $this->messages->add('New account database created.',
'success');
+ $this->messages->add('Created account database.',
'success');
/* Retrying to connect to new database */
$newacc = $this->load->database($dsn, TRUE);
$conn_error = $newacc->_error_message();
@@ -261,7 +261,7 @@ class Create extends Controller {
return;
} else {
/* Executing the database setup script */
- $setup_account =
read_file('system/application/controllers/admin/database.sql');
+ $setup_account =
read_file('system/application/controllers/admin/schema.sql');
$setup_account_array = explode(";", $setup_account);
foreach($setup_account_array as $row)
{
@@ -269,14 +269,46 @@ class Create extends Controller {
continue;
$newacc->query($row);
if ($newacc->_error_message() != "")
- $this->messages->add($newacc->_error_message(), 'error');
+ {
+ $this->messages->add('Error initializing account database.',
'error');
+ $this->template->load('admin_template', 'admin/create',
$data);
+ return;
+ }
}
+ $this->messages->add('Initialized account database.',
'success');
- $this->messages->add('Created account database.', 'success');
+ /* Initial account setup */
+ $setup_initial_data =
read_file('system/application/controllers/admin/initialize.sql');
+ $setup_initial_data_array = explode(";", $setup_initial_data);
+ $newacc->trans_start();
+ foreach($setup_initial_data_array as $row)
+ {
+ if (strlen($row) < 5)
+ continue;
+ $newacc->query($row); var_dump($newacc->_error_message());
+ if ($newacc->_error_message() != "")
+ {
+ $newacc->trans_rollback();
+ $this->messages->add('Error initializing basic accounts data.',
'error');
+ $this->template->load('admin_template', 'admin/create',
$data);
+ return;
+ }
+ }
+ $newacc->trans_complete();
+ $this->messages->add('Initialized basic accounts data.',
'success');
- /* Adding the account settings */
- $newacc->query("INSERT INTO settings (id, name, address, email, fy_start,
fy_end, currency_symbol, date_format, timezone, database_version) VALUES (?, ?, ?, ?, ?,
?, ?, ?, ?, ?)", array(1, $data_account_name, $data_account_address,
$data_account_email, $data_fy_start, $data_fy_end, $data_account_currency,
$data_account_date, $data_account_timezone, 1));
- $this->messages->add('Added account information.', 'success');
+ /* Adding account settings */
+ $newacc->trans_start();
+ if ( ! $newacc->query("INSERT INTO settings (id, name, address, email,
fy_start, fy_end, currency_symbol, date_format, timezone, database_version) VALUES (?, ?,
?, ?, ?, ?, ?, ?, ?, ?)", array(1, $data_account_name, $data_account_address,
$data_account_email, $data_fy_start, $data_fy_end, $data_account_currency,
$data_account_date, $data_account_timezone, 1)))
+ {
+ $newacc->trans_rollback();
+ $this->messages->add('Error adding account settings.',
'error');
+ $this->template->load('admin_template', 'admin/create',
$data);
+ return;
+ } else {
+ $newacc->trans_complete();
+ $this->messages->add('Added account settings.', 'success');
+ }
/* Adding account settings to file. Code copied from manage controller */
$con_details = "[database]" . "\r\n" . "db_hostname =
\"" . $data_database_host . "\"" . "\r\n" .
"db_port = \"" . $data_database_port . "\"" .
"\r\n" . "db_name = \"" . $data_database_name .
"\"" . "\r\n" . "db_username = \"" .
$data_database_username . "\"" . "\r\n" . "db_password =
\"" . $data_database_password . "\"" . "\r\n";
diff --git a/system/application/controllers/admin/database.sql
b/system/application/controllers/admin/database.sql
deleted file mode 100644
index ffdf48f..0000000
--- a/system/application/controllers/admin/database.sql
+++ /dev/null
@@ -1,110 +0,0 @@
-CREATE TABLE IF NOT EXISTS groups (
- id int(11) NOT NULL AUTO_INCREMENT,
- parent_id int(11) NOT NULL,
- name varchar(100) NOT NULL,
- affects_gross int(1) NOT NULL DEFAULT '0',
- PRIMARY KEY (id)
-) ENGINE=InnoDB DEFAULT CHARSET=latin1 AUTO_INCREMENT=1;
-
-CREATE TABLE IF NOT EXISTS ledgers (
- id int(11) NOT NULL AUTO_INCREMENT,
- group_id int(11) NOT NULL,
- name varchar(100) NOT NULL,
- op_balance decimal(15,2) NOT NULL DEFAULT '0.00',
- op_balance_dc char(1) NOT NULL,
- type char(1) NOT NULL,
- PRIMARY KEY (id)
-) ENGINE=InnoDB DEFAULT CHARSET=latin1 ROW_FORMAT=DYNAMIC AUTO_INCREMENT=1;
-
-CREATE TABLE IF NOT EXISTS settings (
- id int(1) NOT NULL,
- name varchar(100) NOT NULL,
- address varchar(255) NOT NULL,
- email varchar(100) NOT NULL,
- fy_start datetime NOT NULL,
- fy_end datetime NOT NULL,
- currency_symbol varchar(10) NOT NULL,
- date_format varchar(30) NOT NULL,
- timezone varchar(255) NOT NULL,
- email_protocol varchar(9) NOT NULL,
- email_host varchar(255) NOT NULL,
- email_port int(5) NOT NULL,
- email_username varchar(255) NOT NULL,
- email_password varchar(255) NOT NULL,
- print_paper_height float NOT NULL,
- print_paper_width float NOT NULL,
- print_margin_top float NOT NULL,
- print_margin_bottom float NOT NULL,
- print_margin_left float NOT NULL,
- print_margin_right float NOT NULL,
- print_orientation varchar(1) NOT NULL,
- print_page_format varchar(1) NOT NULL,
- print_page_layout text NOT NULL,
- print_logo varchar(255) NOT NULL,
- receipt_voucher_prefix varchar(10) NOT NULL,
- payment_voucher_prefix varchar(10) NOT NULL,
- contra_voucher_prefix varchar(10) NOT NULL,
- journal_voucher_prefix varchar(10) NOT NULL,
- voucher_number_padding int(5) NOT NULL,
- database_version int(10) NOT NULL
-) ENGINE=InnoDB DEFAULT CHARSET=latin1 ROW_FORMAT=DYNAMIC;
-
-CREATE TABLE IF NOT EXISTS vouchers (
- id int(11) NOT NULL AUTO_INCREMENT,
- tag_id int(11) NOT NULL DEFAULT '0',
- number int(11) NOT NULL,
- date datetime NOT NULL,
- dr_total decimal(15,2) NOT NULL DEFAULT '0.00',
- cr_total decimal(15,2) NOT NULL DEFAULT '0.00',
- narration text NOT NULL,
- draft int(1) NOT NULL,
- type int(2) NOT NULL,
- PRIMARY KEY (id)
-) ENGINE=InnoDB DEFAULT CHARSET=latin1 AUTO_INCREMENT=1;
-
-CREATE TABLE IF NOT EXISTS voucher_items (
- id int(11) NOT NULL AUTO_INCREMENT,
- voucher_id int(11) NOT NULL,
- ledger_id int(11) NOT NULL,
- amount decimal(15,2) NOT NULL DEFAULT '0.00',
- dc char(1) NOT NULL,
- PRIMARY KEY (id)
-) ENGINE=InnoDB DEFAULT CHARSET=latin1 AUTO_INCREMENT=1;
-
-CREATE TABLE IF NOT EXISTS tags (
- id int(11) NOT NULL AUTO_INCREMENT,
- title varchar(50) NOT NULL,
- color varchar(6) NOT NULL,
- background varchar(6) NOT NULL,
- PRIMARY KEY (id)
-) ENGINE=InnoDB DEFAULT CHARSET=latin1 AUTO_INCREMENT=1;
-
-CREATE TABLE IF NOT EXISTS logs (
- id int(11) NOT NULL AUTO_INCREMENT,
- date datetime NOT NULL,
- level int(1) NOT NULL,
- host_ip varchar(25) NOT NULL,
- user varchar(25) NOT NULL,
- url varchar(255) NOT NULL,
- user_agent varchar(100) NOT NULL,
- message_title varchar(255) NOT NULL,
- message_desc mediumtext NOT NULL,
- PRIMARY KEY (id)
-) ENGINE=InnoDB DEFAULT CHARSET=latin1 AUTO_INCREMENT=1;
-
-INSERT INTO groups (id, parent_id, name, affects_gross) VALUES (1, 0, 'Assets',
0);
-INSERT INTO groups (id, parent_id, name, affects_gross) VALUES (2, 0,
'Liabilities', 0);
-INSERT INTO groups (id, parent_id, name, affects_gross) VALUES (3, 0, 'Incomes',
0);
-INSERT INTO groups (id, parent_id, name, affects_gross) VALUES (4, 0, 'Expenses',
0);
-INSERT INTO groups (id, parent_id, name, affects_gross) VALUES (5, 1, 'Fixed
assets', 0);
-INSERT INTO groups (id, parent_id, name, affects_gross) VALUES (6, 1, 'Current
assets', 0);
-INSERT INTO groups (id, parent_id, name, affects_gross) VALUES (7, 1,
'Investments', 0);
-INSERT INTO groups (id, parent_id, name, affects_gross) VALUES (8, 2, 'Capital
A/C', 0);
-INSERT INTO groups (id, parent_id, name, affects_gross) VALUES (9, 2, 'Current
Liabilities', 0);
-INSERT INTO groups (id, parent_id, name, affects_gross) VALUES (10, 2, 'Loans
(Liability)', 0);
-INSERT INTO groups (id, parent_id, name, affects_gross) VALUES (11, 3, 'Direct
Incomes', 1);
-INSERT INTO groups (id, parent_id, name, affects_gross) VALUES (12, 4, 'Direct
Expenses', 1);
-INSERT INTO groups (id, parent_id, name, affects_gross) VALUES (13, 3, 'Indirect
Incomes', 0);
-INSERT INTO groups (id, parent_id, name, affects_gross) VALUES (14, 4, 'Indirect
Expenses', 0);
-INSERT INTO groups (id, parent_id, name, affects_gross) VALUES (15, 3, 'Sales',
1);
-INSERT INTO groups (id, parent_id, name, affects_gross) VALUES (16, 4,
'Purchases', 1);
diff --git a/system/application/controllers/admin/initialize.sql
b/system/application/controllers/admin/initialize.sql
new file mode 100644
index 0000000..3cfce90
--- /dev/null
+++ b/system/application/controllers/admin/initialize.sql
@@ -0,0 +1,16 @@
+INSERT INTO groups (id, parent_id, name, affects_gross) VALUES (1, 0, 'Assets',
0);
+INSERT INTO groups (id, parent_id, name, affects_gross) VALUES (2, 0,
'Liabilities', 0);
+INSERT INTO groups (id, parent_id, name, affects_gross) VALUES (3, 0, 'Incomes',
0);
+INSERT INTO groups (id, parent_id, name, affects_gross) VALUES (4, 0, 'Expenses',
0);
+INSERT INTO groups (id, parent_id, name, affects_gross) VALUES (5, 1, 'Fixed
assets', 0);
+INSERT INTO groups (id, parent_id, name, affects_gross) VALUES (6, 1, 'Current
assets', 0);
+INSERT INTO groups (id, parent_id, name, affects_gross) VALUES (7, 1,
'Investments', 0);
+INSERT INTO groups (id, parent_id, name, affects_gross) VALUES (8, 2, 'Capital
A/C', 0);
+INSERT INTO groups (id, parent_id, name, affects_gross) VALUES (9, 2, 'Current
Liabilities', 0);
+INSERT INTO groups (id, parent_id, name, affects_gross) VALUES (10, 2, 'Loans
(Liability)', 0);
+INSERT INTO groups (id, parent_id, name, affects_gross) VALUES (11, 3, 'Direct
Incomes', 1);
+INSERT INTO groups (id, parent_id, name, affects_gross) VALUES (12, 4, 'Direct
Expenses', 1);
+INSERT INTO groups (id, parent_id, name, affects_gross) VALUES (13, 3, 'Indirect
Incomes', 0);
+INSERT INTO groups (id, parent_id, name, affects_gross) VALUES (14, 4, 'Indirect
Expenses', 0);
+INSERT INTO groups (id, parent_id, name, affects_gross) VALUES (15, 3, 'Sales',
1);
+INSERT INTO groups (id, parent_id, name, affects_gross) VALUES (16, 4,
'Purchases', 1);
diff --git a/system/application/controllers/admin/schema.sql
b/system/application/controllers/admin/schema.sql
new file mode 100644
index 0000000..d7b5037
--- /dev/null
+++ b/system/application/controllers/admin/schema.sql
@@ -0,0 +1,93 @@
+CREATE TABLE IF NOT EXISTS groups (
+ id int(11) NOT NULL AUTO_INCREMENT,
+ parent_id int(11) NOT NULL,
+ name varchar(100) NOT NULL,
+ affects_gross int(1) NOT NULL DEFAULT '0',
+ PRIMARY KEY (id)
+) ENGINE=InnoDB DEFAULT CHARSET=latin1 AUTO_INCREMENT=1;
+
+CREATE TABLE IF NOT EXISTS ledgers (
+ id int(11) NOT NULL AUTO_INCREMENT,
+ group_id int(11) NOT NULL,
+ name varchar(100) NOT NULL,
+ op_balance decimal(15,2) NOT NULL DEFAULT '0.00',
+ op_balance_dc char(1) NOT NULL,
+ type char(1) NOT NULL,
+ PRIMARY KEY (id)
+) ENGINE=InnoDB DEFAULT CHARSET=latin1 ROW_FORMAT=DYNAMIC AUTO_INCREMENT=1;
+
+CREATE TABLE IF NOT EXISTS settings (
+ id int(1) NOT NULL,
+ name varchar(100) NOT NULL,
+ address varchar(255) NOT NULL,
+ email varchar(100) NOT NULL,
+ fy_start datetime NOT NULL,
+ fy_end datetime NOT NULL,
+ currency_symbol varchar(10) NOT NULL,
+ date_format varchar(30) NOT NULL,
+ timezone varchar(255) NOT NULL,
+ email_protocol varchar(9) NOT NULL,
+ email_host varchar(255) NOT NULL,
+ email_port int(5) NOT NULL,
+ email_username varchar(255) NOT NULL,
+ email_password varchar(255) NOT NULL,
+ print_paper_height float NOT NULL,
+ print_paper_width float NOT NULL,
+ print_margin_top float NOT NULL,
+ print_margin_bottom float NOT NULL,
+ print_margin_left float NOT NULL,
+ print_margin_right float NOT NULL,
+ print_orientation varchar(1) NOT NULL,
+ print_page_format varchar(1) NOT NULL,
+ print_page_layout text NOT NULL,
+ print_logo varchar(255) NOT NULL,
+ receipt_voucher_prefix varchar(10) NOT NULL,
+ payment_voucher_prefix varchar(10) NOT NULL,
+ contra_voucher_prefix varchar(10) NOT NULL,
+ journal_voucher_prefix varchar(10) NOT NULL,
+ voucher_number_padding int(5) NOT NULL,
+ database_version int(10) NOT NULL
+) ENGINE=InnoDB DEFAULT CHARSET=latin1 ROW_FORMAT=DYNAMIC;
+
+CREATE TABLE IF NOT EXISTS vouchers (
+ id int(11) NOT NULL AUTO_INCREMENT,
+ tag_id int(11) NOT NULL DEFAULT '0',
+ number int(11) NOT NULL,
+ date datetime NOT NULL,
+ dr_total decimal(15,2) NOT NULL DEFAULT '0.00',
+ cr_total decimal(15,2) NOT NULL DEFAULT '0.00',
+ narration text NOT NULL,
+ draft int(1) NOT NULL,
+ type int(2) NOT NULL,
+ PRIMARY KEY (id)
+) ENGINE=InnoDB DEFAULT CHARSET=latin1 AUTO_INCREMENT=1;
+
+CREATE TABLE IF NOT EXISTS voucher_items (
+ id int(11) NOT NULL AUTO_INCREMENT,
+ voucher_id int(11) NOT NULL,
+ ledger_id int(11) NOT NULL,
+ amount decimal(15,2) NOT NULL DEFAULT '0.00',
+ dc char(1) NOT NULL,
+ PRIMARY KEY (id)
+) ENGINE=InnoDB DEFAULT CHARSET=latin1 AUTO_INCREMENT=1;
+
+CREATE TABLE IF NOT EXISTS tags (
+ id int(11) NOT NULL AUTO_INCREMENT,
+ title varchar(50) NOT NULL,
+ color varchar(6) NOT NULL,
+ background varchar(6) NOT NULL,
+ PRIMARY KEY (id)
+) ENGINE=InnoDB DEFAULT CHARSET=latin1 AUTO_INCREMENT=1;
+
+CREATE TABLE IF NOT EXISTS logs (
+ id int(11) NOT NULL AUTO_INCREMENT,
+ date datetime NOT NULL,
+ level int(1) NOT NULL,
+ host_ip varchar(25) NOT NULL,
+ user varchar(25) NOT NULL,
+ url varchar(255) NOT NULL,
+ user_agent varchar(100) NOT NULL,
+ message_title varchar(255) NOT NULL,
+ message_desc mediumtext NOT NULL,
+ PRIMARY KEY (id)
+) ENGINE=InnoDB DEFAULT CHARSET=latin1 AUTO_INCREMENT=1;
diff --git a/system/application/controllers/setting.php
b/system/application/controllers/setting.php
index 30b9e71..72e2adc 100644
--- a/system/application/controllers/setting.php
+++ b/system/application/controllers/setting.php
@@ -334,12 +334,12 @@ class Setting extends Controller {
{
if ($newacc->query("CREATE DATABASE " .
mysql_real_escape_string($data_database_name)))
{
- $this->messages->add('New account database created.',
'success');
+ $this->messages->add('Created account database.',
'success');
/* Retrying to connect to new database */
$newacc = $this->load->database($dsn, TRUE);
$conn_error = $newacc->_error_message();
} else {
- $this->messages->add('Cannot create account database.',
'error');
+ $this->messages->add('Failed to create account database.',
'error');
$this->template->load('template', 'setting/cf', $data);
return;
}
@@ -361,7 +361,7 @@ class Setting extends Controller {
return;
} else {
/* Executing the database setup script */
- $setup_account =
read_file('system/application/controllers/admin/carryforward.sql');
+ $setup_account =
read_file('system/application/controllers/admin/schema.sql');
$setup_account_array = explode(";", $setup_account);
foreach($setup_account_array as $row)
{
@@ -369,19 +369,26 @@ class Setting extends Controller {
continue;
$newacc->query($row);
if ($newacc->_error_message() != "")
- $this->messages->add($newacc->_error_message(), 'error');
+ {
+ $this->messages->add('Error initializing account database.',
'error');
+ $this->template->load('template', 'setting/cf', $data);
+ return;
+ }
}
+ $this->messages->add('Initialized account database.',
'success');
- $this->messages->add('Created account database.', 'success');
-
- /* Adding the account settings */
- $newacc->query("INSERT INTO settings (id, name, address, email, fy_start,
fy_end, currency_symbol, date_format, timezone, email_protocol, email_host, email_port,
email_username, email_password, database_version) VALUES (?, ?, ?, ?, ?, ?, ?, ?, ?, ?,
?, ?, ?, ?, ?)", array(1, $data_account_name, $data_account_address,
$data_account_email, $data_fy_start, $data_fy_end, $data_account_currency,
$data_account_date, $data_account_timezone, $data_account_email_protocol,
$data_account_email_host, $data_account_email_port, $data_account_email_username,
$data_account_email_password, 1));
- $this->messages->add('Added account information.', 'success');
-
- /* Adding account settings to file. Code copied from manage controller */
- $con_details = "[database]" . "\r\n" . "db_hostname =
\"" . $data_database_host . "\"" . "\r\n" .
"db_port = \"" . $data_database_port . "\"" .
"\r\n" . "db_name = \"" . $data_database_name .
"\"" . "\r\n" . "db_username = \"" .
$data_database_username . "\"" . "\r\n" . "db_password =
\"" . $data_database_password . "\"" . "\r\n";
-
- $con_details_html = '[database]<br />db_hostname = "' .
$data_database_host . '"<br />db_port = "' . $data_database_port .
'"<br />db_name = "' . $data_database_name . '"<br
/>db_username = "' . $data_database_username . '"<br
/>db_password = "' . $data_database_password . '"<br />';
+ /* Adding account settings */
+ $newacc->trans_start();
+ if ( ! $newacc->query("INSERT INTO settings (id, name, address, email,
fy_start, fy_end, currency_symbol, date_format, timezone, email_protocol, email_host,
email_port, email_username, email_password, database_version) VALUES (?, ?, ?, ?, ?, ?,
?, ?, ?, ?, ?, ?, ?, ?, ?)", array(1, $data_account_name, $data_account_address,
$data_account_email, $data_fy_start, $data_fy_end, $data_account_currency,
$data_account_date, $data_account_timezone, $data_account_email_protocol,
$data_account_email_host, $data_account_email_port, $data_account_email_username,
$data_account_email_password, 1)))
+ {
+ $newacc->trans_rollback();
+ $this->messages->add('Error adding account settings.',
'error');
+ $this->template->load('template', 'setting/cf', $data);
+ return;
+ } else {
+ $newacc->trans_complete();
+ $this->messages->add('Added account settings.', 'success');
+ }
/**************** Importing the C/F Values : START ***************/
@@ -451,6 +458,12 @@ class Setting extends Controller {
else
$this->messages->add('Error carrying forward to new account.',
'error');
+
+ /* Adding account settings to file. Code copied from manage controller */
+ $con_details = "[database]" . "\r\n" . "db_hostname =
\"" . $data_database_host . "\"" . "\r\n" .
"db_port = \"" . $data_database_port . "\"" .
"\r\n" . "db_name = \"" . $data_database_name .
"\"" . "\r\n" . "db_username = \"" .
$data_database_username . "\"" . "\r\n" . "db_password =
\"" . $data_database_password . "\"" . "\r\n";
+
+ $con_details_html = '[database]<br />db_hostname = "' .
$data_database_host . '"<br />db_port = "' . $data_database_port .
'"<br />db_name = "' . $data_database_name . '"<br
/>db_username = "' . $data_database_username . '"<br
/>db_password = "' . $data_database_password . '"<br />';
+
/* Writing the connection string to end of file - writing in 'a' append mode
*/
if ( ! write_file($ini_file, $con_details))
{
commit 8c9ba946d527c765b2f4e1326e3e491a35fd5e91
Author: Prashant P Shah <pshah.mumbai(a)gmail.com>
Date: Tue Dec 28 12:08:50 2010 +0530
Check for valid Ledger A/C Type
- Receipt Vouchers must debit atleast one Bank or Cash Ledger A/C
- Payment Vouchers must credit atleast one Bank or Cash Ledger A/C
- Contra Vouchers can only have Bank or Cash Ledger A/C's
- Journal Vouchers can only have non Bank or Cash Ledger A/C's
Signed-off-by: Prashant P Shah <pshah.mumbai(a)gmail.com>
diff --git a/system/application/controllers/voucher.php
b/system/application/controllers/voucher.php
index 38b8cd5..4752758 100644
--- a/system/application/controllers/voucher.php
+++ b/system/application/controllers/voucher.php
@@ -349,24 +349,58 @@ class Voucher extends Controller {
}
else
{
- /* Checking for Debit and Credit Total */
+ /* Checking for Valid Ledgers A/C and Debit and Credit Total */
$data_all_ledger_id = $this->input->post('ledger_id', TRUE);
$data_all_ledger_dc = $this->input->post('ledger_dc', TRUE);
$data_all_dr_amount = $this->input->post('dr_amount', TRUE);
$data_all_cr_amount = $this->input->post('cr_amount', TRUE);
$dr_total = 0;
$cr_total = 0;
+ $bank_cash_present = FALSE; /* Whether atleast one Ledger A/C is Bank or Cash A/C */
foreach ($data_all_ledger_dc as $id => $ledger_data)
{
if ($data_all_ledger_id[$id] < 1)
continue;
/* Check for valid ledger id */
- if ($this->db->query("SELECT id FROM ledgers WHERE id = ?",
array($data_all_ledger_id[$id]))->num_rows() < 1)
+ $valid_ledger_q = $this->db->query("SELECT id, type FROM ledgers WHERE id
= ?", array($data_all_ledger_id[$id]));
+ if ($valid_ledger_q->num_rows() < 1)
{
$this->messages->add('Invalid Ledger A/C.', 'error');
$this->template->load('template', 'voucher/add', $data);
return;
+ } else {
+ /* Check for valid ledger type */
+ $valid_ledger = $valid_ledger_q->row();
+ if ($voucher_type == 'receipt')
+ {
+ if ($data_all_ledger_dc[$id] == 'D' && $valid_ledger->type ==
'B')
+ {
+ $bank_cash_present = TRUE;
+ }
+ } else if ($voucher_type == 'payment')
+ {
+ if ($data_all_ledger_dc[$id] == 'C' && $valid_ledger->type ==
'B')
+ {
+ $bank_cash_present = TRUE;
+ }
+ } else if ($voucher_type == 'contra')
+ {
+ if ($valid_ledger->type != 'B')
+ {
+ $this->messages->add('Invalid Ledger A/C. Contra Vouchers can have only
Bank and Cash Ledgers A/C\'s.', 'error');
+ $this->template->load('template', 'voucher/add', $data);
+ return;
+ }
+ } else if ($voucher_type == 'journal')
+ {
+ if ($valid_ledger->type == 'B')
+ {
+ $this->messages->add('Invalid Ledger A/C. Journal Vouchers cannot have
Bank and Cash Ledgers A/C\'s.', 'error');
+ $this->template->load('template', 'voucher/add', $data);
+ return;
+ }
+ }
}
if ($data_all_ledger_dc[$id] == "D")
@@ -386,6 +420,24 @@ class Voucher extends Controller {
$this->template->load('template', 'voucher/add', $data);
return;
}
+ /* Check if atleast one Bank or Cash Ledger A/C is present */
+ if ($voucher_type == 'receipt')
+ {
+ if ( ! $bank_cash_present)
+ {
+ $this->messages->add('Need to Debit atleast one Bank or Cash A/C',
'error');
+ $this->template->load('template', 'voucher/add', $data);
+ return;
+ }
+ } else if ($voucher_type == 'payment')
+ {
+ if ( ! $bank_cash_present)
+ {
+ $this->messages->add('Need to Credit atleast one Bank or Cash A/C',
'error');
+ $this->template->load('template', 'voucher/add', $data);
+ return;
+ }
+ }
/* Adding main voucher */
$data_number = $this->input->post('voucher_number', TRUE);
@@ -641,26 +693,59 @@ class Voucher extends Controller {
$this->messages->add(validation_errors(), 'error');
$this->template->load('template', 'voucher/edit', $data);
} else {
- /* Checking for Debit and Credit Total */
+ /* Checking for Valid Ledgers A/C and Debit and Credit Total */
$data_all_ledger_id = $this->input->post('ledger_id', TRUE);
$data_all_ledger_dc = $this->input->post('ledger_dc', TRUE);
$data_all_dr_amount = $this->input->post('dr_amount', TRUE);
$data_all_cr_amount = $this->input->post('cr_amount', TRUE);
$dr_total = 0;
$cr_total = 0;
+ $bank_cash_present = FALSE; /* Whether atleast one Ledger A/C is Bank or Cash A/C */
foreach ($data_all_ledger_dc as $id => $ledger_data)
{
if ($data_all_ledger_id[$id] < 1)
continue;
/* Check for valid ledger id */
- if ($this->db->query("SELECT id FROM ledgers WHERE id = ?",
array($data_all_ledger_id[$id]))->num_rows() < 1)
+ $valid_ledger_q = $this->db->query("SELECT id, type FROM ledgers WHERE id
= ?", array($data_all_ledger_id[$id]));
+ if ($valid_ledger_q->num_rows() < 1)
{
$this->messages->add('Invalid Ledger A/C.', 'error');
$this->template->load('template', 'voucher/edit', $data);
return;
+ } else {
+ /* Check for valid ledger type */
+ $valid_ledger = $valid_ledger_q->row();
+ if ($voucher_type == 'receipt')
+ {
+ if ($data_all_ledger_dc[$id] == 'D' && $valid_ledger->type ==
'B')
+ {
+ $bank_cash_present = TRUE;
+ }
+ } else if ($voucher_type == 'payment')
+ {
+ if ($data_all_ledger_dc[$id] == 'C' && $valid_ledger->type ==
'B')
+ {
+ $bank_cash_present = TRUE;
+ }
+ } else if ($voucher_type == 'contra')
+ {
+ if ($valid_ledger->type != 'B')
+ {
+ $this->messages->add('Invalid Ledger A/C. Contra Vouchers can have only
Bank and Cash Ledgers A/C\'s.', 'error');
+ $this->template->load('template', 'voucher/edit', $data);
+ return;
+ }
+ } else if ($voucher_type == 'journal')
+ {
+ if ($valid_ledger->type == 'B')
+ {
+ $this->messages->add('Invalid Ledger A/C. Journal Vouchers cannot have
Bank and Cash Ledgers A/C\'s.', 'error');
+ $this->template->load('template', 'voucher/edit', $data);
+ return;
+ }
+ }
}
-
if ($data_all_ledger_dc[$id] == "D")
{
$dr_total += $data_all_dr_amount[$id];
@@ -678,6 +763,24 @@ class Voucher extends Controller {
$this->template->load('template', 'voucher/edit', $data);
return;
}
+ /* Check if atleast one Bank or Cash Ledger A/C is present */
+ if ($voucher_type == 'receipt')
+ {
+ if ( ! $bank_cash_present)
+ {
+ $this->messages->add('Need to Debit atleast one Bank or Cash A/C',
'error');
+ $this->template->load('template', 'voucher/edit', $data);
+ return;
+ }
+ } else if ($voucher_type == 'payment')
+ {
+ if ( ! $bank_cash_present)
+ {
+ $this->messages->add('Need to Credit atleast one Bank or Cash A/C',
'error');
+ $this->template->load('template', 'voucher/edit', $data);
+ return;
+ }
+ }
/* Updating main voucher */
$data_number = $this->input->post('voucher_number', TRUE);
commit d3b97699e7196e08746bbe2bf73d1b97915a5188
Author: Prashant P Shah <pshah.mumbai(a)gmail.com>
Date: Tue Dec 28 11:36:16 2010 +0530
Show only valid ledger selection
- For contra vouchers only show bank and cash ledgers
- For journal vocuhers only show non bank and cash ledgers
Signed-off-by: Prashant P Shah <pshah.mumbai(a)gmail.com>
diff --git a/system/application/controllers/voucher.php
b/system/application/controllers/voucher.php
index 47e38d2..38b8cd5 100644
--- a/system/application/controllers/voucher.php
+++ b/system/application/controllers/voucher.php
@@ -1040,7 +1040,7 @@ class Voucher extends Controller {
return;
}
- function addrow()
+ function addrow($add_type = 'all')
{
$i = time() + rand (0, time()) + rand (0, time()) + rand (0, time());
$dr_amount = array(
@@ -1066,9 +1066,16 @@ class Voucher extends Controller {
echo '<td>';
echo form_dropdown_dc('ledger_dc[' . $i . ']');
echo '</td>';
+
echo '<td>';
- echo form_input_ledger('ledger_id[' . $i . ']');
+ if ($add_type == 'bankcash')
+ echo form_input_ledger('ledger_id[' . $i . ']', 0, '', $type =
'bankcash');
+ else if ($add_type == 'nobankcash')
+ echo form_input_ledger('ledger_id[' . $i . ']', 0, '', $type =
'nobankcash');
+ else
+ echo form_input_ledger('ledger_id[' . $i . ']');
echo '</td>';
+
echo '<td>';
echo form_input($dr_amount);
echo '</td>';
diff --git a/system/application/helpers/MY_form_helper.php
b/system/application/helpers/MY_form_helper.php
index e3a7dc7..06f7c39 100644
--- a/system/application/helpers/MY_form_helper.php
+++ b/system/application/helpers/MY_form_helper.php
@@ -55,11 +55,17 @@ if ( ! function_exists('form_input_date_restrict'))
if ( ! function_exists('form_input_ledger'))
{
- function form_input_ledger($name, $selected = NULL, $extra = '')
+ function form_input_ledger($name, $selected = NULL, $extra = '', $type =
'all')
{
$CI =& get_instance();
$CI->load->model('Ledger_model');
- $options = $CI->Ledger_model->get_all_ledgers();
+
+ if ($type == 'bankcash')
+ $options = $CI->Ledger_model->get_all_ledgers_bankcash();
+ else if ($type == 'nobankcash')
+ $options = $CI->Ledger_model->get_all_ledgers_nobankcash();
+ else
+ $options = $CI->Ledger_model->get_all_ledgers();
// If no selected state was submitted we will attempt to set it automatically
if ( ! ($selected))
diff --git a/system/application/models/ledger_model.php
b/system/application/models/ledger_model.php
index 465eef2..82075a8 100644
--- a/system/application/models/ledger_model.php
+++ b/system/application/models/ledger_model.php
@@ -19,6 +19,30 @@ class Ledger_model extends Model {
return $options;
}
+ function get_all_ledgers_bankcash()
+ {
+ $options = array();
+ $options[0] = "(Please Select)";
+ $ledger_q = $this->db->query('SELECT * FROM ledgers WHERE type = ? ORDER BY
name ASC', array('B'));
+ foreach ($ledger_q->result() as $row)
+ {
+ $options[$row->id] = $row->name;
+ }
+ return $options;
+ }
+
+ function get_all_ledgers_nobankcash()
+ {
+ $options = array();
+ $options[0] = "(Please Select)";
+ $ledger_q = $this->db->query('SELECT * FROM ledgers WHERE type != ? ORDER BY
name ASC', array('B'));
+ foreach ($ledger_q->result() as $row)
+ {
+ $options[$row->id] = $row->name;
+ }
+ return $options;
+ }
+
function get_name($ledger_id)
{
$ledger_q = $this->db->query('SELECT name FROM ledgers WHERE id = ? LIMIT
1', array($ledger_id));
diff --git a/system/application/views/voucher/add.php
b/system/application/views/voucher/add.php
index b94aeec..78e0f32 100644
--- a/system/application/views/voucher/add.php
+++ b/system/application/views/voucher/add.php
@@ -1,3 +1,11 @@
+<?php
+ if ($voucher_type == "contra")
+ $add_type = "bankcash";
+ else if ($voucher_type == "journal")
+ $add_type = "nobankcash";
+ else
+ $add_type = "all";
+?>
<script type="text/javascript">
$(document).ready(function() {
@@ -166,7 +174,7 @@ $(document).ready(function() {
$('table td .addrow').live('click', function() {
var cur_obj = this;
$.ajax({
- url: <?php echo '\'' . site_url('voucher/addrow') .
'\''; ?>,
+ url: <?php echo '\'' . site_url('voucher/addrow/' . $add_type)
. '\''; ?>,
success: function(data) {
$(cur_obj).parent().parent().after(data);
}
@@ -222,7 +230,13 @@ $(document).ready(function() {
echo "<td>" . form_dropdown_dc('ledger_dc[' . $i . ']',
isset($ledger_dc[$i]) ? $ledger_dc[$i] : "D") . "</td>";
- echo "<td>" . form_input_ledger('ledger_id[' . $i .
']', isset($ledger_id[$i]) ? $ledger_id[$i] : 0) . "</td>";
+ if ($voucher_type == "contra")
+ echo "<td>" . form_input_ledger('ledger_id[' . $i .
']', isset($ledger_id[$i]) ? $ledger_id[$i] : 0, '', $type =
'bankcash') . "</td>";
+ else if ($voucher_type == "journal")
+ echo "<td>" . form_input_ledger('ledger_id[' . $i .
']', isset($ledger_id[$i]) ? $ledger_id[$i] : 0, '', $type =
'nobankcash') . "</td>";
+ else
+ echo "<td>" . form_input_ledger('ledger_id[' . $i .
']', isset($ledger_id[$i]) ? $ledger_id[$i] : 0) . "</td>";
+
echo "<td>" . form_input($dr_amount_item) . "</td>";
echo "<td>" . form_input($cr_amount_item) . "</td>";
diff --git a/system/application/views/voucher/edit.php
b/system/application/views/voucher/edit.php
index caea58a..bbef785 100644
--- a/system/application/views/voucher/edit.php
+++ b/system/application/views/voucher/edit.php
@@ -1,3 +1,11 @@
+<?php
+ if ($voucher_type == "contra")
+ $add_type = "bankcash";
+ else if ($voucher_type == "journal")
+ $add_type = "nobankcash";
+ else
+ $add_type = "all";
+?>
<script type="text/javascript">
$(document).ready(function() {
@@ -166,7 +174,7 @@ $(document).ready(function() {
$('table td .addrow').live('click', function() {
var cur_obj = this;
$.ajax({
- url: <?php echo '\'' . site_url('voucher/addrow') .
'\''; ?>,
+ url: <?php echo '\'' . site_url('voucher/addrow/' . $add_type)
. '\''; ?>,
success: function(data) {
$(cur_obj).parent().parent().after(data);
}
@@ -222,7 +230,13 @@ $(document).ready(function() {
echo "<td>" . form_dropdown_dc('ledger_dc[' . $i . ']',
isset($ledger_dc[$i]) ? $ledger_dc[$i] : "D") . "</td>";
- echo "<td>" . form_input_ledger('ledger_id[' . $i .
']', isset($ledger_id[$i]) ? $ledger_id[$i] : 0) . "</td>";
+ if ($voucher_type == "contra")
+ echo "<td>" . form_input_ledger('ledger_id[' . $i .
']', isset($ledger_id[$i]) ? $ledger_id[$i] : 0, '', $type =
'bankcash') . "</td>";
+ else if ($voucher_type == "journal")
+ echo "<td>" . form_input_ledger('ledger_id[' . $i .
']', isset($ledger_id[$i]) ? $ledger_id[$i] : 0, '', $type =
'nobankcash') . "</td>";
+ else
+ echo "<td>" . form_input_ledger('ledger_id[' . $i .
']', isset($ledger_id[$i]) ? $ledger_id[$i] : 0) . "</td>";
+
echo "<td>" . form_input($dr_amount_item) . "</td>";
echo "<td>" . form_input($cr_amount_item) . "</td>";
commit 2844b2ecc4d6a78f42757bfcff9602802b4161aa
Author: Prashant P Shah <pshah.mumbai(a)gmail.com>
Date: Mon Dec 27 21:50:37 2010 +0530
Showing the Print Email and Download Window
- Showing popups for Print, Email and Download Vouchers
after new and edit voucher using javascript
- Using sessions to store the checkbox values
Signed-off-by: Prashant P Shah <pshah.mumbai(a)gmail.com>
diff --git a/system/application/controllers/voucher.php
b/system/application/controllers/voucher.php
index 0909067..47e38d2 100644
--- a/system/application/controllers/voucher.php
+++ b/system/application/controllers/voucher.php
@@ -290,7 +290,7 @@ class Voucher extends Controller {
$data['voucher_draft'] = FALSE;
$data['voucher_print'] = FALSE;
$data['voucher_email'] = FALSE;
- $data['voucher_pdf'] = FALSE;
+ $data['voucher_download'] = FALSE;
$data['voucher_tags'] = $this->Tag_model->get_all_tags();
$data['voucher_tag'] = 0;
@@ -319,7 +319,7 @@ class Voucher extends Controller {
$data['voucher_draft'] = $this->input->post('voucher_draft',
TRUE);
$data['voucher_print'] = $this->input->post('voucher_print',
TRUE);
$data['voucher_email'] = $this->input->post('voucher_email',
TRUE);
- $data['voucher_pdf'] = $this->input->post('voucher_pdf', TRUE);
+ $data['voucher_download'] =
$this->input->post('voucher_download', TRUE);
$data['voucher_tag'] = $this->input->post('voucher_tag', TRUE);
$data['ledger_dc'] = $this->input->post('ledger_dc', TRUE);
@@ -469,13 +469,33 @@ class Voucher extends Controller {
/* Success */
$this->db->trans_complete();
+ /* Check for Voucher Print, Download, Email */
+ if ($this->input->post('voucher_print', TRUE))
+ {
+ $this->session->set_userdata('print_voucher', TRUE);
+ $this->session->set_userdata('print_voucher_type',
strtolower($voucher_type));
+ $this->session->set_userdata('print_voucher_id', $voucher_id);
+ }
+ if ($this->input->post('voucher_email', TRUE))
+ {
+ $this->session->set_userdata('email_voucher', TRUE);
+ $this->session->set_userdata('email_voucher_type',
strtolower($voucher_type));
+ $this->session->set_userdata('email_voucher_id', $voucher_id);
+ }
+ if ($this->input->post('voucher_download', TRUE))
+ {
+ $this->session->set_userdata('download_voucher', TRUE);
+ $this->session->set_userdata('download_voucher_type',
strtolower($voucher_type));
+ $this->session->set_userdata('download_voucher_id', $voucher_id);
+ }
+
/* Voucher Actions */
$voucher_success_links = "You can ";
$voucher_success_links .= anchor('voucher/view/' . strtolower($voucher_type) .
"/" . $voucher_id, 'View', array('class' =>
'anchor-link-a')) . " or ";
$voucher_success_links .= anchor('voucher/download/' .
strtolower($voucher_type) . "/" . $voucher_id, 'Download',
array('class' => 'anchor-link-a'));
$voucher_success_links .= " it.";
- $this->messages->add('Added ' . ucfirst($voucher_type) . ' Voucher
number ' . voucher_number_prefix($voucher_type) . $data_number .
$voucher_success_links, 'success');
+ $this->messages->add('Added ' . ucfirst($voucher_type) . ' Voucher
number ' . voucher_number_prefix($voucher_type) . $data_number . ". " .
$voucher_success_links, 'success');
$this->logger->write_message("success", "Added " .
ucfirst($voucher_type) . " Voucher number " .
voucher_number_prefix($voucher_type) . $data_number . " [id:" . $voucher_id .
"]");
redirect('voucher/show/' . $voucher_type);
$this->template->load('template', 'voucher/add', $data);
@@ -542,7 +562,7 @@ class Voucher extends Controller {
$data['voucher_draft'] = ($cur_voucher->draft == 0) ? FALSE : TRUE;
$data['voucher_print'] = FALSE;
$data['voucher_email'] = FALSE;
- $data['voucher_pdf'] = FALSE;
+ $data['voucher_download'] = FALSE;
$data['voucher_tag'] = $cur_voucher->tag_id;
$data['voucher_tags'] = $this->Tag_model->get_all_tags();
@@ -607,7 +627,7 @@ class Voucher extends Controller {
$data['voucher_draft'] = $this->input->post('voucher_draft',
TRUE);
$data['voucher_print'] = $this->input->post('voucher_print',
TRUE);
$data['voucher_email'] = $this->input->post('voucher_email',
TRUE);
- $data['voucher_pdf'] = $this->input->post('voucher_pdf', TRUE);
+ $data['voucher_download'] =
$this->input->post('voucher_download', TRUE);
$data['voucher_tag'] = $this->input->post('voucher_tag', TRUE);
$data['ledger_dc'] = $this->input->post('ledger_dc', TRUE);
@@ -748,13 +768,33 @@ class Voucher extends Controller {
/* Success */
$this->db->trans_complete();
+ /* Check for Voucher Print, Download, Email */
+ if ($this->input->post('voucher_print', TRUE))
+ {
+ $this->session->set_userdata('print_voucher', TRUE);
+ $this->session->set_userdata('print_voucher_type',
strtolower($voucher_type));
+ $this->session->set_userdata('print_voucher_id', $voucher_id);
+ }
+ if ($this->input->post('voucher_email', TRUE))
+ {
+ $this->session->set_userdata('email_voucher', TRUE);
+ $this->session->set_userdata('email_voucher_type',
strtolower($voucher_type));
+ $this->session->set_userdata('email_voucher_id', $voucher_id);
+ }
+ if ($this->input->post('voucher_download', TRUE))
+ {
+ $this->session->set_userdata('download_voucher', TRUE);
+ $this->session->set_userdata('download_voucher_type',
strtolower($voucher_type));
+ $this->session->set_userdata('download_voucher_id', $voucher_id);
+ }
+
/* Voucher Actions */
$voucher_success_links = "You can ";
$voucher_success_links .= anchor('voucher/view/' . strtolower($voucher_type) .
"/" . $voucher_id, 'View', array('class' =>
'anchor-link-a')) . " or ";
$voucher_success_links .= anchor('voucher/download/' .
strtolower($voucher_type) . "/" . $voucher_id, 'Download',
array('class' => 'anchor-link-a'));
$voucher_success_links .= " it.";
- $this->messages->add('Updated ' . ucfirst($voucher_type) . ' Voucher
number ' . voucher_number_prefix($voucher_type) . $data_number .
$voucher_success_links, 'success');
+ $this->messages->add('Updated ' . ucfirst($voucher_type) . ' Voucher
number ' . voucher_number_prefix($voucher_type) . $data_number . ". " .
$voucher_success_links, 'success');
$this->logger->write_message("success", "Updated " .
ucfirst($voucher_type) . " Voucher number " .
voucher_number_prefix($voucher_type) . $data_number . " [id:" . $voucher_id .
"]");
redirect('voucher/show/' . $voucher_type);
return;
diff --git a/system/application/views/voucher/add.php
b/system/application/views/voucher/add.php
index 3aa5fa5..b94aeec 100644
--- a/system/application/views/voucher/add.php
+++ b/system/application/views/voucher/add.php
@@ -257,7 +257,7 @@ $(document).ready(function() {
echo
" ";
echo form_checkbox('voucher_email', 1, $voucher_email) . "Email";
echo
" ";
- echo form_checkbox('voucher_pdf', 1, $voucher_pdf) . "Download";
+ echo form_checkbox('voucher_download', 1, $voucher_download) .
"Download";
echo form_fieldset_close();
echo "</p>";
echo "<br /><br />";
diff --git a/system/application/views/voucher/edit.php
b/system/application/views/voucher/edit.php
index 036086e..caea58a 100644
--- a/system/application/views/voucher/edit.php
+++ b/system/application/views/voucher/edit.php
@@ -257,7 +257,7 @@ $(document).ready(function() {
echo
" ";
echo form_checkbox('voucher_email', 1, $voucher_email) . "Email";
echo
" ";
- echo form_checkbox('voucher_pdf', 1, $voucher_pdf) . "Download";
+ echo form_checkbox('voucher_download', 1, $voucher_download) .
"Download";
echo form_fieldset_close();
echo "</p>";
echo "<br /><br />";
diff --git a/system/application/views/voucher/index.php
b/system/application/views/voucher/index.php
index 4c8496a..4fe4f7d 100644
--- a/system/application/views/voucher/index.php
+++ b/system/application/views/voucher/index.php
@@ -3,5 +3,30 @@
</div>
<?php echo $voucher_table ?>
+
+<?php
+ /* Check for Voucher Print, Download, Email */
+ if ($this->session->userdata('print_voucher'))
+ {
+ print "<script
type=\"text/javascript\">$(document).ready(function()
{window.open('http://localhost/webzash/index.php/voucher/printpreview/" .
$this->session->userdata('print_voucher_type') . "/" .
$this->session->userdata('print_voucher_id') . "',
'_blank',
'width=600,height=600,scrollbars=yes,status=yes,resizable=yes,screenx=0,screeny=0');
});</script>";
+ $this->session->unset_userdata('print_voucher');
+ $this->session->unset_userdata('print_voucher_type');
+ $this->session->unset_userdata('print_voucher_id');
+ }
+ if ($this->session->userdata('email_voucher'))
+ {
+ print "<script
type=\"text/javascript\">$(document).ready(function()
{window.open('http://localhost/webzash/index.php/voucher/email/" .
$this->session->userdata('email_voucher_type') . "/" .
$this->session->userdata('email_voucher_id') . "',
'_blank',
'width=500,height=300,scrollbars=yes,status=yes,resizable=yes,screenx=0,screeny=0');
});</script>";
+ $this->session->unset_userdata('email_voucher');
+ $this->session->unset_userdata('email_voucher_type');
+ $this->session->unset_userdata('email_voucher_id');
+ }
+ if ($this->session->userdata('download_voucher'))
+ {
+ print "<script
type=\"text/javascript\">$(document).ready(function()
{window.open('http://localhost/webzash/index.php/voucher/download/" .
$this->session->userdata('download_voucher_type') . "/" .
$this->session->userdata('download_voucher_id') . "',
'_blank',
'width=600,height=600,scrollbars=yes,status=yes,resizable=yes,screenx=0,screeny=0');
});</script>";
+ $this->session->unset_userdata('download_voucher');
+ $this->session->unset_userdata('download_voucher_type');
+ $this->session->unset_userdata('download_voucher_id');
+ }
+?>
<div id="pagination-container"><?php echo
$this->pagination->create_links(); ?></div>
commit 0de1581a0e6f845ed80170ad011355cc0be7056d
Author: Prashant P Shah <pshah.mumbai(a)gmail.com>
Date: Sun Dec 26 18:48:54 2010 +0530
Removed email settings from config
Signed-off-by: Prashant P Shah <pshah.mumbai(a)gmail.com>
diff --git a/system/application/controllers/setting.php
b/system/application/controllers/setting.php
index 94d8b96..30b9e71 100644
--- a/system/application/controllers/setting.php
+++ b/system/application/controllers/setting.php
@@ -155,8 +155,12 @@ class Setting extends Controller {
$this->load->helper('file');
$this->load->library('accountlist');
$this->load->model('Ledger_model');
+ $this->load->model('Setting_model');
$this->template->set('page_title', 'Carry forward account');
+ /* Current settings */
+ $account_data = $this->Setting_model->get_current();
+
/* Form fields */
$last_year_end = $this->config->item('account_fy_end');
list($last_year_end_date, $last_year_end_time) = explode(' ', $last_year_end);
@@ -282,11 +286,12 @@ class Setting extends Controller {
$data_account_currency =
$this->config->item('account_currency_symbol');
$data_account_date = $this->config->item('account_date_format');
$data_account_timezone = $this->config->item('account_timezone');
- $data_account_email_protocol =
$this->config->item('account_email_protocol');
- $data_account_email_host = $this->config->item('account_email_host');
- $data_account_email_port = $this->config->item('account_email_port');
- $data_account_email_username =
$this->config->item('account_email_username');
- $data_account_email_password =
$this->config->item('account_email_password');
+
+ $data_account_email_protocol = $account_data->email_protocol;
+ $data_account_email_host = $account_data->email_host;
+ $data_account_email_port = $account_data->email_port;
+ $data_account_email_username = $account_data->email_username;
+ $data_account_email_password = $account_data->email_password;
$data_database_host = $this->input->post('database_host', TRUE);
$data_database_port = $this->input->post('database_port', TRUE);
diff --git a/system/application/controllers/voucher.php
b/system/application/controllers/voucher.php
index ac56a86..0909067 100644
--- a/system/application/controllers/voucher.php
+++ b/system/application/controllers/voucher.php
@@ -898,7 +898,7 @@ class Voucher extends Controller {
$this->load->model('Ledger_model');
$this->load->library('email');
- $account = $this->Setting_model->get_current();
+ $account_data = $this->Setting_model->get_current();
/* Load current voucher details */
if ( ! $cur_voucher = $this->Voucher_model->get_voucher($voucher_id,
$voucher_type))
@@ -964,28 +964,34 @@ class Voucher extends Controller {
/* Preparing message */
$message = $this->load->view('voucher/emailpreview', $voucher_data,
TRUE);
- /* Sending email */
- $config['protocol'] =
$this->config->item('account_email_protocol');
- $config['smtp_host'] =
$this->config->item('account_email_host');
- $config['smtp_port'] =
$this->config->item('account_email_port');
+ /* Getting email configuration */
$config['smtp_timeout'] = '30';
- $config['smtp_user'] =
$this->config->item('account_email_username');
- $config['smtp_pass'] =
$this->config->item('account_email_password');
$config['charset'] = 'utf-8';
$config['newline'] = "\r\n";
$config['mailtype'] = "html";
+ if ($account_data)
+ {
+ $config['protocol'] = $account_data->email_protocol;
+ $config['smtp_host'] = $account_data->email_host;
+ $config['smtp_port'] = $account_data->email_port;
+ $config['smtp_user'] = $account_data->email_username;
+ $config['smtp_pass'] = $account_data->email_password;
+ } else {
+ $data['error'] = 'Invalid account details.';
+ }
$this->email->initialize($config);
+ /* Sending email */
$this->email->from('', 'Webzash');
$this->email->to($this->input->post('email_to', TRUE));
$this->email->subject(ucfirst($voucher_type) . ' Voucher No. ' .
voucher_number_prefix($voucher_type) . $cur_voucher->number);
$this->email->message($message);
if ($this->email->send())
{
- $data['message'] = "Successfully sent email !";
+ $data['message'] = "Email sent.";
$this->logger->write_message("success", "Emailed " .
ucfirst($voucher_type) . " Voucher number " .
voucher_number_prefix($voucher_type) . $cur_voucher->number . " [id:" .
$voucher_id . "]");
} else {
- $data['error'] = "Error sending email. Please check you email
settings";
+ $data['error'] = "Error sending email. Check you email settings.";
$this->logger->write_message("error", "Error emailing " .
ucfirst($voucher_type) . " Voucher number " .
voucher_number_prefix($voucher_type) . $cur_voucher->number . " [id:" .
$voucher_id . "]");
}
$this->load->view('voucher/email', $data);
diff --git a/system/application/libraries/Startup.php
b/system/application/libraries/Startup.php
index 6494597..dd5c724 100644
--- a/system/application/libraries/Startup.php
+++ b/system/application/libraries/Startup.php
@@ -139,11 +139,6 @@ class Startup
$CI->config->set_item('account_currency_symbol',
$account_d->currency_symbol);
$CI->config->set_item('account_date_format',
$account_d->date_format);
$CI->config->set_item('account_timezone', $account_d->timezone);
- $CI->config->set_item('account_email_protocol',
$account_d->email_protocol);
- $CI->config->set_item('account_email_host', $account_d->email_host);
- $CI->config->set_item('account_email_port', $account_d->email_port);
- $CI->config->set_item('account_email_username',
$account_d->email_username);
- $CI->config->set_item('account_email_password',
$account_d->email_password);
$CI->config->set_item('account_receipt_prefix',
$account_d->receipt_voucher_prefix);
$CI->config->set_item('account_payment_prefix',
$account_d->payment_voucher_prefix);
$CI->config->set_item('account_contra_prefix',
$account_d->contra_voucher_prefix);
commit d823d479dc987f9b8d6b6f08f85d2690d12b01e2
Author: Prashant P Shah <pshah.mumbai(a)gmail.com>
Date: Fri Dec 24 14:30:09 2010 +0530
Updated css and messages
Signed-off-by: Prashant P Shah <pshah.mumbai(a)gmail.com>
diff --git a/system/application/assets/css/admin-style.css
b/system/application/assets/css/admin-style.css
index 9b51bd3..d93301c 100644
--- a/system/application/assets/css/admin-style.css
+++ b/system/application/assets/css/admin-style.css
@@ -115,7 +115,7 @@ body {
border:solid 1px #787878;
background:#F0F0F0;
color:#222222;
- margin:0 0 10px 0;
+ margin:10px 0 10px 0;
text-align:left;
}
@@ -123,7 +123,7 @@ body {
border:solid 1px #C34A2C;
background:#FFBABA;
color:#222222;
- margin:0 0 10px 0;
+ margin:10px 0 10px 0;
text-align:left;
}
@@ -131,7 +131,7 @@ body {
border:solid 1px #FFEC8B;
background:#FFF8C6;
color:#222222;
- margin:0 0 10px 0;
+ margin:10px 0 10px 0;
text-align:left;
}
diff --git a/system/application/assets/css/style.css
b/system/application/assets/css/style.css
index 7cda02a..027492b 100644
--- a/system/application/assets/css/style.css
+++ b/system/application/assets/css/style.css
@@ -121,7 +121,7 @@ body {
border:solid 1px #787878;
background:#F0F0F0;
color:#222222;
- margin:0 0 10px 0;
+ margin:10px 0 10px 0;
text-align:left;
}
@@ -129,7 +129,7 @@ body {
border:solid 1px #C34A2C;
background:#FFBABA;
color:#222222;
- margin:0 0 10px 0;
+ margin:10px 0 10px 0;
text-align:left;
}
@@ -137,7 +137,7 @@ body {
border:solid 1px #FFEC8B;
background:#FFF8C6;
color:#222222;
- margin:0 0 10px 0;
+ margin:10px 0 10px 0;
text-align:left;
}
diff --git a/system/application/libraries/Startup.php
b/system/application/libraries/Startup.php
index d1519d4..6494597 100644
--- a/system/application/libraries/Startup.php
+++ b/system/application/libraries/Startup.php
@@ -91,7 +91,7 @@ class Startup
$db_config['dbcollat'] = "utf8_general_ci";
$CI->load->database($db_config, FALSE, TRUE);
} else {
- $CI->messages->add('Please select a account.', 'error');
+ $CI->messages->add('Select a valid account.', 'error');
redirect('admin');
}
commit 4d3a5e9e8067c35e32f330e7d49326228b9c6540
Author: Prashant P Shah <pshah.mumbai(a)gmail.com>
Date: Fri Dec 24 14:24:19 2010 +0530
Updated all messages to the same format
Signed-off-by: Prashant P Shah <pshah.mumbai(a)gmail.com>
diff --git a/system/application/controllers/account.php
b/system/application/controllers/account.php
index 309bb41..7d04008 100644
--- a/system/application/controllers/account.php
+++ b/system/application/controllers/account.php
@@ -11,9 +11,9 @@ class Account extends Controller {
$total_op = $this->Ledger_model->get_diff_op_balance();
if ($total_op > 0)
{
- $this->messages->add("Difference in Opening Balance is Dr " .
convert_cur($total_op) . '.', 'error');
+ $this->messages->add('Difference in Opening Balance is Dr ' .
convert_cur($total_op) . '.', 'error');
} else if ($total_op < 0) {
- $this->messages->add("Difference in Opening Balance is Cr " .
convert_cur(-$total_op) . '.', 'error');
+ $this->messages->add('Difference in Opening Balance is Cr ' .
convert_cur(-$total_op) . '.', 'error');
}
$this->template->load('template', 'account/index');
diff --git a/system/application/controllers/admin/active.php
b/system/application/controllers/admin/active.php
index 5fdbf84..01a6267 100644
--- a/system/application/controllers/admin/active.php
+++ b/system/application/controllers/admin/active.php
@@ -69,7 +69,7 @@ class Active extends Controller {
/* Check if database ini file exists */
if ( ! get_file_info($ini_file))
{
- $this->messages->add("Account setting file is missing.",
'error');
+ $this->messages->add('Account settings file is missing.',
'error');
$this->template->load('admin_template', 'admin/active',
$data);
return;
}
@@ -78,7 +78,7 @@ class Active extends Controller {
$active_accounts = parse_ini_file($ini_file);
if ( ! $active_accounts)
{
- $this->messages->add("Invalid account setting file.",
'error');
+ $this->messages->add('Invalid account settings file.',
'error');
$this->template->load('admin_template', 'admin/active',
$data);
return;
}
@@ -86,38 +86,38 @@ class Active extends Controller {
/* Check if all needed variables are set in ini file */
if ( ! isset($active_accounts['db_hostname']))
{
- $this->messages->add("Hostname missing from account setting file.",
'error');
+ $this->messages->add('Hostname missing from account settings file.',
'error');
$this->template->load('admin_template', 'admin/active',
$data);
return;
}
if ( ! isset($active_accounts['db_port']))
{
- $this->messages->add("Port missing from account setting file. Default
MySQL port is 3306.", 'error');
+ $this->messages->add('Port missing from account settings file. Default
MySQL port is 3306.', 'error');
$this->template->load('admin_template', 'admin/active',
$data);
return;
}
if ( ! isset($active_accounts['db_name']))
{
- $this->messages->add("Database name missing from account setting
file.", 'error');
+ $this->messages->add('Database name missing from account settings
file.', 'error');
$this->template->load('admin_template', 'admin/active',
$data);
return;
}
if ( ! isset($active_accounts['db_username']))
{
- $this->messages->add("Database username missing from account setting
file.", 'error');
+ $this->messages->add('Database username missing from account settings
file.', 'error');
$this->template->load('admin_template', 'admin/active',
$data);
return;
}
if ( ! isset($active_accounts['db_password']))
{
- $this->messages->add("Database password missing from account setting
file.", 'error');
+ $this->messages->add('Database password missing from account settings
file.', 'error');
$this->template->load('admin_template', 'admin/active',
$data);
return;
}
/* Setting new account database details in session */
$this->session->set_userdata('db_active_label', $db_label);
- $this->messages->add("Active account settings changed.",
'success');
+ $this->messages->add('Active account settings changed.',
'success');
redirect('admin');
}
return;
diff --git a/system/application/controllers/admin/create.php
b/system/application/controllers/admin/create.php
index 11a2317..5fc5d05 100644
--- a/system/application/controllers/admin/create.php
+++ b/system/application/controllers/admin/create.php
@@ -204,7 +204,7 @@ class Create extends Controller {
/* Check if database ini file exists */
if (get_file_info($ini_file))
{
- $this->messages->add("Account with same label already exists.",
'error');
+ $this->messages->add('Account with same label already exists.',
'error');
$this->template->load('admin_template', 'admin/create',
$data);
return;
}
@@ -212,7 +212,7 @@ class Create extends Controller {
/* Check if start date is less than end date */
if ($data_fy_end <= $data_fy_start)
{
- $this->messages->add("Financial start date cannot be greater than end
date.", 'error');
+ $this->messages->add('Financial start date cannot be greater than end
date.', 'error');
$this->template->load('admin_template', 'admin/create',
$data);
return;
}
@@ -234,12 +234,12 @@ class Create extends Controller {
{
if ($newacc->query("CREATE DATABASE " .
mysql_real_escape_string($data_database_name)))
{
- $this->messages->add("New database created.", 'success');
+ $this->messages->add('New account database created.',
'success');
/* Retrying to connect to new database */
$newacc = $this->load->database($dsn, TRUE);
$conn_error = $newacc->_error_message();
} else {
- $this->messages->add("Cannot create database.", 'error');
+ $this->messages->add('Failed to create account database.',
'error');
$this->template->load('admin_template', 'admin/create',
$data);
return;
}
@@ -248,15 +248,15 @@ class Create extends Controller {
if ( ! $newacc->conn_id)
{
- $this->messages->add("Cannot connecting to database.",
'error');
+ $this->messages->add('Error connecting to database.',
'error');
$this->template->load('admin_template', 'admin/create',
$data);
return;
} else if ($conn_error != "") {
- $this->messages->add("Error connecting to database. " .
$newacc->_error_message(), 'error');
+ $this->messages->add('Error connecting to database. ' .
$newacc->_error_message(), 'error');
$this->template->load('admin_template', 'admin/create',
$data);
return;
} else if ($newacc->query("SHOW TABLES")->num_rows() > 0) {
- $this->messages->add("Selected database in not empty.",
'error');
+ $this->messages->add('Selected database in not empty.',
'error');
$this->template->load('admin_template', 'admin/create',
$data);
return;
} else {
@@ -272,9 +272,11 @@ class Create extends Controller {
$this->messages->add($newacc->_error_message(), 'error');
}
+ $this->messages->add('Created account database.', 'success');
+
/* Adding the account settings */
$newacc->query("INSERT INTO settings (id, name, address, email, fy_start,
fy_end, currency_symbol, date_format, timezone, database_version) VALUES (?, ?, ?, ?, ?,
?, ?, ?, ?, ?)", array(1, $data_account_name, $data_account_address,
$data_account_email, $data_fy_start, $data_fy_end, $data_account_currency,
$data_account_date, $data_account_timezone, 1));
- $this->messages->add("Successfully created webzash account.",
'success');
+ $this->messages->add('Added account information.', 'success');
/* Adding account settings to file. Code copied from manage controller */
$con_details = "[database]" . "\r\n" . "db_hostname =
\"" . $data_database_host . "\"" . "\r\n" .
"db_port = \"" . $data_database_port . "\"" .
"\r\n" . "db_name = \"" . $data_database_name .
"\"" . "\r\n" . "db_username = \"" .
$data_database_username . "\"" . "\r\n" . "db_password =
\"" . $data_database_password . "\"" . "\r\n";
@@ -284,10 +286,10 @@ class Create extends Controller {
/* Writing the connection string to end of file - writing in 'a' append mode
*/
if ( ! write_file($ini_file, $con_details))
{
- $this->messages->add("Failed to add account settings file. Please check
if \"" . $ini_file . "\" file is writable.", 'error');
- $this->messages->add("You can manually create a text file \"" .
$ini_file . "\" with the following content :<br /><br />" .
$con_details_html, 'error');
+ $this->messages->add('Failed to create account settings file. Check if
"' . $ini_file . '" file is writable.', 'error');
+ $this->messages->add('You can manually create a text file "' .
$ini_file . '" with the following content :<br /><br />' .
$con_details_html, 'error');
} else {
- $this->messages->add("Successfully added webzash account settings file to
list of active accounts.", 'success');
+ $this->messages->add('Added account settings file to list of active
accounts.', 'success');
}
redirect('admin');
diff --git a/system/application/controllers/admin/manage.php
b/system/application/controllers/admin/manage.php
index 5b24793..550fd5e 100644
--- a/system/application/controllers/admin/manage.php
+++ b/system/application/controllers/admin/manage.php
@@ -124,7 +124,7 @@ class Manage extends Controller {
/* Check if database ini file exists */
if (get_file_info($ini_file))
{
- $this->messages->add("Account with same label already exists.",
'error');
+ $this->messages->add('Account with same label already exists.',
'error');
$this->template->load('admin_template', 'admin/manage/add',
$data);
return;
}
@@ -136,12 +136,12 @@ class Manage extends Controller {
/* Writing the connection string to end of file - writing in 'a' append mode
*/
if ( ! write_file($ini_file, $con_details))
{
- $this->messages->add("Failed to add account settings file. Please check if
\"" . $ini_file . "\" file is writable.", 'error');
- $this->messages->add("You can manually create a text file \"" .
$ini_file . "\" with the following content :<br /><br />" .
$con_details_html, 'error');
+ $this->messages->add('Failed to add account settings file. Check if
"' . $ini_file . '" file is writable.', 'error');
+ $this->messages->add('You can manually create a text file "' .
$ini_file . '" with the following content :<br /><br />' .
$con_details_html, 'error');
$this->template->load('admin_template', 'admin/manage/add',
$data);
return;
} else {
- $this->messages->add("Successfully added webzash account to list of active
accounts.", 'success');
+ $this->messages->add('Added account to list of active accounts.',
'success');
redirect('admin/manage');
return;
}
@@ -209,37 +209,37 @@ class Manage extends Controller {
/* Check if database ini file exists */
if ( ! get_file_info($ini_file))
{
- $this->messages->add("Invalid account. Account setting file labeled "
. $database_label . " does not exists.", 'error');
+ $this->messages->add('Account settings file labeled ' . $database_label
. ' does not exists.', 'error');
} else {
/* Parsing database ini file */
$active_accounts = parse_ini_file($ini_file);
if ( ! $active_accounts)
{
- $CI->messages->add("Invalid account setting file",
'error');
+ $CI->messages->add('Invalid account settings file', 'error');
} else {
/* Check if all needed variables are set in ini file */
if (isset($active_accounts['db_hostname']))
$data['database_host']['value'] =
$active_accounts['db_hostname'];
else
- $CI->messages->add("Hostname missing from account setting file",
'error');
+ $CI->messages->add('Hostname missing from account settings file',
'error');
if (isset($active_accounts['db_port']))
$data['database_port']['value'] =
$active_accounts['db_port'];
else
- $CI->messages->add("Port missing from account setting file. Default
MySQL port is 3306", 'error');
+ $CI->messages->add('Port missing from account settings file. Default
MySQL port is 3306', 'error');
if (isset($active_accounts['db_name']))
$data['database_name']['value'] =
$active_accounts['db_name'];
else
- $CI->messages->add("Database name missing from account setting
file", 'error');
+ $CI->messages->add('Database name missing from account settings
file', 'error');
if (isset($active_accounts['db_username']))
$data['database_username']['value'] =
$active_accounts['db_username'];
else
- $CI->messages->add("Database username missing from account setting
file", 'error');
+ $CI->messages->add('Database username missing from account settings
file', 'error');
if ( ! isset($active_accounts['db_password']))
- $CI->messages->add("Database password missing from account setting
file", 'error');
+ $CI->messages->add('Database password missing from account settings
file', 'error');
}
}
}
@@ -271,12 +271,12 @@ class Manage extends Controller {
/* Writing the connection string to end of file - writing in 'a' append mode
*/
if ( ! write_file($ini_file, $con_details))
{
- $this->messages->add("Failed to edit account settings file. Please check
if \"" . $ini_file . "\" file is writable.", 'error');
- $this->messages->add("You can manually update the text file \""
. $ini_file . "\" with the following content :<br /><br />" .
$con_details_html, 'error');
+ $this->messages->add('Failed to edit account settings file. Check if
"' . $ini_file . '" file is writable.', 'error');
+ $this->messages->add('You can manually update the text file "' .
$ini_file . '" with the following content :<br /><br />' .
$con_details_html, 'error');
$this->template->load('admin_template', 'admin/manage/edit',
$data);
return;
} else {
- $this->messages->add("Successfully updated webzash account
settings.", 'success');
+ $this->messages->add('Updated account settings.', 'success');
redirect('admin/manage');
return;
}
@@ -289,8 +289,8 @@ class Manage extends Controller {
$this->template->set('page_title', 'Delete a webzash account');
$ini_file = $this->config->item('config_path') . "accounts/" .
$database_label . ".ini";
- $this->messages->add("Please delete " . $ini_file . " file
manually.", 'error');
- $this->messages->add("Note that only the settings file will be delete.
Account database will have to be deleted manually.", 'status');
+ $this->messages->add('Delete ' . $ini_file . ' file manually.',
'error');
+ $this->messages->add('Only the settings file will be delete. Account database
will have to be deleted manually.', 'status');
/*
if ( ! get_file_info($ini_file))
{
diff --git a/system/application/controllers/admin/setting.php
b/system/application/controllers/admin/setting.php
index b65a247..c1a0070 100644
--- a/system/application/controllers/admin/setting.php
+++ b/system/application/controllers/admin/setting.php
@@ -60,7 +60,7 @@ class Setting extends Controller {
if ($data_row_count < 0 || $data_row_count > 200)
{
- $this->messages->add('Invalid value for Row Count.', 'error');
+ $this->messages->add('Invalid number of rows.', 'error');
$this->template->load('admin_template', 'admin/setting');
return;
}
@@ -72,12 +72,12 @@ class Setting extends Controller {
/* Writing the connection string to end of file - writing in 'a' append mode
*/
if ( ! write_file($ini_file, $new_setting))
{
- $this->messages->add("Failed to update settings file. Please check if
\"" . $ini_file . "\" file is writable.", 'error');
- $this->messages->add("You can manually create a text file \"" .
$ini_file . "\" with the following content :<br /><br />" .
$new_setting_html, 'error');
+ $this->messages->add('Failed to update settings file. Check if "'
. $ini_file . '" file is writable.', 'error');
+ $this->messages->add('You can manually create a text file "' .
$ini_file . '" with the following content :<br /><br />' .
$new_setting_html, 'error');
$this->template->load('admin_template', 'admin/setting',
$data);
return;
} else {
- $this->messages->add('General settings updated successfully.',
'success');
+ $this->messages->add('General settings updated.', 'success');
redirect('admin/setting');
return;
}
diff --git a/system/application/controllers/admin/welcome.php
b/system/application/controllers/admin/welcome.php
index cc4ed1e..14e99c0 100644
--- a/system/application/controllers/admin/welcome.php
+++ b/system/application/controllers/admin/welcome.php
@@ -27,40 +27,40 @@ class Welcome extends Controller {
/* Check if database ini file exists */
if ( ! get_file_info($ini_file))
{
- $this->messages->add("Account setting file is missing.",
'error');
+ $this->messages->add('Account settings file is missing.',
'error');
} else {
/* Parsing database ini file */
$active_accounts = parse_ini_file($ini_file);
if ( ! $active_accounts)
{
- $this->messages->add("Invalid account setting file.",
'error');
+ $this->messages->add('Invalid account settings file.',
'error');
} else {
/* Check if all needed variables are set in ini file */
$ini_ok = TRUE;
if ( ! isset($active_accounts['db_hostname']))
{
$ini_ok = FALSE;
- $this->messages->add("Hostname missing from account setting file.",
'error');
+ $this->messages->add('Hostname missing from account settings file.',
'error');
}
if ( ! isset($active_accounts['db_port']))
{
$ini_ok = FALSE;
- $this->messages->add("Port missing from account setting file. Default
MySQL port is 3306.", 'error');
+ $this->messages->add('Port missing from account settings file. Default
MySQL port is 3306.', 'error');
}
if ( ! isset($active_accounts['db_name']))
{
$ini_ok = FALSE;
- $this->messages->add("Database name missing from account setting
file.", 'error');
+ $this->messages->add('Database name missing from account settings
file.', 'error');
}
if ( ! isset($active_accounts['db_username']))
{
$ini_ok = FALSE;
- $this->messages->add("Database username missing from account setting
file.", 'error');
+ $this->messages->add('Database username missing from account settings
file.', 'error');
}
if ( ! isset($active_accounts['db_password']))
{
$ini_ok = FALSE;
- $this->messages->add("Database password missing from account setting
file.", 'error');
+ $this->messages->add('Database password missing from account settings
file.', 'error');
}
if ($ini_ok)
@@ -85,7 +85,7 @@ class Welcome extends Controller {
}
} else {
$is_label_set = FALSE;
- $this->messages->add('Please select a Webzash database.',
'error');
+ $this->messages->add('Select a valid account.', 'error');
}
if ($is_label_set)
@@ -105,7 +105,7 @@ class Welcome extends Controller {
if ( ! $valid_db_q)
{
$valid_webzash_db = FALSE;
- $this->messages->add('Invalid Webzash database.', 'error');
+ $this->messages->add('Invalid account database.', 'error');
break;
}
}
@@ -129,10 +129,10 @@ class Welcome extends Controller {
}
}
} else {
- $this->messages->add('Invalid database connection settings. Please check
whether the provided database name, username and password is valid.',
'error');
+ $this->messages->add('Invalid database connection settings. Verify whether
the provided database name, username and password is valid.', 'error');
}
} else {
- $this->messages->add('Cannot connect to database server. Please check
whether database server is running.', 'error');
+ $this->messages->add('Cannot connect to database server. Verify whether
database server is running.', 'error');
}
}
diff --git a/system/application/controllers/group.php
b/system/application/controllers/group.php
index a4af1ad..f5d24d7 100644
--- a/system/application/controllers/group.php
+++ b/system/application/controllers/group.php
@@ -85,7 +85,7 @@ class Group extends Controller {
return;
} else {
$this->db->trans_complete();
- $this->messages->add($data_name . ' - Group A/C added successfully.',
'success');
+ $this->messages->add('Added ' . $data_name . ' - Group A/C.',
'success');
$this->logger->write_message("success", "Added Group A/C named
" . $data_name);
redirect('account');
return;
@@ -198,7 +198,7 @@ class Group extends Controller {
return;
} else {
$this->db->trans_complete();
- $this->messages->add($data_name . ' - Group A/C updated successfully.',
'success');
+ $this->messages->add('Updated ' . $data_name . ' - Group A/C.',
'success');
$this->logger->write_message("success", "Updated Group A/C named
" . $data_name . " [id:" . $data_id . "]");
redirect('account');
return;
@@ -253,13 +253,13 @@ class Group extends Controller {
if ( ! $this->db->query("DELETE FROM groups WHERE id = ?",
array($id)))
{
$this->db->trans_rollback();
- $this->messages->add("Error deleting " . $group_data->name . "
- Group A/C.", 'error');
+ $this->messages->add('Error deleting ' . $group_data->name . ' -
Group A/C.', 'error');
$this->logger->write_message("error", "Error deleting Group A/C
named " . $group_data->name . " [id:" . $id . "]");
redirect('account');
return;
} else {
$this->db->trans_complete();
- $this->messages->add($group_data->name . ' - Group A/C deleted
successfully.', 'success');
+ $this->messages->add('Deleted ' . $group_data->name . ' - Group
A/C.', 'success');
$this->logger->write_message("success", "Deleted Group A/C named
" . $group_data->name . " [id:" . $id . "]");
redirect('account');
return;
diff --git a/system/application/controllers/ledger.php
b/system/application/controllers/ledger.php
index 1b4bde3..20ee0aa 100644
--- a/system/application/controllers/ledger.php
+++ b/system/application/controllers/ledger.php
@@ -73,7 +73,7 @@ class Ledger extends Controller {
if ($data_group_id < 5)
{
- $this->messages->add("Invalid parent group.", 'error');
+ $this->messages->add('Invalid parent group.', 'error');
$this->template->load('template', 'ledger/add', $data);
return;
}
@@ -101,7 +101,7 @@ class Ledger extends Controller {
return;
} else {
$this->db->trans_complete();
- $this->messages->add($data_name . ' - Ledger A/C added successfully.',
'success');
+ $this->messages->add('Added ' . $data_name . ' - Ledger A/C.',
'success');
$this->logger->write_message("success", "Added Ledger A/C named
" . $data_name);
redirect('account');
return;
@@ -192,7 +192,7 @@ class Ledger extends Controller {
if ($data_group_id < 5)
{
- $this->messages->add("Invalid parent group.", 'error');
+ $this->messages->add('Invalid parent group.', 'error');
$this->template->load('template', 'ledger/edit', $data);
return;
}
@@ -220,7 +220,7 @@ class Ledger extends Controller {
return;
} else {
$this->db->trans_complete();
- $this->messages->add($data_name . ' - Ledger A/C updated
successfully.', 'success');
+ $this->messages->add('Updated ' . $data_name . ' - Ledger
A/C.', 'success');
$this->logger->write_message("success", "Updated Ledger A/C
named " . $data_name . " [id:" . $data_id . "]");
redirect('account');
return;
@@ -264,13 +264,13 @@ class Ledger extends Controller {
if ( ! $this->db->query("DELETE FROM ledgers WHERE id = ?",
array($id)))
{
$this->db->trans_rollback();
- $this->messages->add("Error deleting " . $ledger_data->name .
" - Ledger A/C.", 'error');
+ $this->messages->add('Error deleting ' . $ledger_data->name . ' -
Ledger A/C.', 'error');
$this->logger->write_message("error", "Error deleting Ledger A/C
named " . $ledger_data->name . " [id:" . $id . "]");
redirect('account');
return;
} else {
$this->db->trans_complete();
- $this->messages->add($ledger_data->name . " - Ledger A/C deleted
successfully.", 'success');
+ $this->messages->add('Deleted ' . $ledger_data->name . ' - Ledger
A/C.', 'success');
$this->logger->write_message("success", "Deleted Ledger A/C named
" . $ledger_data->name . " [id:" . $id . "]");
redirect('account');
return;
diff --git a/system/application/controllers/report.php
b/system/application/controllers/report.php
index ea86ee8..fa8d923 100644
--- a/system/application/controllers/report.php
+++ b/system/application/controllers/report.php
@@ -612,7 +612,7 @@ class Report extends Controller {
/* Checking for valid ledger id */
if ($data['ledger_id'] < 1)
{
- $this->messages->add("Invalid Ledger A/C.", 'error');
+ $this->messages->add('Invalid Ledger A/C.', 'error');
redirect("report/ledgerst");
}
$data['report'] = "report/ledgerst";
diff --git a/system/application/controllers/setting.php
b/system/application/controllers/setting.php
index 3595c09..94d8b96 100644
--- a/system/application/controllers/setting.php
+++ b/system/application/controllers/setting.php
@@ -135,13 +135,13 @@ class Setting extends Controller {
if ( ! $this->db->query("UPDATE settings SET name = ?, address = ?, email =
?, currency_symbol = ?, date_format = ?, timezone = ? WHERE id = 1",
array($data_account_name, $data_account_address, $data_account_email,
$data_account_currency, $data_account_date, $data_account_timezone)))
{
$this->db->trans_rollback();
- $this->messages->add('Error updating settings.', 'error');
+ $this->messages->add('Error updating account settings.',
'error');
$this->logger->write_message("error", "Error updating account
settings");
$this->template->load('template', 'setting/account', $data);
return;
} else {
$this->db->trans_complete();
- $this->messages->add('Settings updated successfully.',
'success');
+ $this->messages->add('Account settings updated.', 'success');
$this->logger->write_message("success", "Updated account
settings");
redirect('setting');
return;
@@ -299,7 +299,7 @@ class Setting extends Controller {
/* Check if database ini file exists */
if (get_file_info($ini_file))
{
- $this->messages->add("Account with same label already exists.",
'error');
+ $this->messages->add('Account with same label already exists.',
'error');
$this->template->load('template', 'setting/cf', $data);
return;
}
@@ -307,7 +307,7 @@ class Setting extends Controller {
/* Check if start date is less than end date */
if ($data_fy_end <= $data_fy_start)
{
- $this->messages->add("Financial start date cannot be greater than end
date.", 'error');
+ $this->messages->add('Financial start date cannot be greater than end
date.', 'error');
$this->template->load('template', 'setting/cf', $data);
return;
}
@@ -329,12 +329,12 @@ class Setting extends Controller {
{
if ($newacc->query("CREATE DATABASE " .
mysql_real_escape_string($data_database_name)))
{
- $this->messages->add("New database created.", 'success');
+ $this->messages->add('New account database created.',
'success');
/* Retrying to connect to new database */
$newacc = $this->load->database($dsn, TRUE);
$conn_error = $newacc->_error_message();
} else {
- $this->messages->add("Cannot create database.", 'error');
+ $this->messages->add('Cannot create account database.',
'error');
$this->template->load('template', 'setting/cf', $data);
return;
}
@@ -343,15 +343,15 @@ class Setting extends Controller {
if ( ! $newacc->conn_id)
{
- $this->messages->add("Cannot connecting to database.",
'error');
+ $this->messages->add('Error connecting to database.',
'error');
$this->template->load('template', 'setting/cf', $data);
return;
} else if ($conn_error != "") {
- $this->messages->add("Error connecting to database. " .
$newacc->_error_message(), 'error');
+ $this->messages->add('Error connecting to database. ' .
$newacc->_error_message(), 'error');
$this->template->load('template', 'setting/cf', $data);
return;
} else if ($newacc->query("SHOW TABLES")->num_rows() > 0) {
- $this->messages->add("Selected database in not empty.",
'error');
+ $this->messages->add('Selected database in not empty.',
'error');
$this->template->load('template', 'setting/cf', $data);
return;
} else {
@@ -367,10 +367,11 @@ class Setting extends Controller {
$this->messages->add($newacc->_error_message(), 'error');
}
+ $this->messages->add('Created account database.', 'success');
+
/* Adding the account settings */
$newacc->query("INSERT INTO settings (id, name, address, email, fy_start,
fy_end, currency_symbol, date_format, timezone, email_protocol, email_host, email_port,
email_username, email_password, database_version) VALUES (?, ?, ?, ?, ?, ?, ?, ?, ?, ?,
?, ?, ?, ?, ?)", array(1, $data_account_name, $data_account_address,
$data_account_email, $data_fy_start, $data_fy_end, $data_account_currency,
$data_account_date, $data_account_timezone, $data_account_email_protocol,
$data_account_email_host, $data_account_email_port, $data_account_email_username,
$data_account_email_password, 1));
-
- $this->messages->add("Successfully created webzash account.",
'success');
+ $this->messages->add('Added account information.', 'success');
/* Adding account settings to file. Code copied from manage controller */
$con_details = "[database]" . "\r\n" . "db_hostname =
\"" . $data_database_host . "\"" . "\r\n" .
"db_port = \"" . $data_database_port . "\"" .
"\r\n" . "db_name = \"" . $data_database_name .
"\"" . "\r\n" . "db_username = \"" .
$data_database_username . "\"" . "\r\n" . "db_password =
\"" . $data_database_password . "\"" . "\r\n";
@@ -386,7 +387,7 @@ class Setting extends Controller {
{
if ( ! $newacc->query("INSERT INTO groups (id, parent_id, name,
affects_gross) VALUES (?, ?, ?, ?)", array($row->id, $row->parent_id,
$row->name, $row->affects_gross)))
{
- $this->messages->add("Failed to add group " . $row->name .
'.', 'error');
+ $this->messages->add('Failed to add group ' . $row->name .
'.', 'error');
$cf_status = FALSE;
}
}
@@ -417,13 +418,13 @@ class Setting extends Controller {
}
if ( ! $newacc->query("INSERT INTO ledgers (id, group_id, name, op_balance,
op_balance_dc, type) VALUES (?, ?, ?, ?, ?, ?)", array($row->id,
$row->group_id, $row->name, $op_balance, $op_balance_dc, $row->type)))
{
- $this->messages->add("Failed to add ledger " . $row->name .
'.', 'error');
+ $this->messages->add('Failed to add ledger ' . $row->name .
'.', 'error');
$cf_status = FALSE;
}
} else {
if ( ! $newacc->query("INSERT INTO ledgers (id, group_id, name, op_balance,
op_balance_dc, type) VALUES (?, ?, ?, ?, ?, ?)", array($row->id,
$row->group_id, $row->name, 0, "D", $row->type)))
{
- $this->messages->add("Failed to add ledger " . $row->name .
'.', 'error');
+ $this->messages->add('Failed to add ledger ' . $row->name .
'.', 'error');
$cf_status = FALSE;
}
}
@@ -435,23 +436,23 @@ class Setting extends Controller {
{
if ( ! $newacc->query("INSERT INTO tags (id, title, color, background)
VALUES (?, ?, ?, ?)", array($row->id, $row->title, $row->color,
$row->background)))
{
- $this->messages->add("Failed to add tag " . $row->title .
'.', 'error');
+ $this->messages->add('Failed to add tag ' . $row->title .
'.', 'error');
$cf_status = FALSE;
}
}
if ($cf_status)
- $this->messages->add("Successfully carry forward to new account.",
'success');
+ $this->messages->add('Account carried forward.', 'success');
else
- $this->messages->add("Error in carry forward to new account.",
'error');
+ $this->messages->add('Error carrying forward to new account.',
'error');
/* Writing the connection string to end of file - writing in 'a' append mode
*/
if ( ! write_file($ini_file, $con_details))
{
- $this->messages->add("Failed to add account settings file. Please check
if \"" . $ini_file . "\" file is writable.", 'error');
- $this->messages->add("You can manually create a text file \"" .
$ini_file . "\" with the following content :<br /><br />" .
$con_details_html, 'error');
+ $this->messages->add('Failed to add account settings file. Check if
"' . $ini_file . '" file is writable.', 'error');
+ $this->messages->add('You can manually create a text file "' .
$ini_file . '" with the following content :<br /><br />' .
$con_details_html, 'error');
} else {
- $this->messages->add("Successfully added webzash account settings file to
list of active accounts.", 'success');
+ $this->messages->add('Added account settings file to list of active
accounts.', 'success');
}
redirect('setting');
@@ -550,13 +551,13 @@ class Setting extends Controller {
if ( ! $this->db->query("UPDATE settings SET email_protocol = ?, email_host
= ?, email_port = ?, email_username = ?, email_password = ? WHERE id = 1",
array($data_email_protocol, $data_email_host, $data_email_port, $data_email_username,
$data_email_password)))
{
$this->db->trans_rollback();
- $this->messages->add('Error updating settings.', 'error');
+ $this->messages->add('Error updating email settings.',
'error');
$this->logger->write_message("error", "Error updating email
settings");
$this->template->load('template', 'setting/email', $data);
return;
} else {
$this->db->trans_complete();
- $this->messages->add('Email settings updated successfully.',
'success');
+ $this->messages->add('Email settings updated.', 'success');
$this->logger->write_message("success", "Updated email
settings");
redirect('setting');
return;
@@ -770,7 +771,7 @@ class Setting extends Controller {
return;
} else {
$this->db->trans_complete();
- $this->messages->add('Printer settings updated successfully.',
'success');
+ $this->messages->add('Printer settings updated.', 'success');
$this->logger->write_message("success", "Updated printer
settings");
redirect('setting');
return;
@@ -791,7 +792,7 @@ class Setting extends Controller {
/* Write the backup file to server */
if ( ! write_file($this->config->item('backup_path') . $backup_filename,
$backup_data))
{
- $this->messages->add('Error saving backup file to server.' . '
Please check if "' . $this->config->item('backup_path') .
'" folder is writable.', 'error');
+ $this->messages->add('Error saving backup file to server.' . ' Check
if "' . $this->config->item('backup_path') . '" folder is
writable.', 'error');
redirect('setting');
return;
}
@@ -883,7 +884,7 @@ class Setting extends Controller {
return;
} else {
$this->db->trans_complete();
- $this->messages->add('Voucher settings updated successfully.',
'success');
+ $this->messages->add('Voucher settings updated.', 'success');
$this->logger->write_message("success", "Updated voucher
settings");
redirect('setting');
return;
@@ -914,7 +915,7 @@ class Setting extends Controller {
/* Check if database ini file exists */
if ( ! get_file_info($ini_file))
{
- $this->messages->add("Account setting file is missing.",
'error');
+ $this->messages->add('Account setting file is missing.',
'error');
redirect("");
return;
}
@@ -923,7 +924,7 @@ class Setting extends Controller {
$active_accounts = parse_ini_file($ini_file);
if ( ! $active_accounts)
{
- $this->messages->add("Invalid account setting file.",
'error');
+ $this->messages->add('Invalid account setting file.',
'error');
redirect("");
return;
}
diff --git a/system/application/controllers/tag.php
b/system/application/controllers/tag.php
index a9cfc79..9fefda0 100644
--- a/system/application/controllers/tag.php
+++ b/system/application/controllers/tag.php
@@ -94,7 +94,7 @@ class Tag extends Controller {
return;
} else {
$this->db->trans_complete();
- $this->messages->add("Added " . $data_tag_title . ' - Tag
successfully.', 'success');
+ $this->messages->add('Added ' . $data_tag_title . ' - Tag.',
'success');
$this->logger->write_message("success", "Added tag named "
. $data_tag_title);
redirect('tag');
return;
@@ -201,7 +201,7 @@ class Tag extends Controller {
return;
} else {
$this->db->trans_complete();
- $this->messages->add("Updated " . $data_tag_title . ' - Tag
successfully.', 'success');
+ $this->messages->add('Updated ' . $data_tag_title . ' - Tag.',
'success');
$this->logger->write_message("success", "Updated tag named
" . $data_tag_title . " [id:" . $id . "]");
redirect('tag');
return;
@@ -224,7 +224,7 @@ class Tag extends Controller {
$data_valid_q = $this->db->query("SELECT * FROM tags WHERE id = ?",
array($id));
if ($data_valid_q->num_rows() < 1)
{
- $this->messages->add('Invalid Tag specified.', 'error');
+ $this->messages->add('Invalid Tag.', 'error');
redirect('tag');
return;
}
@@ -235,8 +235,8 @@ class Tag extends Controller {
if ( ! $this->db->query("UPDATE vouchers SET tag_id = 0 WHERE tag_id =
?", array($id)))
{
$this->db->trans_rollback();
- $this->messages->add('Error removing Tags.', 'error');
- $this->logger->write_message("error", "Error removing tag named
" . $data_tag->title . " [id:" . $id . "] from vouchers");
+ $this->messages->add('Error deleting Tag from Vouchers.',
'error');
+ $this->logger->write_message("error", "Error deleting tag named
" . $data_tag->title . " [id:" . $id . "] from vouchers");
redirect('tag');
return;
} else {
@@ -249,7 +249,7 @@ class Tag extends Controller {
return;
} else {
$this->db->trans_complete();
- $this->messages->add('Tag deleted successfully.', 'success');
+ $this->messages->add('Tag deleted.', 'success');
$this->logger->write_message("success", "Deleted tag named
" . $data_tag->title . " [id:" . $id . "]");
redirect('tag');
return;
diff --git a/system/application/controllers/voucher.php
b/system/application/controllers/voucher.php
index 26878d8..ac56a86 100644
--- a/system/application/controllers/voucher.php
+++ b/system/application/controllers/voucher.php
@@ -225,7 +225,7 @@ class Voucher extends Controller {
/* Load current voucher details */
if ( ! $cur_voucher = $this->Voucher_model->get_voucher($voucher_id,
$voucher_type))
{
- $this->messages->add('Invalid Voucher.', 'error');
+ $this->messages->add('Invalid Voucher number.', 'error');
redirect('voucher/show/' . $voucher_type);
return;
}
@@ -414,7 +414,7 @@ class Voucher extends Controller {
if ( ! $this->db->query("INSERT INTO vouchers (number, date, narration,
draft, type, tag_id) VALUES (?, ?, ?, ?, ?, ?)", array($data_number, $data_date,
$data_narration, $data_draft, $data_type, $data_tag)))
{
$this->db->trans_rollback();
- $this->messages->add('Error addding Voucher A/C.', 'error');
+ $this->messages->add('Error addding Voucher.', 'error');
$this->logger->write_message("error", "Error adding " .
ucfirst($voucher_type) . " Voucher number " .
voucher_number_prefix($voucher_type) . $data_number . " since failed inserting
voucher");
$this->template->load('template', 'voucher/add', $data);
return;
@@ -475,7 +475,7 @@ class Voucher extends Controller {
$voucher_success_links .= anchor('voucher/download/' .
strtolower($voucher_type) . "/" . $voucher_id, 'Download',
array('class' => 'anchor-link-a'));
$voucher_success_links .= " it.";
- $this->messages->add(ucfirst($voucher_type) . ' Voucher number ' .
voucher_number_prefix($voucher_type) . $data_number . ' added successfully. ' .
$voucher_success_links, 'success');
+ $this->messages->add('Added ' . ucfirst($voucher_type) . ' Voucher
number ' . voucher_number_prefix($voucher_type) . $data_number .
$voucher_success_links, 'success');
$this->logger->write_message("success", "Added " .
ucfirst($voucher_type) . " Voucher number " .
voucher_number_prefix($voucher_type) . $data_number . " [id:" . $voucher_id .
"]");
redirect('voucher/show/' . $voucher_type);
$this->template->load('template', 'voucher/add', $data);
@@ -510,7 +510,7 @@ class Voucher extends Controller {
/* Load current voucher details */
if ( ! $cur_voucher = $this->Voucher_model->get_voucher($voucher_id,
$voucher_type))
{
- $this->messages->add('Invalid Voucher.', 'error');
+ $this->messages->add('Invalid Voucher number.', 'error');
redirect('voucher/show/' . $voucher_type);
return;
}
@@ -754,7 +754,7 @@ class Voucher extends Controller {
$voucher_success_links .= anchor('voucher/download/' .
strtolower($voucher_type) . "/" . $voucher_id, 'Download',
array('class' => 'anchor-link-a'));
$voucher_success_links .= " it.";
- $this->messages->add(ucfirst($voucher_type) . ' Voucher number ' .
voucher_number_prefix($voucher_type) . $data_number . ' updated successfully. ' .
$voucher_success_links, 'success');
+ $this->messages->add('Updated ' . ucfirst($voucher_type) . ' Voucher
number ' . voucher_number_prefix($voucher_type) . $data_number .
$voucher_success_links, 'success');
$this->logger->write_message("success", "Updated " .
ucfirst($voucher_type) . " Voucher number " .
voucher_number_prefix($voucher_type) . $data_number . " [id:" . $voucher_id .
"]");
redirect('voucher/show/' . $voucher_type);
return;
@@ -767,7 +767,7 @@ class Voucher extends Controller {
/* Load current voucher details */
if ( ! $cur_voucher = $this->Voucher_model->get_voucher($voucher_id,
$voucher_type))
{
- $this->messages->add('Invalid Voucher.', 'error');
+ $this->messages->add('Invalid Voucher number.', 'error');
redirect('voucher/show/' . $voucher_type);
return;
}
@@ -790,7 +790,7 @@ class Voucher extends Controller {
return;
}
$this->db->trans_complete();
- $this->messages->add('Voucher deleted successfully.',
'success');
+ $this->messages->add('Deleted ' . ucfirst($voucher_type) . '
Voucher.', 'success');
$this->logger->write_message("success", "Deleted " .
ucfirst($voucher_type) . " Voucher number " .
voucher_number_prefix($voucher_type) . $cur_voucher->number . " [id:" .
$voucher_id . "]");
redirect('voucher/show/' . $voucher_type);
return;
@@ -807,7 +807,7 @@ class Voucher extends Controller {
/* Load current voucher details */
if ( ! $cur_voucher = $this->Voucher_model->get_voucher($voucher_id,
$voucher_type))
{
- $this->messages->add('Invalid Voucher.', 'error');
+ $this->messages->add('Invalid Voucher number.', 'error');
redirect('voucher/show/' . $voucher_type);
return;
}
@@ -856,7 +856,7 @@ class Voucher extends Controller {
/* Load current voucher details */
if ( ! $cur_voucher = $this->Voucher_model->get_voucher($voucher_id,
$voucher_type))
{
- $this->messages->add('Invalid Voucher.', 'error');
+ $this->messages->add('Invalid Voucher number.', 'error');
redirect('voucher/show/' . $voucher_type);
return;
}
@@ -903,7 +903,7 @@ class Voucher extends Controller {
/* Load current voucher details */
if ( ! $cur_voucher = $this->Voucher_model->get_voucher($voucher_id,
$voucher_type))
{
- $this->messages->add('Invalid Voucher.', 'error');
+ $this->messages->add('Invalid Voucher number.', 'error');
redirect('voucher/show/' . $voucher_type);
return;
}
diff --git a/system/application/helpers/MY_date_helper.php
b/system/application/helpers/MY_date_helper.php
index 11f523a..2d982b6 100644
--- a/system/application/helpers/MY_date_helper.php
+++ b/system/application/helpers/MY_date_helper.php
@@ -19,7 +19,7 @@ if ( ! function_exists('date_php_to_mysql'))
list($y, $m, $d) = explode('/', $dt);
break;
default:
- $CI->messages->add('Invalid date format. Please check your account
settings', 'error');
+ $CI->messages->add('Invalid date format. Check your account settings.',
'error');
return "";
}
$ts = mktime(0, 0, 0, $m, $d, $y);
@@ -46,7 +46,7 @@ if ( ! function_exists('date_php_to_mysql_end_time'))
list($y, $m, $d) = explode('/', $dt);
break;
default:
- $CI->messages->add('Invalid date format. Please check your account
settings', 'error');
+ $CI->messages->add('Invalid date format. Check your account settings.',
'error');
return "";
}
$ts = mktime("23", "59", "59", $m, $d, $y);
@@ -73,7 +73,7 @@ if ( ! function_exists('date_mysql_to_php'))
return date('Y/m/d', $ts);
break;
default:
- $CI->messages->add('Invalid date format. Please check your account
settings', 'error');
+ $CI->messages->add('Invalid date format. Check your account settings.',
'error');
return "";
}
return;
@@ -99,7 +99,7 @@ if ( ! function_exists('date_mysql_to_php_display'))
return date('Y M d', $ts);
break;
default:
- $CI->messages->add('Invalid date format. Please check your account
settings', 'error');
+ $CI->messages->add('Invalid date format. Check your account settings.',
'error');
return "";
}
return;
@@ -134,7 +134,7 @@ if ( ! function_exists('date_today_php'))
return date('Y/m/d');
break;
default:
- $CI->messages->add('Invalid date format. Please check your account
settings', 'error');
+ $CI->messages->add('Invalid date format. Check your account settings.',
'error');
return "";
}
return;
diff --git a/system/application/libraries/MY_Form_validation.php
b/system/application/libraries/MY_Form_validation.php
index 74a7f17..bf74495 100644
--- a/system/application/libraries/MY_Form_validation.php
+++ b/system/application/libraries/MY_Form_validation.php
@@ -109,7 +109,7 @@ class MY_Form_validation extends CI_Form_validation {
list($y, $m, $d) = explode('/', $str);
break;
default:
- $CI->messages->add('Invalid date format. Please check your account
settings', 'error');
+ $CI->messages->add('Invalid date format. Check your account settings.',
'error');
return "";
}
return checkdate($m, $d, $y) ? TRUE : FALSE;
diff --git a/system/application/libraries/Startup.php
b/system/application/libraries/Startup.php
index 1c9129b..d1519d4 100644
--- a/system/application/libraries/Startup.php
+++ b/system/application/libraries/Startup.php
@@ -29,7 +29,7 @@ class Startup
/* Check if database ini file exists */
if ( ! get_file_info($ini_file))
{
- $CI->messages->add("Account setting file is missing",
'error');
+ $CI->messages->add('Account settings file is missing.',
'error');
redirect('admin');
return;
}
@@ -38,7 +38,7 @@ class Startup
$active_accounts = parse_ini_file($ini_file);
if ( ! $active_accounts)
{
- $CI->messages->add("Invalid account setting file", 'error');
+ $CI->messages->add('Invalid account settings.', 'error');
redirect('admin');
return;
}
@@ -46,31 +46,31 @@ class Startup
/* Check if all needed variables are set in ini file */
if ( ! isset($active_accounts['db_hostname']))
{
- $CI->messages->add("Hostname missing from account setting file",
'error');
+ $CI->messages->add('Hostname missing from account settings file.',
'error');
redirect('admin');
return;
}
if ( ! isset($active_accounts['db_port']))
{
- $CI->messages->add("Port missing from account setting file. Default MySQL
port is 3306", 'error');
+ $CI->messages->add('Port missing from account setting file. Default MySQL
port is 3306.', 'error');
redirect('admin');
return;
}
if ( ! isset($active_accounts['db_name']))
{
- $CI->messages->add("Database name missing from account setting file",
'error');
+ $CI->messages->add('Database name missing from account setting file.',
'error');
redirect('admin');
return;
}
if ( ! isset($active_accounts['db_username']))
{
- $CI->messages->add("Database username missing from account setting
file", 'error');
+ $CI->messages->add('Database username missing from account setting
file.', 'error');
redirect('admin');
return;
}
if ( ! isset($active_accounts['db_password']))
{
- $CI->messages->add("Database password missing from account setting
file", 'error');
+ $CI->messages->add('Database password missing from account setting
file.', 'error');
redirect('admin');
return;
}
@@ -91,7 +91,7 @@ class Startup
$db_config['dbcollat'] = "utf8_general_ci";
$CI->load->database($db_config, FALSE, TRUE);
} else {
- $CI->messages->add('Please select a Webzash database',
'error');
+ $CI->messages->add('Please select a account.', 'error');
redirect('admin');
}
@@ -108,18 +108,18 @@ class Startup
$valid_db_q = mysql_query('DESC ' . $tbname);
if ( ! $valid_db_q)
{
- $CI->messages->add('Invalid Webzash database', 'error');
+ $CI->messages->add('Invalid account database.', 'error');
redirect('admin');
return;
}
}
} else {
- $CI->messages->add('Invalid database connection settings. Please check
whether the provided database name, username and password is valid',
'error');
+ $CI->messages->add('Invalid database connection settings. Check whether the
provided database name, username and password are valid.', 'error');
redirect('admin');
return;
}
} else {
- $CI->messages->add('Cannot connect to database server. Please check whether
database server is running', 'error');
+ $CI->messages->add('Cannot connect to database server. Check whether
database server is running.', 'error');
redirect('admin');
return;
}
@@ -128,7 +128,7 @@ class Startup
$account_q = $CI->db->query('SELECT * FROM settings WHERE id = 1');
if ( ! ($account_d = $account_q->row()))
{
- $CI->messages->add('Please select valid account', 'error');
+ $CI->messages->add('Invalid account details.', 'error');
redirect('admin');
}
$CI->config->set_item('account_name', $account_d->name);
commit 99a5007dfb66c76ec2bb12bbd5c186758c54aa8a
Author: Prashant P Shah <pshah.mumbai(a)gmail.com>
Date: Thu Dec 23 17:04:17 2010 +0530
Check for valid Ledger A/C before add/edit voucher
Signed-off-by: Prashant P Shah <pshah.mumbai(a)gmail.com>
diff --git a/system/application/controllers/voucher.php
b/system/application/controllers/voucher.php
index 9d37292..26878d8 100644
--- a/system/application/controllers/voucher.php
+++ b/system/application/controllers/voucher.php
@@ -360,6 +360,15 @@ class Voucher extends Controller {
{
if ($data_all_ledger_id[$id] < 1)
continue;
+
+ /* Check for valid ledger id */
+ if ($this->db->query("SELECT id FROM ledgers WHERE id = ?",
array($data_all_ledger_id[$id]))->num_rows() < 1)
+ {
+ $this->messages->add('Invalid Ledger A/C.', 'error');
+ $this->template->load('template', 'voucher/add', $data);
+ return;
+ }
+
if ($data_all_ledger_dc[$id] == "D")
{
$dr_total += $data_all_dr_amount[$id];
@@ -623,6 +632,15 @@ class Voucher extends Controller {
{
if ($data_all_ledger_id[$id] < 1)
continue;
+
+ /* Check for valid ledger id */
+ if ($this->db->query("SELECT id FROM ledgers WHERE id = ?",
array($data_all_ledger_id[$id]))->num_rows() < 1)
+ {
+ $this->messages->add('Invalid Ledger A/C.', 'error');
+ $this->template->load('template', 'voucher/edit', $data);
+ return;
+ }
+
if ($data_all_ledger_dc[$id] == "D")
{
$dr_total += $data_all_dr_amount[$id];
commit dbc842d05bd9080e85ce620c7b5766e8662bf148
Author: Prashant P Shah <pshah.mumbai(a)gmail.com>
Date: Thu Dec 23 16:57:21 2010 +0530
Fixed query parameters as array
Signed-off-by: Prashant P Shah <pshah.mumbai(a)gmail.com>
diff --git a/system/application/controllers/group.php
b/system/application/controllers/group.php
index 4383918..a4af1ad 100644
--- a/system/application/controllers/group.php
+++ b/system/application/controllers/group.php
@@ -56,7 +56,7 @@ class Group extends Controller {
$data_parent_id = $this->input->post('group_parent', TRUE);
/* Check if parent group id present */
- if ($this->db->query("SELECT id FROM groups WHERE id = ?",
$data_parent_id)->num_rows() < 1)
+ if ($this->db->query("SELECT id FROM groups WHERE id = ?",
array($data_parent_id))->num_rows() < 1)
{
$this->messages->add('Invalid Parent group.', 'error');
$this->template->load('template', 'group/add', $data);
@@ -161,7 +161,7 @@ class Group extends Controller {
$data_id = $id;
/* Check if parent group id present */
- if ($this->db->query("SELECT id FROM groups WHERE id = ?",
$data_parent_id)->num_rows() < 1)
+ if ($this->db->query("SELECT id FROM groups WHERE id = ?",
array($data_parent_id))->num_rows() < 1)
{
$this->messages->add('Invalid Parent group.', 'error');
$this->template->load('template', 'group/edit', $data);
diff --git a/system/application/controllers/ledger.php
b/system/application/controllers/ledger.php
index 5c30087..1b4bde3 100644
--- a/system/application/controllers/ledger.php
+++ b/system/application/controllers/ledger.php
@@ -79,7 +79,7 @@ class Ledger extends Controller {
}
/* Check if parent group id present */
- if ($this->db->query("SELECT id FROM groups WHERE id = ?",
$data_group_id)->num_rows() < 1)
+ if ($this->db->query("SELECT id FROM groups WHERE id = ?",
array($data_group_id))->num_rows() < 1)
{
$this->messages->add('Invalid Parent group.', 'error');
$this->template->load('template', 'ledger/add', $data);
@@ -198,7 +198,7 @@ class Ledger extends Controller {
}
/* Check if parent group id present */
- if ($this->db->query("SELECT id FROM groups WHERE id = ?",
$data_group_id)->num_rows() < 1)
+ if ($this->db->query("SELECT id FROM groups WHERE id = ?",
array($data_group_id))->num_rows() < 1)
{
$this->messages->add('Invalid Parent group.', 'error');
$this->template->load('template', 'ledger/edit', $data);
commit e0cdec9ff02cff17e550bb483c9d8e9f3401758f
Author: Prashant P Shah <pshah.mumbai(a)gmail.com>
Date: Thu Dec 23 16:33:09 2010 +0530
Added tooltips to ledger type of cash or bank
Signed-off-by: Prashant P Shah <pshah.mumbai(a)gmail.com>
diff --git a/system/application/views/ledger/add.php
b/system/application/views/ledger/add.php
index c7268e6..249611b 100644
--- a/system/application/views/ledger/add.php
+++ b/system/application/views/ledger/add.php
@@ -22,7 +22,10 @@
echo "</p>";
echo "<p>";
+ echo "<span id=\"tooltip-target-1\">";
echo form_checkbox('ledger_type_cashbank', 1, $ledger_type_cashbank) . "
Cash / Bank Account";
+ echo "</span>";
+ echo "<span id=\"tooltip-content-1\">Select if Ledger A/C is a Bank
A/C or a Cash A/C.</span>";
echo "</p>";
echo "<p>";
diff --git a/system/application/views/ledger/edit.php
b/system/application/views/ledger/edit.php
index 1be3802..2400ff4 100644
--- a/system/application/views/ledger/edit.php
+++ b/system/application/views/ledger/edit.php
@@ -22,7 +22,10 @@
echo "</p>";
echo "<p>";
+ echo "<span id=\"tooltip-target-1\">";
echo form_checkbox('ledger_type_cashbank', 1, $ledger_type_cashbank) . "
Cash / Bank Account";
+ echo "</span>";
+ echo "<span id=\"tooltip-content-1\">Select if Ledger A/C is a Bank
A/C or a Cash A/C.</span>";
echo "</p>";
echo "<p>";
commit 0392bb1d08fb8a0a046798e2c8f6e2a4226b1e87
Author: Prashant P Shah <pshah.mumbai(a)gmail.com>
Date: Thu Dec 23 16:29:54 2010 +0530
Check for valid parent group when add or edit Ledger A/C
Signed-off-by: Prashant P Shah <pshah.mumbai(a)gmail.com>
diff --git a/system/application/controllers/ledger.php
b/system/application/controllers/ledger.php
index 9f92b45..5c30087 100644
--- a/system/application/controllers/ledger.php
+++ b/system/application/controllers/ledger.php
@@ -78,6 +78,14 @@ class Ledger extends Controller {
return;
}
+ /* Check if parent group id present */
+ if ($this->db->query("SELECT id FROM groups WHERE id = ?",
$data_group_id)->num_rows() < 1)
+ {
+ $this->messages->add('Invalid Parent group.', 'error');
+ $this->template->load('template', 'ledger/add', $data);
+ return;
+ }
+
if ($data_ledger_type_cashbank_value == "1")
{
$data_ledger_type_cashbank = "B";
@@ -185,7 +193,15 @@ class Ledger extends Controller {
if ($data_group_id < 5)
{
$this->messages->add("Invalid parent group.", 'error');
- $this->template->load('template', 'ledger/add', $data);
+ $this->template->load('template', 'ledger/edit', $data);
+ return;
+ }
+
+ /* Check if parent group id present */
+ if ($this->db->query("SELECT id FROM groups WHERE id = ?",
$data_group_id)->num_rows() < 1)
+ {
+ $this->messages->add('Invalid Parent group.', 'error');
+ $this->template->load('template', 'ledger/edit', $data);
return;
}
commit a8ca08ee57da268b3e02a8629de2d9a7c66418ab
Author: Prashant P Shah <pshah.mumbai(a)gmail.com>
Date: Thu Dec 23 16:25:57 2010 +0530
Check for valid parent group
Signed-off-by: Prashant P Shah <pshah.mumbai(a)gmail.com>
diff --git a/system/application/controllers/group.php
b/system/application/controllers/group.php
index af3c87c..4383918 100644
--- a/system/application/controllers/group.php
+++ b/system/application/controllers/group.php
@@ -55,6 +55,14 @@ class Group extends Controller {
$data_name = $this->input->post('group_name', TRUE);
$data_parent_id = $this->input->post('group_parent', TRUE);
+ /* Check if parent group id present */
+ if ($this->db->query("SELECT id FROM groups WHERE id = ?",
$data_parent_id)->num_rows() < 1)
+ {
+ $this->messages->add('Invalid Parent group.', 'error');
+ $this->template->load('template', 'group/add', $data);
+ return;
+ }
+
/* Only if Income or Expense can affect gross profit loss calculation */
$data_affects_gross = $this->input->post('affects_gross', TRUE);
if ($data_parent_id == "3" || $data_parent_id == "4")
@@ -152,6 +160,22 @@ class Group extends Controller {
$data_parent_id = $this->input->post('group_parent', TRUE);
$data_id = $id;
+ /* Check if parent group id present */
+ if ($this->db->query("SELECT id FROM groups WHERE id = ?",
$data_parent_id)->num_rows() < 1)
+ {
+ $this->messages->add('Invalid Parent group.', 'error');
+ $this->template->load('template', 'group/edit', $data);
+ return;
+ }
+
+ /* Check if parent group same as current group id */
+ if ($data_parent_id == $id)
+ {
+ $this->messages->add('Invalid Parent group', 'error');
+ $this->template->load('template', 'group/edit', $data);
+ return;
+ }
+
/* Only if Income or Expense can affect gross profit loss calculation */
$data_affects_gross = $this->input->post('affects_gross', TRUE);
if ($data_parent_id == "3" || $data_parent_id == "4")
commit 617d208f8d627b279370f07beb96dbc1ff0643c4
Author: Prashant P Shah <pshah.mumbai(a)gmail.com>
Date: Thu Dec 23 14:20:44 2010 +0530
Added tooltips to voucher date and draft options
Signed-off-by: Prashant P Shah <pshah.mumbai(a)gmail.com>
diff --git a/system/application/assets/css/custom.css
b/system/application/assets/css/custom.css
index 5b86533..416e018 100644
--- a/system/application/assets/css/custom.css
+++ b/system/application/assets/css/custom.css
@@ -233,7 +233,6 @@ ul#pagination-flickr {
border:3px solid #AF8A31;
background-color:#FFC848;
text-align:left;
- width:400px;
}
#tooltip-content-2 {
@@ -243,7 +242,6 @@ ul#pagination-flickr {
border:3px solid #AF8A31;
background-color:#FFC848;
text-align:left;
- width:400px;
}
#tooltip-content-3 {
@@ -253,5 +251,4 @@ ul#pagination-flickr {
border:3px solid #AF8A31;
background-color:#FFC848;
text-align:left;
- width:400px;
}
diff --git a/system/application/views/group/edit.php
b/system/application/views/group/edit.php
index 8de02da..a5aac01 100644
--- a/system/application/views/group/edit.php
+++ b/system/application/views/group/edit.php
@@ -27,7 +27,10 @@ $(document).ready(function() {
echo "</p>";
echo "<p class=\"affects-gross\">";
+ echo "<span id=\"tooltip-target-1\">";
echo form_checkbox('affects_gross', 1, $affects_gross) . " Affects Gross
Profit/Loss Calculations";
+ echo "</span>";
+ echo "<span id=\"tooltip-content-1\">If selected the Group A/C will
affect Gross Profit and Loss calculations, otherwise it will affect only Net Profit and
Loss calculations.</span>";
echo "</p>";
echo "<p>";
diff --git a/system/application/views/voucher/add.php
b/system/application/views/voucher/add.php
index d094129..3aa5fa5 100644
--- a/system/application/views/voucher/add.php
+++ b/system/application/views/voucher/add.php
@@ -189,9 +189,12 @@ $(document).ready(function() {
echo " ";
echo voucher_number_prefix($voucher_type) . form_input($voucher_number);
echo
" ";
+ echo "<span id=\"tooltip-target-1\">";
echo form_label('Voucher Date', 'voucher_date');
echo " ";
echo form_input_date_restrict($voucher_date);
+ echo "</span>";
+ echo "<span id=\"tooltip-content-1\">Date format is " .
$this->config->item('account_date_format') . ".</span>";
echo "</p>";
echo "<table class=\"voucher-table\">";
@@ -245,7 +248,10 @@ $(document).ready(function() {
echo "<p>";
echo form_fieldset('Options', array('class' =>
"fieldset-auto-width"));
+ echo "<span id=\"tooltip-target-2\">";
echo form_checkbox('voucher_draft', 1, $voucher_draft) . "Draft";
+ echo "</span>";
+ echo "<span id=\"tooltip-content-2\">Draft vouchers do not affect
any accouting caluculations.</span>";
echo "<br /><br />";
echo form_checkbox('voucher_print', 1, $voucher_print) . "Print";
echo
" ";
diff --git a/system/application/views/voucher/edit.php
b/system/application/views/voucher/edit.php
index 1171012..036086e 100644
--- a/system/application/views/voucher/edit.php
+++ b/system/application/views/voucher/edit.php
@@ -189,9 +189,12 @@ $(document).ready(function() {
echo " ";
echo voucher_number_prefix($voucher_type) . form_input($voucher_number);
echo
" ";
+ echo "<span id=\"tooltip-target-1\">";
echo form_label('Voucher Date', 'voucher_date');
echo " ";
echo form_input_date_restrict($voucher_date);
+ echo "</span>";
+ echo "<span id=\"tooltip-content-1\">Date format is " .
$this->config->item('account_date_format') . ".</span>";
echo "</p>";
echo "<table class=\"voucher-table\">";
@@ -245,7 +248,10 @@ $(document).ready(function() {
echo "<p>";
echo form_fieldset('Options', array('class' =>
"fieldset-auto-width"));
+ echo "<span id=\"tooltip-target-2\">";
echo form_checkbox('voucher_draft', 1, $voucher_draft) . "Draft";
+ echo "</span>";
+ echo "<span id=\"tooltip-content-2\">Draft vouchers do not affect
any accouting caluculations.</span>";
echo "<br /><br />";
echo form_checkbox('voucher_print', 1, $voucher_print) . "Print";
echo
" ";
commit 1172dadae1a75151e8396ce04b20f8c1b53421d5
Author: Prashant P Shah <pshah.mumbai(a)gmail.com>
Date: Thu Dec 23 14:05:59 2010 +0530
Added EZPZ Tooltip jQuery Library
http://theezpzway.com/demos/ezpz-tooltip
Licensed under The MIT License
Signed-off-by: Prashant P Shah <pshah.mumbai(a)gmail.com>
diff --git a/system/application/assets/css/custom.css
b/system/application/assets/css/custom.css
index e4b737b..5b86533 100644
--- a/system/application/assets/css/custom.css
+++ b/system/application/assets/css/custom.css
@@ -224,3 +224,34 @@ ul#pagination-flickr {
padding:0px;
list-style-type:square;
}
+
+/********************************** TOOL TIPS *********************************/
+#tooltip-content-1 {
+ display:none;
+ position:absolute;
+ padding:10px;
+ border:3px solid #AF8A31;
+ background-color:#FFC848;
+ text-align:left;
+ width:400px;
+}
+
+#tooltip-content-2 {
+ display:none;
+ position:absolute;
+ padding:10px;
+ border:3px solid #AF8A31;
+ background-color:#FFC848;
+ text-align:left;
+ width:400px;
+}
+
+#tooltip-content-3 {
+ display:none;
+ position:absolute;
+ padding:10px;
+ border:3px solid #AF8A31;
+ background-color:#FFC848;
+ text-align:left;
+ width:400px;
+}
diff --git a/system/application/assets/js/custom.js
b/system/application/assets/js/custom.js
index 64dfbad..d9e9387 100644
--- a/system/application/assets/js/custom.js
+++ b/system/application/assets/js/custom.js
@@ -13,6 +13,9 @@ $(document).ready(function() {
return false;
}
});
+ $("#tooltip-target-1").ezpz_tooltip();
+ $("#tooltip-target-2").ezpz_tooltip();
+ $("#tooltip-target-3").ezpz_tooltip();
})
diff --git a/system/application/assets/js/ezpz_tooltip.min.js
b/system/application/assets/js/ezpz_tooltip.min.js
new file mode 100644
index 0000000..32685d4
--- /dev/null
+++ b/system/application/assets/js/ezpz_tooltip.min.js
@@ -0,0 +1,2 @@
+// EZPZ Tooltip v1.0; Copyright (c) 2009 Mike Enriquez,
http://theezpzway.com; Released
under the MIT License
+(function($){$.fn.ezpz_tooltip=function(options){var
settings=$.extend({},$.fn.ezpz_tooltip.defaults,options);return this.each(function(){var
content=$("#"+getContentId(this.id));var
targetMousedOver=$(this).mouseover(function(){settings.beforeShow(content,$(this))}).mousemove(function(e){contentInfo=getElementDimensionsAndPosition(content);targetInfo=getElementDimensionsAndPosition($(this));contentInfo=$.fn.ezpz_tooltip.positions[settings.contentPosition](contentInfo,e.pageX,e.pageY,settings.offset,targetInfo);contentInfo=keepInWindow(contentInfo);content.css('top',contentInfo['top']);content.css('left',contentInfo['left']);settings.showContent(content)});if(settings.stayOnContent&&this.id!=""){$("#"+this.id+",
#"+getContentId(this.id)).mouseover(function(){content.css('display','block')}).mouseout(function(){content.css('display','none');settings.afterHide()})}else{targetMousedOver.mouseout(function(){settings.hideContent(content);settings.afterHide()})}});function
getContentId(targetId){if(settings.contentId==""){var
name=targetId.split('-')[0];var id=targetId.split('-')[2];return
name+'-content-'+id}else{return settings.contentId}};function
getElementDimensionsAndPosition(element){var height=element.outerHeight(true);var
width=element.outerWidth(true);var top=$(element).offset().top;var
left=$(element).offset().left;var info=new
Array();info['height']=height;info['width']=width;info['top']=top;info['left']=left;return
info};function keepInWindow(contentInfo){var windowWidth=$(window).width();var
windowTop=$(window).scrollTop();var output=new
Array();output=contentInfo;if(contentInfo['top']<windowTop){output['top']=windowTop}if((contentInfo['left']+contentInfo['width'])>windowWidth){output['left']=windowWidth-contentInfo['width']}if(contentInfo['left']<0){output['left']=0}return
output}};$.fn.ezpz_tooltip.positionContent=function(contentInfo,mouseX,mouseY,offset,targetInfo){contentInfo['top']=mouseY-offset-contentInfo['height'];contentInfo['left']=mouseX+offset;return
contentInfo};$.fn.ezpz_tooltip.positions={aboveRightFollow:function(contentInfo,mouseX,mouseY,offset,targetInfo){contentInfo['top']=mouseY-offset-contentInfo['height'];contentInfo['left']=mouseX+offset;return
contentInfo}};$.fn.ezpz_tooltip.defaults={contentPosition:'aboveRightFollow',stayOnContent:false,offset:10,contentId:"",beforeShow:function(content){},showContent:function(content){content.show()},hideContent:function(content){content.hide()},afterHide:function(){}}})(jQuery);(function($){$.fn.ezpz_tooltip.positions.aboveFollow=function(contentInfo,mouseX,mouseY,offset,targetInfo){contentInfo['top']=mouseY-offset-contentInfo['height'];contentInfo['left']=mouseX-(contentInfo['width']/2);return
contentInfo};$.fn.ezpz_tooltip.positions.rightFollow=function(contentInfo,mouseX,mouseY,offset,targetInfo){contentInfo['top']=mouseY-(contentInfo['height']/2);contentInfo['left']=mouseX+offset;return
contentInfo};$.fn.ezpz_tooltip.positions.belowRightFollow=function(contentInfo,mouseX,mouseY,offset,targetInfo){contentInfo['top']=mouseY+offset;contentInfo['left']=mouseX+offset;return
contentInfo};$.fn.ezpz_tooltip.positions.belowFollow=function(contentInfo,mouseX,mouseY,offset,targetInfo){contentInfo['top']=mouseY+offset;contentInfo['left']=mouseX-(contentInfo['width']/2);return
contentInfo};$.fn.ezpz_tooltip.positions.aboveStatic=function(contentInfo,mouseX,mouseY,offset,targetInfo){contentInfo['top']=targetInfo['top']-offset-contentInfo['height'];contentInfo['left']=(targetInfo['left']+(targetInfo['width']/2))-(contentInfo['width']/2);return
contentInfo};$.fn.ezpz_tooltip.positions.rightStatic=function(contentInfo,mouseX,mouseY,offset,targetInfo){contentInfo['top']=(targetInfo['top']+(targetInfo['height']/2))-(contentInfo['height']/2);contentInfo['left']=targetInfo['left']+targetInfo['width']+offset;return
contentInfo};$.fn.ezpz_tooltip.positions.belowStatic=function(contentInfo,mouseX,mouseY,offset,targetInfo){contentInfo['top']=targetInfo['top']+targetInfo['height']+offset;contentInfo['left']=(targetInfo['left']+(targetInfo['width']/2))-(contentInfo['width']/2);return
contentInfo}})(jQuery);
\ No newline at end of file
diff --git a/system/application/views/group/add.php
b/system/application/views/group/add.php
index 49899a8..e6a91b9 100644
--- a/system/application/views/group/add.php
+++ b/system/application/views/group/add.php
@@ -27,7 +27,10 @@ $(document).ready(function() {
echo "</p>";
echo "<p class=\"affects-gross\">";
+ echo "<span id=\"tooltip-target-1\">";
echo form_checkbox('affects_gross', 1, $affects_gross) . " Affects Gross
Profit/Loss Calculations";
+ echo "</span>";
+ echo "<span id=\"tooltip-content-1\">If selected the Group A/C will
affect Gross Profit and Loss calculations, otherwise it will affect only Net Profit and
Loss calculations.</span>";
echo "</p>";
echo "<p>";
@@ -37,4 +40,3 @@ $(document).ready(function() {
echo "</p>";
echo form_close();
-
diff --git a/system/application/views/template.php
b/system/application/views/template.php
index b93b659..8683afb 100644
--- a/system/application/views/template.php
+++ b/system/application/views/template.php
@@ -30,6 +30,7 @@ if (isset($add_css))
<script type="text/javascript" src="<?php echo asset_url();
?>js/superfish.js"></script>
<script type="text/javascript" src="<?php echo asset_url();
?>js/supersubs.js"></script>
<script type="text/javascript" src="<?php echo asset_url();
?>js/thickbox-compressed.js"></script>
+<script type="text/javascript" src="<?php echo asset_url();
?>js/ezpz_tooltip.min.js"></script>
<?php
/* Dynamically adding javascript files from controllers */
commit 326671139eaefabb272a4d1da2b44256b53b406a
Author: Prashant P Shah <pshah.mumbai(a)gmail.com>
Date: Wed Dec 22 16:10:33 2010 +0530
Edit tag uses the new jQuery color picker
Signed-off-by: Prashant P Shah <pshah.mumbai(a)gmail.com>
diff --git a/system/application/controllers/tag.php
b/system/application/controllers/tag.php
index 50180fb..a9cfc79 100644
--- a/system/application/controllers/tag.php
+++ b/system/application/controllers/tag.php
@@ -107,6 +107,19 @@ class Tag extends Controller {
function edit($id = 0)
{
$this->template->set('page_title', 'Edit Tag');
+
+ /* Colorpicker JS and CSS */
+ $this->template->set('add_css', array(
+ "plugins/colorpicker/css/colorpicker.css",
+ ));
+
+ $this->template->set('add_javascript', array(
+ "plugins/colorpicker/js/colorpicker.js",
+ "plugins/colorpicker/js/eye.js",
+ "plugins/colorpicker/js/utils.js",
+ "plugins/colorpicker/js/layout.js",
+ "plugins/colorpicker/js/startup.js",
+ ));
/* Checking for valid data */
$id = $this->input->xss_clean($id);
diff --git a/system/application/views/tag/edit.php
b/system/application/views/tag/edit.php
index 7709d48..b1afaf4 100644
--- a/system/application/views/tag/edit.php
+++ b/system/application/views/tag/edit.php
@@ -11,12 +11,16 @@
echo form_label('Tag Color', 'tag_color');
echo "<br />";
echo "#" . form_input($tag_color);
+ echo "   ";
+ echo "<span id=\"preview_tag_color\" style=\"padding:3px 20px 3px
20px;\"></span>";
echo "</p>";
echo "<p>";
echo form_label('Background Color', 'tag_background');
echo "<br />";
echo "#" . form_input($tag_background);
+ echo "   ";
+ echo "<span id=\"preview_tag_background\" style=\"padding:3px
20px 3px 20px;\"></span>";
echo "</p>";
echo "<p>";
commit 97be020f83da569252257b0fdff67976aefdafba
Author: Prashant P Shah <pshah.mumbai(a)gmail.com>
Date: Wed Dec 22 16:05:50 2010 +0530
Added jQuery Color Picker plugin
http://www.eyecon.ro/colorpicker/
Dual licensed under the MIT and GPL licenses.
- Add tag uses the color picker
Signed-off-by: Prashant P Shah <pshah.mumbai(a)gmail.com>
diff --git a/system/application/assets/plugins/colorpicker/css/colorpicker.css
b/system/application/assets/plugins/colorpicker/css/colorpicker.css
new file mode 100644
index 0000000..05b02b4
--- /dev/null
+++ b/system/application/assets/plugins/colorpicker/css/colorpicker.css
@@ -0,0 +1,161 @@
+.colorpicker {
+ width: 356px;
+ height: 176px;
+ overflow: hidden;
+ position: absolute;
+ background: url(../images/colorpicker_background.png);
+ font-family: Arial, Helvetica, sans-serif;
+ display: none;
+}
+.colorpicker_color {
+ width: 150px;
+ height: 150px;
+ left: 14px;
+ top: 13px;
+ position: absolute;
+ background: #f00;
+ overflow: hidden;
+ cursor: crosshair;
+}
+.colorpicker_color div {
+ position: absolute;
+ top: 0;
+ left: 0;
+ width: 150px;
+ height: 150px;
+ background: url(../images/colorpicker_overlay.png);
+}
+.colorpicker_color div div {
+ position: absolute;
+ top: 0;
+ left: 0;
+ width: 11px;
+ height: 11px;
+ overflow: hidden;
+ background: url(../images/colorpicker_select.gif);
+ margin: -5px 0 0 -5px;
+}
+.colorpicker_hue {
+ position: absolute;
+ top: 13px;
+ left: 171px;
+ width: 35px;
+ height: 150px;
+ cursor: n-resize;
+}
+.colorpicker_hue div {
+ position: absolute;
+ width: 35px;
+ height: 9px;
+ overflow: hidden;
+ background: url(../images/colorpicker_indic.gif) left top;
+ margin: -4px 0 0 0;
+ left: 0px;
+}
+.colorpicker_new_color {
+ position: absolute;
+ width: 60px;
+ height: 30px;
+ left: 213px;
+ top: 13px;
+ background: #f00;
+}
+.colorpicker_current_color {
+ position: absolute;
+ width: 60px;
+ height: 30px;
+ left: 283px;
+ top: 13px;
+ background: #f00;
+}
+.colorpicker input {
+ background-color: transparent;
+ border: 1px solid transparent;
+ position: absolute;
+ font-size: 10px;
+ font-family: Arial, Helvetica, sans-serif;
+ color: #898989;
+ top: 4px;
+ right: 11px;
+ text-align: right;
+ margin: 0;
+ padding: 0;
+ height: 11px;
+}
+.colorpicker_hex {
+ position: absolute;
+ width: 72px;
+ height: 22px;
+ background: url(../images/colorpicker_hex.png) top;
+ left: 212px;
+ top: 142px;
+}
+.colorpicker_hex input {
+ right: 6px;
+}
+.colorpicker_field {
+ height: 22px;
+ width: 62px;
+ background-position: top;
+ position: absolute;
+}
+.colorpicker_field span {
+ position: absolute;
+ width: 12px;
+ height: 22px;
+ overflow: hidden;
+ top: 0;
+ right: 0;
+ cursor: n-resize;
+}
+.colorpicker_rgb_r {
+ background-image: url(../images/colorpicker_rgb_r.png);
+ top: 52px;
+ left: 212px;
+}
+.colorpicker_rgb_g {
+ background-image: url(../images/colorpicker_rgb_g.png);
+ top: 82px;
+ left: 212px;
+}
+.colorpicker_rgb_b {
+ background-image: url(../images/colorpicker_rgb_b.png);
+ top: 112px;
+ left: 212px;
+}
+.colorpicker_hsb_h {
+ background-image: url(../images/colorpicker_hsb_h.png);
+ top: 52px;
+ left: 282px;
+}
+.colorpicker_hsb_s {
+ background-image: url(../images/colorpicker_hsb_s.png);
+ top: 82px;
+ left: 282px;
+}
+.colorpicker_hsb_b {
+ background-image: url(../images/colorpicker_hsb_b.png);
+ top: 112px;
+ left: 282px;
+}
+.colorpicker_submit {
+ position: absolute;
+ width: 22px;
+ height: 22px;
+ background: url(../images/colorpicker_submit.png) top;
+ left: 322px;
+ top: 142px;
+ overflow: hidden;
+}
+.colorpicker_focus {
+ background-position: center;
+}
+.colorpicker_hex.colorpicker_focus {
+ background-position: bottom;
+}
+.colorpicker_submit.colorpicker_focus {
+ background-position: bottom;
+}
+.colorpicker_slider {
+ background-position: bottom;
+}
diff --git a/system/application/assets/plugins/colorpicker/css/layout.css
b/system/application/assets/plugins/colorpicker/css/layout.css
new file mode 100644
index 0000000..8b3f00f
--- /dev/null
+++ b/system/application/assets/plugins/colorpicker/css/layout.css
@@ -0,0 +1,218 @@
+body,div,dl,dt,dd,ul,ol,li,h1,h2,h3,h4,h5,h6,pre,form,fieldset,input,textarea,p,blockquote,th,td
{
+ margin:0;
+ padding:0;
+}
+table {
+ border-collapse:collapse;
+ border-spacing:0;
+}
+fieldset,img {
+ border:0;
+}
+address,caption,cite,code,dfn,em,strong,th,var {
+ font-style:normal;
+ font-weight:normal;
+}
+ol,ul {
+ list-style:none;
+}
+caption,th {
+ text-align:left;
+}
+h1,h2,h3,h4,h5,h6 {
+ font-size:100%;
+ font-weight:normal;
+}
+q:before,q:after {
+ content:'';
+}
+abbr,acronym { border:0;
+}
+html, body {
+ background-color: #fff;
+ font-family: Arial, Helvetica, sans-serif;
+ font-size: 12px;
+ line-height: 18px;
+ color: #52697E;
+}
+body {
+ text-align: center;
+ overflow: auto;
+}
+.wrapper {
+ width: 700px;
+ margin: 0 auto;
+ text-align: left;
+}
+h1 {
+ font-size: 21px;
+ height: 47px;
+ line-height: 47px;
+ text-transform: uppercase;
+}
+.navigationTabs {
+ height: 23px;
+ line-height: 23px;
+ border-bottom: 1px solid #ccc;
+}
+.navigationTabs li {
+ float: left;
+ height: 23px;
+ line-height: 23px;
+ padding-right: 3px;
+}
+.navigationTabs li a{
+ float: left;
+ dispaly: block;
+ height: 23px;
+ line-height: 23px;
+ padding: 0 10px;
+ overflow: hidden;
+ color: #52697E;
+ background-color: #eee;
+ position: relative;
+ text-decoration: none;
+}
+.navigationTabs li a:hover {
+ background-color: #f0f0f0;
+}
+.navigationTabs li a.active {
+ background-color: #fff;
+ border: 1px solid #ccc;
+ border-bottom: 0px solid;
+}
+.tabsContent {
+ border: 1px solid #ccc;
+ border-top: 0px solid;
+ width: 698px;
+ overflow: hidden;
+}
+.tab {
+ padding: 16px;
+ display: none;
+}
+.tab h2 {
+ font-weight: bold;
+ font-size: 16px;
+}
+.tab h3 {
+ font-weight: bold;
+ font-size: 14px;
+ margin-top: 20px;
+}
+.tab p {
+ margin-top: 16px;
+ clear: both;
+}
+.tab ul {
+ margin-top: 16px;
+ list-style: disc;
+}
+.tab li {
+ margin: 10px 0 0 35px;
+}
+.tab a {
+ color: #8FB0CF;
+}
+.tab strong {
+ font-weight: bold;
+}
+.tab pre {
+ font-size: 11px;
+ margin-top: 20px;
+ width: 668px;
+ overflow: auto;
+ clear: both;
+}
+.tab table {
+ width: 100%;
+}
+.tab table td {
+ padding: 6px 10px 6px 0;
+ vertical-align: top;
+}
+.tab dt {
+ margin-top: 16px;
+}
+
+#colorSelector {
+ position: relative;
+ width: 36px;
+ height: 36px;
+ background: url(../images/select.png);
+}
+#colorSelector div {
+ position: absolute;
+ top: 3px;
+ left: 3px;
+ width: 30px;
+ height: 30px;
+ background: url(../images/select.png) center;
+}
+#colorSelector2 {
+ position: absolute;
+ top: 0;
+ left: 0;
+ width: 36px;
+ height: 36px;
+ background: url(../images/select2.png);
+}
+#colorSelector2 div {
+ position: absolute;
+ top: 4px;
+ left: 4px;
+ width: 28px;
+ height: 28px;
+ background: url(../images/select2.png) center;
+}
+#colorpickerHolder2 {
+ top: 32px;
+ left: 0;
+ width: 356px;
+ height: 0;
+ overflow: hidden;
+ position: absolute;
+}
+#colorpickerHolder2 .colorpicker {
+ background-image: url(../images/custom_background.png);
+ position: absolute;
+ bottom: 0;
+ left: 0;
+}
+#colorpickerHolder2 .colorpicker_hue div {
+ background-image: url(../images/custom_indic.gif);
+}
+#colorpickerHolder2 .colorpicker_hex {
+ background-image: url(../images/custom_hex.png);
+}
+#colorpickerHolder2 .colorpicker_rgb_r {
+ background-image: url(../images/custom_rgb_r.png);
+}
+#colorpickerHolder2 .colorpicker_rgb_g {
+ background-image: url(../images/custom_rgb_g.png);
+}
+#colorpickerHolder2 .colorpicker_rgb_b {
+ background-image: url(../images/custom_rgb_b.png);
+}
+#colorpickerHolder2 .colorpicker_hsb_s {
+ background-image: url(../images/custom_hsb_s.png);
+ display: none;
+}
+#colorpickerHolder2 .colorpicker_hsb_h {
+ background-image: url(../images/custom_hsb_h.png);
+ display: none;
+}
+#colorpickerHolder2 .colorpicker_hsb_b {
+ background-image: url(../images/custom_hsb_b.png);
+ display: none;
+}
+#colorpickerHolder2 .colorpicker_submit {
+ background-image: url(../images/custom_submit.png);
+}
+#colorpickerHolder2 .colorpicker input {
+ color: #778398;
+}
+#customWidget {
+ position: relative;
+ height: 36px;
+}
diff --git a/system/application/assets/plugins/colorpicker/images/blank.gif
b/system/application/assets/plugins/colorpicker/images/blank.gif
new file mode 100644
index 0000000..75b945d
Binary files /dev/null and
b/system/application/assets/plugins/colorpicker/images/blank.gif differ
diff --git
a/system/application/assets/plugins/colorpicker/images/colorpicker_background.png
b/system/application/assets/plugins/colorpicker/images/colorpicker_background.png
new file mode 100644
index 0000000..8401572
Binary files /dev/null and
b/system/application/assets/plugins/colorpicker/images/colorpicker_background.png differ
diff --git a/system/application/assets/plugins/colorpicker/images/colorpicker_hex.png
b/system/application/assets/plugins/colorpicker/images/colorpicker_hex.png
new file mode 100644
index 0000000..4e532d7
Binary files /dev/null and
b/system/application/assets/plugins/colorpicker/images/colorpicker_hex.png differ
diff --git a/system/application/assets/plugins/colorpicker/images/colorpicker_hsb_b.png
b/system/application/assets/plugins/colorpicker/images/colorpicker_hsb_b.png
new file mode 100644
index 0000000..dfac595
Binary files /dev/null and
b/system/application/assets/plugins/colorpicker/images/colorpicker_hsb_b.png differ
diff --git a/system/application/assets/plugins/colorpicker/images/colorpicker_hsb_h.png
b/system/application/assets/plugins/colorpicker/images/colorpicker_hsb_h.png
new file mode 100644
index 0000000..3977ed9
Binary files /dev/null and
b/system/application/assets/plugins/colorpicker/images/colorpicker_hsb_h.png differ
diff --git a/system/application/assets/plugins/colorpicker/images/colorpicker_hsb_s.png
b/system/application/assets/plugins/colorpicker/images/colorpicker_hsb_s.png
new file mode 100644
index 0000000..a2a6997
Binary files /dev/null and
b/system/application/assets/plugins/colorpicker/images/colorpicker_hsb_s.png differ
diff --git a/system/application/assets/plugins/colorpicker/images/colorpicker_indic.gif
b/system/application/assets/plugins/colorpicker/images/colorpicker_indic.gif
new file mode 100644
index 0000000..f9fa95e
Binary files /dev/null and
b/system/application/assets/plugins/colorpicker/images/colorpicker_indic.gif differ
diff --git a/system/application/assets/plugins/colorpicker/images/colorpicker_overlay.png
b/system/application/assets/plugins/colorpicker/images/colorpicker_overlay.png
new file mode 100644
index 0000000..561cdd9
Binary files /dev/null and
b/system/application/assets/plugins/colorpicker/images/colorpicker_overlay.png differ
diff --git a/system/application/assets/plugins/colorpicker/images/colorpicker_rgb_b.png
b/system/application/assets/plugins/colorpicker/images/colorpicker_rgb_b.png
new file mode 100644
index 0000000..dfac595
Binary files /dev/null and
b/system/application/assets/plugins/colorpicker/images/colorpicker_rgb_b.png differ
diff --git a/system/application/assets/plugins/colorpicker/images/colorpicker_rgb_g.png
b/system/application/assets/plugins/colorpicker/images/colorpicker_rgb_g.png
new file mode 100644
index 0000000..72b3276
Binary files /dev/null and
b/system/application/assets/plugins/colorpicker/images/colorpicker_rgb_g.png differ
diff --git a/system/application/assets/plugins/colorpicker/images/colorpicker_rgb_r.png
b/system/application/assets/plugins/colorpicker/images/colorpicker_rgb_r.png
new file mode 100644
index 0000000..4855fe0
Binary files /dev/null and
b/system/application/assets/plugins/colorpicker/images/colorpicker_rgb_r.png differ
diff --git a/system/application/assets/plugins/colorpicker/images/colorpicker_select.gif
b/system/application/assets/plugins/colorpicker/images/colorpicker_select.gif
new file mode 100644
index 0000000..599f7f1
Binary files /dev/null and
b/system/application/assets/plugins/colorpicker/images/colorpicker_select.gif differ
diff --git a/system/application/assets/plugins/colorpicker/images/colorpicker_submit.png
b/system/application/assets/plugins/colorpicker/images/colorpicker_submit.png
new file mode 100644
index 0000000..7f4c082
Binary files /dev/null and
b/system/application/assets/plugins/colorpicker/images/colorpicker_submit.png differ
diff --git a/system/application/assets/plugins/colorpicker/images/custom_background.png
b/system/application/assets/plugins/colorpicker/images/custom_background.png
new file mode 100644
index 0000000..cf55ffd
Binary files /dev/null and
b/system/application/assets/plugins/colorpicker/images/custom_background.png differ
diff --git a/system/application/assets/plugins/colorpicker/images/custom_hex.png
b/system/application/assets/plugins/colorpicker/images/custom_hex.png
new file mode 100644
index 0000000..888f444
Binary files /dev/null and
b/system/application/assets/plugins/colorpicker/images/custom_hex.png differ
diff --git a/system/application/assets/plugins/colorpicker/images/custom_hsb_b.png
b/system/application/assets/plugins/colorpicker/images/custom_hsb_b.png
new file mode 100644
index 0000000..2f99dae
Binary files /dev/null and
b/system/application/assets/plugins/colorpicker/images/custom_hsb_b.png differ
diff --git a/system/application/assets/plugins/colorpicker/images/custom_hsb_h.png
b/system/application/assets/plugins/colorpicker/images/custom_hsb_h.png
new file mode 100644
index 0000000..a217e92
Binary files /dev/null and
b/system/application/assets/plugins/colorpicker/images/custom_hsb_h.png differ
diff --git a/system/application/assets/plugins/colorpicker/images/custom_hsb_s.png
b/system/application/assets/plugins/colorpicker/images/custom_hsb_s.png
new file mode 100644
index 0000000..7826b41
Binary files /dev/null and
b/system/application/assets/plugins/colorpicker/images/custom_hsb_s.png differ
diff --git a/system/application/assets/plugins/colorpicker/images/custom_indic.gif
b/system/application/assets/plugins/colorpicker/images/custom_indic.gif
new file mode 100644
index 0000000..222fb94
Binary files /dev/null and
b/system/application/assets/plugins/colorpicker/images/custom_indic.gif differ
diff --git a/system/application/assets/plugins/colorpicker/images/custom_rgb_b.png
b/system/application/assets/plugins/colorpicker/images/custom_rgb_b.png
new file mode 100644
index 0000000..80764e5
Binary files /dev/null and
b/system/application/assets/plugins/colorpicker/images/custom_rgb_b.png differ
diff --git a/system/application/assets/plugins/colorpicker/images/custom_rgb_g.png
b/system/application/assets/plugins/colorpicker/images/custom_rgb_g.png
new file mode 100644
index 0000000..fc9778b
Binary files /dev/null and
b/system/application/assets/plugins/colorpicker/images/custom_rgb_g.png differ
diff --git a/system/application/assets/plugins/colorpicker/images/custom_rgb_r.png
b/system/application/assets/plugins/colorpicker/images/custom_rgb_r.png
new file mode 100644
index 0000000..91b0cd4
Binary files /dev/null and
b/system/application/assets/plugins/colorpicker/images/custom_rgb_r.png differ
diff --git a/system/application/assets/plugins/colorpicker/images/custom_submit.png
b/system/application/assets/plugins/colorpicker/images/custom_submit.png
new file mode 100644
index 0000000..cd202cd
Binary files /dev/null and
b/system/application/assets/plugins/colorpicker/images/custom_submit.png differ
diff --git a/system/application/assets/plugins/colorpicker/images/select.png
b/system/application/assets/plugins/colorpicker/images/select.png
new file mode 100644
index 0000000..21213bf
Binary files /dev/null and
b/system/application/assets/plugins/colorpicker/images/select.png differ
diff --git a/system/application/assets/plugins/colorpicker/images/select2.png
b/system/application/assets/plugins/colorpicker/images/select2.png
new file mode 100644
index 0000000..2cd2cab
Binary files /dev/null and
b/system/application/assets/plugins/colorpicker/images/select2.png differ
diff --git a/system/application/assets/plugins/colorpicker/images/slider.png
b/system/application/assets/plugins/colorpicker/images/slider.png
new file mode 100644
index 0000000..8b03da9
Binary files /dev/null and
b/system/application/assets/plugins/colorpicker/images/slider.png differ
diff --git a/system/application/assets/plugins/colorpicker/js/colorpicker.js
b/system/application/assets/plugins/colorpicker/js/colorpicker.js
new file mode 100644
index 0000000..10a2b22
--- /dev/null
+++ b/system/application/assets/plugins/colorpicker/js/colorpicker.js
@@ -0,0 +1,484 @@
+/**
+ *
+ * Color picker
+ * Author: Stefan Petre
www.eyecon.ro
+ *
+ * Dual licensed under the MIT and GPL licenses
+ *
+ */
+(function ($) {
+ var ColorPicker = function () {
+ var
+ ids = {},
+ inAction,
+ charMin = 65,
+ visible,
+ tpl = '<div class="colorpicker"><div
class="colorpicker_color"><div><div></div></div></div><div
class="colorpicker_hue"><div></div></div><div
class="colorpicker_new_color"></div><div
class="colorpicker_current_color"></div><div
class="colorpicker_hex"><input type="text"
maxlength="6" size="6" /></div><div
class="colorpicker_rgb_r colorpicker_field"><input type="text"
maxlength="3" size="3"
/><span></span></div><div class="colorpicker_rgb_g
colorpicker_field"><input type="text" maxlength="3"
size="3" /><span></span></div><div
class="colorpicker_rgb_b colorpicker_field"><input type="text"
maxlength="3" size="3"
/><span></span></div><div class="colorpicker_hsb_h
colorpicker_field"><input type="text" maxlength="3"
size="3" /><span></span></div><div
class="colorpicker_hsb_s colorpicker_field"><input type="text"
maxlength="3" size="3"
/><span></span></div><div class="colorpicker_hsb_b
colorpicker_field"><input type="text" maxlength="3"
size="3" /><span></span></div><div
class="colorpicker_submit"></div></div>',
+ defaults = {
+ eventName: 'click',
+ onShow: function () {},
+ onBeforeShow: function(){},
+ onHide: function () {},
+ onChange: function () {},
+ onSubmit: function () {},
+ color: 'ff0000',
+ livePreview: true,
+ flat: false
+ },
+ fillRGBFields = function (hsb, cal) {
+ var rgb = HSBToRGB(hsb);
+ $(cal).data('colorpicker').fields
+ .eq(1).val(rgb.r).end()
+ .eq(2).val(rgb.g).end()
+ .eq(3).val(rgb.b).end();
+ },
+ fillHSBFields = function (hsb, cal) {
+ $(cal).data('colorpicker').fields
+ .eq(4).val(hsb.h).end()
+ .eq(5).val(hsb.s).end()
+ .eq(6).val(hsb.b).end();
+ },
+ fillHexFields = function (hsb, cal) {
+ $(cal).data('colorpicker').fields
+ .eq(0).val(HSBToHex(hsb)).end();
+ },
+ setSelector = function (hsb, cal) {
+ $(cal).data('colorpicker').selector.css('backgroundColor',
'#' + HSBToHex({h: hsb.h, s: 100, b: 100}));
+ $(cal).data('colorpicker').selectorIndic.css({
+ left: parseInt(150 * hsb.s/100, 10),
+ top: parseInt(150 * (100-hsb.b)/100, 10)
+ });
+ },
+ setHue = function (hsb, cal) {
+ $(cal).data('colorpicker').hue.css('top', parseInt(150 - 150 *
hsb.h/360, 10));
+ },
+ setCurrentColor = function (hsb, cal) {
+ $(cal).data('colorpicker').currentColor.css('backgroundColor',
'#' + HSBToHex(hsb));
+ },
+ setNewColor = function (hsb, cal) {
+ $(cal).data('colorpicker').newColor.css('backgroundColor',
'#' + HSBToHex(hsb));
+ },
+ keyDown = function (ev) {
+ var pressedKey = ev.charCode || ev.keyCode || -1;
+ if ((pressedKey > charMin && pressedKey <= 90) || pressedKey == 32) {
+ return false;
+ }
+ var cal = $(this).parent().parent();
+ if (cal.data('colorpicker').livePreview === true) {
+ change.apply(this);
+ }
+ },
+ change = function (ev) {
+ var cal = $(this).parent().parent(), col;
+ if (this.parentNode.className.indexOf('_hex') > 0) {
+ cal.data('colorpicker').color = col = HexToHSB(fixHex(this.value));
+ } else if (this.parentNode.className.indexOf('_hsb') > 0) {
+ cal.data('colorpicker').color = col = fixHSB({
+ h: parseInt(cal.data('colorpicker').fields.eq(4).val(), 10),
+ s: parseInt(cal.data('colorpicker').fields.eq(5).val(), 10),
+ b: parseInt(cal.data('colorpicker').fields.eq(6).val(), 10)
+ });
+ } else {
+ cal.data('colorpicker').color = col = RGBToHSB(fixRGB({
+ r: parseInt(cal.data('colorpicker').fields.eq(1).val(), 10),
+ g: parseInt(cal.data('colorpicker').fields.eq(2).val(), 10),
+ b: parseInt(cal.data('colorpicker').fields.eq(3).val(), 10)
+ }));
+ }
+ if (ev) {
+ fillRGBFields(col, cal.get(0));
+ fillHexFields(col, cal.get(0));
+ fillHSBFields(col, cal.get(0));
+ }
+ setSelector(col, cal.get(0));
+ setHue(col, cal.get(0));
+ setNewColor(col, cal.get(0));
+ cal.data('colorpicker').onChange.apply(cal, [col, HSBToHex(col),
HSBToRGB(col)]);
+ },
+ blur = function (ev) {
+ var cal = $(this).parent().parent();
+ cal.data('colorpicker').fields.parent().removeClass('colorpicker_focus');
+ },
+ focus = function () {
+ charMin = this.parentNode.className.indexOf('_hex') > 0 ? 70 : 65;
+ $(this).parent().parent().data('colorpicker').fields.parent().removeClass('colorpicker_focus');
+ $(this).parent().addClass('colorpicker_focus');
+ },
+ downIncrement = function (ev) {
+ var field = $(this).parent().find('input').focus();
+ var current = {
+ el: $(this).parent().addClass('colorpicker_slider'),
+ max: this.parentNode.className.indexOf('_hsb_h') > 0 ? 360 :
(this.parentNode.className.indexOf('_hsb') > 0 ? 100 : 255),
+ y: ev.pageY,
+ field: field,
+ val: parseInt(field.val(), 10),
+ preview: $(this).parent().parent().data('colorpicker').livePreview
+ };
+ $(document).bind('mouseup', current, upIncrement);
+ $(document).bind('mousemove', current, moveIncrement);
+ },
+ moveIncrement = function (ev) {
+ ev.data.field.val(Math.max(0, Math.min(ev.data.max, parseInt(ev.data.val + ev.pageY -
ev.data.y, 10))));
+ if (ev.data.preview) {
+ change.apply(ev.data.field.get(0), [true]);
+ }
+ return false;
+ },
+ upIncrement = function (ev) {
+ change.apply(ev.data.field.get(0), [true]);
+ ev.data.el.removeClass('colorpicker_slider').find('input').focus();
+ $(document).unbind('mouseup', upIncrement);
+ $(document).unbind('mousemove', moveIncrement);
+ return false;
+ },
+ downHue = function (ev) {
+ var current = {
+ cal: $(this).parent(),
+ y: $(this).offset().top
+ };
+ current.preview = current.cal.data('colorpicker').livePreview;
+ $(document).bind('mouseup', current, upHue);
+ $(document).bind('mousemove', current, moveHue);
+ },
+ moveHue = function (ev) {
+ change.apply(
+ ev.data.cal.data('colorpicker')
+ .fields
+ .eq(4)
+ .val(parseInt(360*(150 - Math.max(0,Math.min(150,(ev.pageY - ev.data.y))))/150,
10))
+ .get(0),
+ [ev.data.preview]
+ );
+ return false;
+ },
+ upHue = function (ev) {
+ fillRGBFields(ev.data.cal.data('colorpicker').color, ev.data.cal.get(0));
+ fillHexFields(ev.data.cal.data('colorpicker').color, ev.data.cal.get(0));
+ $(document).unbind('mouseup', upHue);
+ $(document).unbind('mousemove', moveHue);
+ return false;
+ },
+ downSelector = function (ev) {
+ var current = {
+ cal: $(this).parent(),
+ pos: $(this).offset()
+ };
+ current.preview = current.cal.data('colorpicker').livePreview;
+ $(document).bind('mouseup', current, upSelector);
+ $(document).bind('mousemove', current, moveSelector);
+ },
+ moveSelector = function (ev) {
+ change.apply(
+ ev.data.cal.data('colorpicker')
+ .fields
+ .eq(6)
+ .val(parseInt(100*(150 - Math.max(0,Math.min(150,(ev.pageY -
ev.data.pos.top))))/150, 10))
+ .end()
+ .eq(5)
+ .val(parseInt(100*(Math.max(0,Math.min(150,(ev.pageX - ev.data.pos.left))))/150,
10))
+ .get(0),
+ [ev.data.preview]
+ );
+ return false;
+ },
+ upSelector = function (ev) {
+ fillRGBFields(ev.data.cal.data('colorpicker').color, ev.data.cal.get(0));
+ fillHexFields(ev.data.cal.data('colorpicker').color, ev.data.cal.get(0));
+ $(document).unbind('mouseup', upSelector);
+ $(document).unbind('mousemove', moveSelector);
+ return false;
+ },
+ enterSubmit = function (ev) {
+ $(this).addClass('colorpicker_focus');
+ },
+ leaveSubmit = function (ev) {
+ $(this).removeClass('colorpicker_focus');
+ },
+ clickSubmit = function (ev) {
+ var cal = $(this).parent();
+ var col = cal.data('colorpicker').color;
+ cal.data('colorpicker').origColor = col;
+ setCurrentColor(col, cal.get(0));
+ cal.data('colorpicker').onSubmit(col, HSBToHex(col), HSBToRGB(col),
cal.data('colorpicker').el);
+ },
+ show = function (ev) {
+ var cal = $('#' + $(this).data('colorpickerId'));
+ cal.data('colorpicker').onBeforeShow.apply(this, [cal.get(0)]);
+ var pos = $(this).offset();
+ var viewPort = getViewport();
+ var top = pos.top + this.offsetHeight;
+ var left = pos.left;
+ if (top + 176 > viewPort.t + viewPort.h) {
+ top -= this.offsetHeight + 176;
+ }
+ if (left + 356 > viewPort.l + viewPort.w) {
+ left -= 356;
+ }
+ cal.css({left: left + 'px', top: top + 'px'});
+ if (cal.data('colorpicker').onShow.apply(this, [cal.get(0)]) != false) {
+ cal.show();
+ }
+ $(document).bind('mousedown', {cal: cal}, hide);
+ return false;
+ },
+ hide = function (ev) {
+ if (!isChildOf(ev.data.cal.get(0), ev.target, ev.data.cal.get(0))) {
+ if (ev.data.cal.data('colorpicker').onHide.apply(this, [ev.data.cal.get(0)])
!= false) {
+ ev.data.cal.hide();
+ }
+ $(document).unbind('mousedown', hide);
+ }
+ },
+ isChildOf = function(parentEl, el, container) {
+ if (parentEl == el) {
+ return true;
+ }
+ if (parentEl.contains) {
+ return parentEl.contains(el);
+ }
+ if ( parentEl.compareDocumentPosition ) {
+ return !!(parentEl.compareDocumentPosition(el) & 16);
+ }
+ var prEl = el.parentNode;
+ while(prEl && prEl != container) {
+ if (prEl == parentEl)
+ return true;
+ prEl = prEl.parentNode;
+ }
+ return false;
+ },
+ getViewport = function () {
+ var m = document.compatMode == 'CSS1Compat';
+ return {
+ l : window.pageXOffset || (m ? document.documentElement.scrollLeft :
document.body.scrollLeft),
+ t : window.pageYOffset || (m ? document.documentElement.scrollTop :
document.body.scrollTop),
+ w : window.innerWidth || (m ? document.documentElement.clientWidth :
document.body.clientWidth),
+ h : window.innerHeight || (m ? document.documentElement.clientHeight :
document.body.clientHeight)
+ };
+ },
+ fixHSB = function (hsb) {
+ return {
+ h: Math.min(360, Math.max(0, hsb.h)),
+ s: Math.min(100, Math.max(0, hsb.s)),
+ b: Math.min(100, Math.max(0, hsb.b))
+ };
+ },
+ fixRGB = function (rgb) {
+ return {
+ r: Math.min(255, Math.max(0, rgb.r)),
+ g: Math.min(255, Math.max(0, rgb.g)),
+ b: Math.min(255, Math.max(0, rgb.b))
+ };
+ },
+ fixHex = function (hex) {
+ var len = 6 - hex.length;
+ if (len > 0) {
+ var o = [];
+ for (var i=0; i<len; i++) {
+ o.push('0');
+ }
+ o.push(hex);
+ hex = o.join('');
+ }
+ return hex;
+ },
+ HexToRGB = function (hex) {
+ var hex = parseInt(((hex.indexOf('#') > -1) ? hex.substring(1) : hex),
16);
+ return {r: hex >> 16, g: (hex & 0x00FF00) >> 8, b: (hex &
0x0000FF)};
+ },
+ HexToHSB = function (hex) {
+ return RGBToHSB(HexToRGB(hex));
+ },
+ RGBToHSB = function (rgb) {
+ var hsb = {
+ h: 0,
+ s: 0,
+ b: 0
+ };
+ var min = Math.min(rgb.r, rgb.g, rgb.b);
+ var max = Math.max(rgb.r, rgb.g, rgb.b);
+ var delta = max - min;
+ hsb.b = max;
+ if (max != 0) {
+
+ }
+ hsb.s = max != 0 ? 255 * delta / max : 0;
+ if (hsb.s != 0) {
+ if (rgb.r == max) {
+ hsb.h = (rgb.g - rgb.b) / delta;
+ } else if (rgb.g == max) {
+ hsb.h = 2 + (rgb.b - rgb.r) / delta;
+ } else {
+ hsb.h = 4 + (rgb.r - rgb.g) / delta;
+ }
+ } else {
+ hsb.h = -1;
+ }
+ hsb.h *= 60;
+ if (hsb.h < 0) {
+ hsb.h += 360;
+ }
+ hsb.s *= 100/255;
+ hsb.b *= 100/255;
+ return hsb;
+ },
+ HSBToRGB = function (hsb) {
+ var rgb = {};
+ var h = Math.round(hsb.h);
+ var s = Math.round(hsb.s*255/100);
+ var v = Math.round(hsb.b*255/100);
+ if(s == 0) {
+ rgb.r = rgb.g = rgb.b = v;
+ } else {
+ var t1 = v;
+ var t2 = (255-s)*v/255;
+ var t3 = (t1-t2)*(h%60)/60;
+ if(h==360) h = 0;
+ if(h<60) {rgb.r=t1; rgb.b=t2; rgb.g=t2+t3}
+ else if(h<120) {rgb.g=t1; rgb.b=t2; rgb.r=t1-t3}
+ else if(h<180) {rgb.g=t1; rgb.r=t2; rgb.b=t2+t3}
+ else if(h<240) {rgb.b=t1; rgb.r=t2; rgb.g=t1-t3}
+ else if(h<300) {rgb.b=t1; rgb.g=t2; rgb.r=t2+t3}
+ else if(h<360) {rgb.r=t1; rgb.g=t2; rgb.b=t1-t3}
+ else {rgb.r=0; rgb.g=0; rgb.b=0}
+ }
+ return {r:Math.round(rgb.r), g:Math.round(rgb.g), b:Math.round(rgb.b)};
+ },
+ RGBToHex = function (rgb) {
+ var hex = [
+ rgb.r.toString(16),
+ rgb.g.toString(16),
+ rgb.b.toString(16)
+ ];
+ $.each(hex, function (nr, val) {
+ if (val.length == 1) {
+ hex[nr] = '0' + val;
+ }
+ });
+ return hex.join('');
+ },
+ HSBToHex = function (hsb) {
+ return RGBToHex(HSBToRGB(hsb));
+ },
+ restoreOriginal = function () {
+ var cal = $(this).parent();
+ var col = cal.data('colorpicker').origColor;
+ cal.data('colorpicker').color = col;
+ fillRGBFields(col, cal.get(0));
+ fillHexFields(col, cal.get(0));
+ fillHSBFields(col, cal.get(0));
+ setSelector(col, cal.get(0));
+ setHue(col, cal.get(0));
+ setNewColor(col, cal.get(0));
+ };
+ return {
+ init: function (opt) {
+ opt = $.extend({}, defaults, opt||{});
+ if (typeof opt.color == 'string') {
+ opt.color = HexToHSB(opt.color);
+ } else if (opt.color.r != undefined && opt.color.g != undefined &&
opt.color.b != undefined) {
+ opt.color = RGBToHSB(opt.color);
+ } else if (opt.color.h != undefined && opt.color.s != undefined &&
opt.color.b != undefined) {
+ opt.color = fixHSB(opt.color);
+ } else {
+ return this;
+ }
+ return this.each(function () {
+ if (!$(this).data('colorpickerId')) {
+ var options = $.extend({}, opt);
+ options.origColor = opt.color;
+ var id = 'collorpicker_' + parseInt(Math.random() * 1000);
+ $(this).data('colorpickerId', id);
+ var cal = $(tpl).attr('id', id);
+ if (options.flat) {
+ cal.appendTo(this).show();
+ } else {
+ cal.appendTo(document.body);
+ }
+ options.fields = cal
+ .find('input')
+ .bind('keyup', keyDown)
+ .bind('change', change)
+ .bind('blur', blur)
+ .bind('focus', focus);
+ cal
+ .find('span').bind('mousedown', downIncrement).end()
+ .find('>div.colorpicker_current_color').bind('click',
restoreOriginal);
+ options.selector =
cal.find('div.colorpicker_color').bind('mousedown', downSelector);
+ options.selectorIndic = options.selector.find('div div');
+ options.el = this;
+ options.hue = cal.find('div.colorpicker_hue div');
+ cal.find('div.colorpicker_hue').bind('mousedown', downHue);
+ options.newColor = cal.find('div.colorpicker_new_color');
+ options.currentColor = cal.find('div.colorpicker_current_color');
+ cal.data('colorpicker', options);
+ cal.find('div.colorpicker_submit')
+ .bind('mouseenter', enterSubmit)
+ .bind('mouseleave', leaveSubmit)
+ .bind('click', clickSubmit);
+ fillRGBFields(options.color, cal.get(0));
+ fillHSBFields(options.color, cal.get(0));
+ fillHexFields(options.color, cal.get(0));
+ setHue(options.color, cal.get(0));
+ setSelector(options.color, cal.get(0));
+ setCurrentColor(options.color, cal.get(0));
+ setNewColor(options.color, cal.get(0));
+ if (options.flat) {
+ cal.css({
+ position: 'relative',
+ display: 'block'
+ });
+ } else {
+ $(this).bind(options.eventName, show);
+ }
+ }
+ });
+ },
+ showPicker: function() {
+ return this.each( function () {
+ if ($(this).data('colorpickerId')) {
+ show.apply(this);
+ }
+ });
+ },
+ hidePicker: function() {
+ return this.each( function () {
+ if ($(this).data('colorpickerId')) {
+ $('#' + $(this).data('colorpickerId')).hide();
+ }
+ });
+ },
+ setColor: function(col) {
+ if (typeof col == 'string') {
+ col = HexToHSB(col);
+ } else if (col.r != undefined && col.g != undefined && col.b !=
undefined) {
+ col = RGBToHSB(col);
+ } else if (col.h != undefined && col.s != undefined && col.b !=
undefined) {
+ col = fixHSB(col);
+ } else {
+ return this;
+ }
+ return this.each(function(){
+ if ($(this).data('colorpickerId')) {
+ var cal = $('#' + $(this).data('colorpickerId'));
+ cal.data('colorpicker').color = col;
+ cal.data('colorpicker').origColor = col;
+ fillRGBFields(col, cal.get(0));
+ fillHSBFields(col, cal.get(0));
+ fillHexFields(col, cal.get(0));
+ setHue(col, cal.get(0));
+ setSelector(col, cal.get(0));
+ setCurrentColor(col, cal.get(0));
+ setNewColor(col, cal.get(0));
+ }
+ });
+ }
+ };
+ }();
+ $.fn.extend({
+ ColorPicker: ColorPicker.init,
+ ColorPickerHide: ColorPicker.hidePicker,
+ ColorPickerShow: ColorPicker.showPicker,
+ ColorPickerSetColor: ColorPicker.setColor
+ });
+})(jQuery)
\ No newline at end of file
diff --git a/system/application/assets/plugins/colorpicker/js/eye.js
b/system/application/assets/plugins/colorpicker/js/eye.js
new file mode 100644
index 0000000..ea70e64
--- /dev/null
+++ b/system/application/assets/plugins/colorpicker/js/eye.js
@@ -0,0 +1,34 @@
+/**
+ *
+ * Zoomimage
+ * Author: Stefan Petre
www.eyecon.ro
+ *
+ */
+(function($){
+ var EYE = window.EYE = function() {
+ var _registered = {
+ init: []
+ };
+ return {
+ init: function() {
+ $.each(_registered.init, function(nr, fn){
+ fn.call();
+ });
+ },
+ extend: function(prop) {
+ for (var i in prop) {
+ if (prop[i] != undefined) {
+ this[i] = prop[i];
+ }
+ }
+ },
+ register: function(fn, type) {
+ if (!_registered[type]) {
+ _registered[type] = [];
+ }
+ _registered[type].push(fn);
+ }
+ };
+ }();
+ $(EYE.init);
+})(jQuery);
diff --git a/system/application/assets/plugins/colorpicker/js/layout.js
b/system/application/assets/plugins/colorpicker/js/layout.js
new file mode 100644
index 0000000..e0dfb8f
--- /dev/null
+++ b/system/application/assets/plugins/colorpicker/js/layout.js
@@ -0,0 +1,67 @@
+(function($){
+ var initLayout = function() {
+ var hash = window.location.hash.replace('#', '');
+ var currentTab = $('ul.navigationTabs a')
+ .bind('click', showTab)
+ .filter('a[rel=' + hash + ']');
+ if (currentTab.size() == 0) {
+ currentTab = $('ul.navigationTabs a:first');
+ }
+ showTab.apply(currentTab.get(0));
+ $('#colorpickerHolder').ColorPicker({flat: true});
+ $('#colorpickerHolder2').ColorPicker({
+ flat: true,
+ color: '#00ff00',
+ onSubmit: function(hsb, hex, rgb) {
+ $('#colorSelector2 div').css('backgroundColor', '#' + hex);
+ }
+ });
+ $('#colorpickerHolder2>div').css('position', 'absolute');
+ var widt = false;
+ $('#colorSelector2').bind('click', function() {
+ $('#colorpickerHolder2').stop().animate({height: widt ? 0 : 173}, 500);
+ widt = !widt;
+ });
+ $('#colorpickerField1, #colorpickerField2, #colorpickerField3').ColorPicker({
+ onSubmit: function(hsb, hex, rgb, el) {
+ $(el).val(hex);
+ $(el).ColorPickerHide();
+ },
+ onBeforeShow: function () {
+ $(this).ColorPickerSetColor(this.value);
+ }
+ })
+ .bind('keyup', function(){
+ $(this).ColorPickerSetColor(this.value);
+ });
+ $('#colorSelector').ColorPicker({
+ color: '#0000ff',
+ onShow: function (colpkr) {
+ $(colpkr).fadeIn(500);
+ return false;
+ },
+ onHide: function (colpkr) {
+ $(colpkr).fadeOut(500);
+ return false;
+ },
+ onChange: function (hsb, hex, rgb) {
+ $('#colorSelector div').css('backgroundColor', '#' + hex);
+ }
+ });
+ };
+
+ var showTab = function(e) {
+ var tabIndex = $('ul.navigationTabs a')
+ .removeClass('active')
+ .index(this);
+ $(this)
+ .addClass('active')
+ .blur();
+ $('div.tab')
+ .hide()
+ .eq(tabIndex)
+ .show();
+ };
+
+ EYE.register(initLayout, 'init');
+})(jQuery)
\ No newline at end of file
diff --git a/system/application/assets/plugins/colorpicker/js/startup.js
b/system/application/assets/plugins/colorpicker/js/startup.js
new file mode 100644
index 0000000..7a19d9f
--- /dev/null
+++ b/system/application/assets/plugins/colorpicker/js/startup.js
@@ -0,0 +1,43 @@
+$(document).ready(function() {
+
+ /* Setting initial values */
+ var tag_col = $('#tag_color').val();
+ var background_col = $('#tag_background').val();
+ if (!tag_col) {
+ tag_col = "#" + "000000";
+ }
+ if (!background_col) {
+ background_col = "#" + "000000";
+ }
+
+ $('#tag_color').ColorPicker({
+ color: tag_col,
+ onShow: function (colpkr) {
+ $(colpkr).fadeIn(500);
+ return false;
+ },
+ onHide: function (colpkr) {
+ $(colpkr).fadeOut(500);
+ return false;
+ },
+ onChange: function (hsb, hex, rgb) {
+ $('#preview_tag_color').css('backgroundColor', '#' + hex);
+ $('#tag_color').val(hex);
+ }
+ });
+ $('#tag_background').ColorPicker({
+ color: background_col,
+ onShow: function (colpkr) {
+ $(colpkr).fadeIn(500);
+ return false;
+ },
+ onHide: function (colpkr) {
+ $(colpkr).fadeOut(500);
+ return false;
+ },
+ onChange: function (hsb, hex, rgb) {
+ $('#preview_tag_background').css('backgroundColor', '#' +
hex);
+ $('#tag_background').val(hex);
+ }
+ });
+});
diff --git a/system/application/assets/plugins/colorpicker/js/utils.js
b/system/application/assets/plugins/colorpicker/js/utils.js
new file mode 100644
index 0000000..cc7ce14
--- /dev/null
+++ b/system/application/assets/plugins/colorpicker/js/utils.js
@@ -0,0 +1,252 @@
+/**
+ *
+ * Utilities
+ * Author: Stefan Petre
www.eyecon.ro
+ *
+ */
+(function($) {
+EYE.extend({
+ getPosition : function(e, forceIt)
+ {
+ var x = 0;
+ var y = 0;
+ var es = e.style;
+ var restoreStyles = false;
+ if (forceIt && jQuery.curCSS(e,'display') == 'none') {
+ var oldVisibility = es.visibility;
+ var oldPosition = es.position;
+ restoreStyles = true;
+ es.visibility = 'hidden';
+ es.display = 'block';
+ es.position = 'absolute';
+ }
+ var el = e;
+ if (el.getBoundingClientRect) { // IE
+ var box = el.getBoundingClientRect();
+ x = box.left + Math.max(document.documentElement.scrollLeft, document.body.scrollLeft)
- 2;
+ y = box.top + Math.max(document.documentElement.scrollTop, document.body.scrollTop) -
2;
+ } else {
+ x = el.offsetLeft;
+ y = el.offsetTop;
+ el = el.offsetParent;
+ if (e != el) {
+ while (el) {
+ x += el.offsetLeft;
+ y += el.offsetTop;
+ el = el.offsetParent;
+ }
+ }
+ if (jQuery.browser.safari && jQuery.curCSS(e, 'position') ==
'absolute' ) {
+ x -= document.body.offsetLeft;
+ y -= document.body.offsetTop;
+ }
+ el = e.parentNode;
+ while (el && el.tagName.toUpperCase() != 'BODY' &&
el.tagName.toUpperCase() != 'HTML')
+ {
+ if (jQuery.curCSS(el, 'display') != 'inline') {
+ x -= el.scrollLeft;
+ y -= el.scrollTop;
+ }
+ el = el.parentNode;
+ }
+ }
+ if (restoreStyles == true) {
+ es.display = 'none';
+ es.position = oldPosition;
+ es.visibility = oldVisibility;
+ }
+ return {x:x, y:y};
+ },
+ getSize : function(e)
+ {
+ var w = parseInt(jQuery.curCSS(e,'width'), 10);
+ var h = parseInt(jQuery.curCSS(e,'height'), 10);
+ var wb = 0;
+ var hb = 0;
+ if (jQuery.curCSS(e, 'display') != 'none') {
+ wb = e.offsetWidth;
+ hb = e.offsetHeight;
+ } else {
+ var es = e.style;
+ var oldVisibility = es.visibility;
+ var oldPosition = es.position;
+ es.visibility = 'hidden';
+ es.display = 'block';
+ es.position = 'absolute';
+ wb = e.offsetWidth;
+ hb = e.offsetHeight;
+ es.display = 'none';
+ es.position = oldPosition;
+ es.visibility = oldVisibility;
+ }
+ return {w:w, h:h, wb:wb, hb:hb};
+ },
+ getClient : function(e)
+ {
+ var h, w;
+ if (e) {
+ w = e.clientWidth;
+ h = e.clientHeight;
+ } else {
+ var de = document.documentElement;
+ w = window.innerWidth || self.innerWidth || (de&&de.clientWidth) ||
document.body.clientWidth;
+ h = window.innerHeight || self.innerHeight || (de&&de.clientHeight) ||
document.body.clientHeight;
+ }
+ return {w:w,h:h};
+ },
+ getScroll : function (e)
+ {
+ var t=0, l=0, w=0, h=0, iw=0, ih=0;
+ if (e && e.nodeName.toLowerCase() != 'body') {
+ t = e.scrollTop;
+ l = e.scrollLeft;
+ w = e.scrollWidth;
+ h = e.scrollHeight;
+ } else {
+ if (document.documentElement) {
+ t = document.documentElement.scrollTop;
+ l = document.documentElement.scrollLeft;
+ w = document.documentElement.scrollWidth;
+ h = document.documentElement.scrollHeight;
+ } else if (document.body) {
+ t = document.body.scrollTop;
+ l = document.body.scrollLeft;
+ w = document.body.scrollWidth;
+ h = document.body.scrollHeight;
+ }
+ if (typeof pageYOffset != 'undefined') {
+ t = pageYOffset;
+ l = pageXOffset;
+ }
+ iw =
self.innerWidth||document.documentElement.clientWidth||document.body.clientWidth||0;
+ ih =
self.innerHeight||document.documentElement.clientHeight||document.body.clientHeight||0;
+ }
+ return { t: t, l: l, w: w, h: h, iw: iw, ih: ih };
+ },
+ getMargins : function(e, toInteger)
+ {
+ var t = jQuery.curCSS(e,'marginTop') || '';
+ var r = jQuery.curCSS(e,'marginRight') || '';
+ var b = jQuery.curCSS(e,'marginBottom') || '';
+ var l = jQuery.curCSS(e,'marginLeft') || '';
+ if (toInteger)
+ return {
+ t: parseInt(t, 10)||0,
+ r: parseInt(r, 10)||0,
+ b: parseInt(b, 10)||0,
+ l: parseInt(l, 10)
+ };
+ else
+ return {t: t, r: r, b: b, l: l};
+ },
+ getPadding : function(e, toInteger)
+ {
+ var t = jQuery.curCSS(e,'paddingTop') || '';
+ var r = jQuery.curCSS(e,'paddingRight') || '';
+ var b = jQuery.curCSS(e,'paddingBottom') || '';
+ var l = jQuery.curCSS(e,'paddingLeft') || '';
+ if (toInteger)
+ return {
+ t: parseInt(t, 10)||0,
+ r: parseInt(r, 10)||0,
+ b: parseInt(b, 10)||0,
+ l: parseInt(l, 10)
+ };
+ else
+ return {t: t, r: r, b: b, l: l};
+ },
+ getBorder : function(e, toInteger)
+ {
+ var t = jQuery.curCSS(e,'borderTopWidth') || '';
+ var r = jQuery.curCSS(e,'borderRightWidth') || '';
+ var b = jQuery.curCSS(e,'borderBottomWidth') || '';
+ var l = jQuery.curCSS(e,'borderLeftWidth') || '';
+ if (toInteger)
+ return {
+ t: parseInt(t, 10)||0,
+ r: parseInt(r, 10)||0,
+ b: parseInt(b, 10)||0,
+ l: parseInt(l, 10)||0
+ };
+ else
+ return {t: t, r: r, b: b, l: l};
+ },
+ traverseDOM : function(nodeEl, func)
+ {
+ func(nodeEl);
+ nodeEl = nodeEl.firstChild;
+ while(nodeEl){
+ EYE.traverseDOM(nodeEl, func);
+ nodeEl = nodeEl.nextSibling;
+ }
+ },
+ getInnerWidth : function(el, scroll) {
+ var offsetW = el.offsetWidth;
+ return scroll ? Math.max(el.scrollWidth,offsetW) - offsetW +
el.clientWidth:el.clientWidth;
+ },
+ getInnerHeight : function(el, scroll) {
+ var offsetH = el.offsetHeight;
+ return scroll ? Math.max(el.scrollHeight,offsetH) - offsetH +
el.clientHeight:el.clientHeight;
+ },
+ getExtraWidth : function(el) {
+ if($.boxModel)
+ return (parseInt($.curCSS(el, 'paddingLeft'))||0)
+ + (parseInt($.curCSS(el, 'paddingRight'))||0)
+ + (parseInt($.curCSS(el, 'borderLeftWidth'))||0)
+ + (parseInt($.curCSS(el, 'borderRightWidth'))||0);
+ return 0;
+ },
+ getExtraHeight : function(el) {
+ if($.boxModel)
+ return (parseInt($.curCSS(el, 'paddingTop'))||0)
+ + (parseInt($.curCSS(el, 'paddingBottom'))||0)
+ + (parseInt($.curCSS(el, 'borderTopWidth'))||0)
+ + (parseInt($.curCSS(el, 'borderBottomWidth'))||0);
+ return 0;
+ },
+ isChildOf: function(parentEl, el, container) {
+ if (parentEl == el) {
+ return true;
+ }
+ if (!el || !el.nodeType || el.nodeType != 1) {
+ return false;
+ }
+ if (parentEl.contains && !$.browser.safari) {
+ return parentEl.contains(el);
+ }
+ if ( parentEl.compareDocumentPosition ) {
+ return !!(parentEl.compareDocumentPosition(el) & 16);
+ }
+ var prEl = el.parentNode;
+ while(prEl && prEl != container) {
+ if (prEl == parentEl)
+ return true;
+ prEl = prEl.parentNode;
+ }
+ return false;
+ },
+ centerEl : function(el, axis)
+ {
+ var clientScroll = EYE.getScroll();
+ var size = EYE.getSize(el);
+ if (!axis || axis == 'vertically')
+ $(el).css(
+ {
+ top: clientScroll.t + ((Math.min(clientScroll.h,clientScroll.ih) - size.hb)/2) +
'px'
+ }
+ );
+ if (!axis || axis == 'horizontally')
+ $(el).css(
+ {
+ left: clientScroll.l + ((Math.min(clientScroll.w,clientScroll.iw) - size.wb)/2) +
'px'
+ }
+ );
+ }
+});
+if (!$.easing.easeout) {
+ $.easing.easeout = function(p, n, firstNum, delta, duration) {
+ return -delta * ((n=n/duration-1)*n*n*n - 1) + firstNum;
+ };
+}
+
+})(jQuery);
\ No newline at end of file
diff --git a/system/application/controllers/tag.php
b/system/application/controllers/tag.php
index 7730cb5..50180fb 100644
--- a/system/application/controllers/tag.php
+++ b/system/application/controllers/tag.php
@@ -21,6 +21,19 @@ class Tag extends Controller {
{
$this->template->set('page_title', 'New Tag');
+ /* Colorpicker JS and CSS */
+ $this->template->set('add_css', array(
+ "plugins/colorpicker/css/colorpicker.css",
+ ));
+
+ $this->template->set('add_javascript', array(
+ "plugins/colorpicker/js/colorpicker.js",
+ "plugins/colorpicker/js/eye.js",
+ "plugins/colorpicker/js/utils.js",
+ "plugins/colorpicker/js/layout.js",
+ "plugins/colorpicker/js/startup.js",
+ ));
+
/* Form fields */
$data['tag_title'] = array(
'name' => 'tag_title',
diff --git a/system/application/controllers/welcome.php
b/system/application/controllers/welcome.php
index 5f947ac..f85e5af 100644
--- a/system/application/controllers/welcome.php
+++ b/system/application/controllers/welcome.php
@@ -13,8 +13,8 @@ class Welcome extends Controller {
$this->load->model('Ledger_model');
$this->load->library('accountlist');
$this->template->set('page_title', 'Welcome to Webzash');
- $this->template->set('add_css', array("tufte-graph.css"));
- $this->template->set('add_javascript', array("raphael.js",
"jquery.enumerable.js", "jquery.tufte-graph.js"));
+ $this->template->set('add_css', array("css/tufte-graph.css"));
+ $this->template->set('add_javascript', array("js/raphael.js",
"js/jquery.enumerable.js", "js/jquery.tufte-graph.js"));
/* Draft voucher count */
$draft_q = $this->db->query("SELECT * FROM vouchers WHERE draft = 1");
diff --git a/system/application/views/tag/add.php b/system/application/views/tag/add.php
index 5cb8377..9231708 100644
--- a/system/application/views/tag/add.php
+++ b/system/application/views/tag/add.php
@@ -11,12 +11,16 @@
echo form_label('Tag Color', 'tag_color');
echo "<br />";
echo "#" . form_input($tag_color);
+ echo "   ";
+ echo "<span id=\"preview_tag_color\" style=\"padding:3px 20px 3px
20px;\"></span>";
echo "</p>";
echo "<p>";
echo form_label('Background Color', 'tag_background');
echo "<br />";
echo "#" . form_input($tag_background);
+ echo "   ";
+ echo "<span id=\"preview_tag_background\" style=\"padding:3px
20px 3px 20px;\"></span>";
echo "</p>";
echo "<p>";
diff --git a/system/application/views/template.php
b/system/application/views/template.php
index 7ecb824..b93b659 100644
--- a/system/application/views/template.php
+++ b/system/application/views/template.php
@@ -18,7 +18,7 @@ if (isset($add_css))
{
foreach ($add_css as $id => $row)
{
- echo "<link type=\"text/css\" rel=\"stylesheet\"
href=\"" . asset_url() . "css/" . $row ."\">";
+ echo "<link type=\"text/css\" rel=\"stylesheet\"
href=\"" . asset_url() . $row ."\">";
}
}
?>
@@ -30,13 +30,14 @@ if (isset($add_css))
<script type="text/javascript" src="<?php echo asset_url();
?>js/superfish.js"></script>
<script type="text/javascript" src="<?php echo asset_url();
?>js/supersubs.js"></script>
<script type="text/javascript" src="<?php echo asset_url();
?>js/thickbox-compressed.js"></script>
+
<?php
/* Dynamically adding javascript files from controllers */
if (isset($add_javascript))
{
foreach ($add_javascript as $id => $row)
{
- echo "<script type=\"text/javascript\" src=\"" .
asset_url() . "js/" . $row ."\"></script>";
+ echo "<script type=\"text/javascript\" src=\"" .
asset_url() . $row ."\"></script>";
}
}
?>
commit 9e36753efe7ba9ad97af00b18969089009b25402
Author: Prashant P Shah <pshah.mumbai(a)gmail.com>
Date: Wed Dec 22 14:38:37 2010 +0530
Check new voucher date to be within current financial year
Signed-off-by: Prashant P Shah <pshah.mumbai(a)gmail.com>
diff --git a/system/application/helpers/MY_date_helper.php
b/system/application/helpers/MY_date_helper.php
index cfb9674..11f523a 100644
--- a/system/application/helpers/MY_date_helper.php
+++ b/system/application/helpers/MY_date_helper.php
@@ -111,6 +111,16 @@ if ( ! function_exists('date_today_php'))
function date_today_php()
{
$CI =& get_instance();
+
+ /* Check for date beyond the current financial year range */
+ $todays_date = date('Y-m-d 00:00:00');
+ $fy_start = $CI->config->item('account_fy_start');
+ $fy_end = $CI->config->item('account_fy_end');
+ if ($CI->config->item('account_fy_start') > $todays_date)
+ return date_mysql_to_php($fy_start);
+ if ($CI->config->item('account_fy_end') < $todays_date)
+ return date_mysql_to_php($fy_end);
+
$current_date_format = $CI->config->item('account_date_format');
switch ($current_date_format)
{