From 3ae2670dcd52abe259e534d321d42db19a162d05 Mon Sep 17 00:00:00 2001 From: jeroenvheel Date: Wed, 18 Apr 2012 09:08:40 +0200 Subject: [PATCH] Update to 0.12 Bitbucket --- application/core/Admin_Controller.php | 13 +- application/core/Client_Center_Controller.php | 45 +- application/core/MY_Model.php | 27 +- application/helpers/mcb_currency_helper.php | 4 +- application/helpers/mcb_date_helper.php | 80 + .../helpers/mcb_invoice_amount_helper.php | 4 +- application/helpers/mcb_invoice_helper.php | 50 +- .../helpers/mcb_invoice_item_helper.php | 8 +- application/helpers/mpdf_helper.php | 2 +- application/language/english/mcb_lang.php | 70 +- application/libraries/MY_Form_validation.php | 2 + application/libraries/Merchant/Merchant.php | 147 + .../Merchant/drivers/Merchant_paypal.php | 119 + .../calendar/controllers/calendar.php | 54 + .../calendar/controllers/index.html | 10 + application/modules_core/calendar/credit.txt | 1 + .../modules_core/calendar/models/index.html | 10 + .../calendar/views/header_insert.php | 132 + .../modules_core/calendar/views/index.html | 10 + .../modules_core/calendar/views/index.php | 28 + .../client_center/controllers/admin.php | 10 +- .../controllers/client_center.php | 106 +- .../models/mdl_client_center.php | 45 +- .../client_center/views/account_form.php | 2 +- .../client_center/views/admin_form.php | 14 +- .../client_center/views/admin_index.php | 6 +- .../client_center/views/admin_sidebar.php | 2 +- .../client_center/views/header.php | 11 +- .../client_center/views/invoice_table.php | 19 +- .../client_center/views/invoice_view.php | 6 +- .../views/invoice_view_tab_general.php | 11 +- .../views/invoice_view_tab_taxes.php | 2 +- .../client_center/views/jquery_client_ac.php | 21 + .../views/jquery_hover_links.php | 15 + .../client_center/views/merchant_cancel.php | 21 + .../client_center/views/merchant_return.php | 21 + .../client_center/views/payment_table.php | 2 +- .../client_center/views/quotes.php | 23 + .../client_center/views/settings.php | 24 +- .../client_center/views/sidebar.php | 2 +- .../client_center/views/sidebar_change_pw.php | 2 +- .../clients/controllers/clients.php | 369 +- .../clients/controllers/contacts.php | 30 +- .../clients/models/mdl_client_table.php | 28 + .../clients/models/mdl_clients.php | 196 +- .../clients/views/contact_form.php | 4 +- .../clients/views/contact_table.php | 5 +- .../modules_core/clients/views/form.php | 234 +- .../modules_core/clients/views/index.php | 57 +- .../modules_core/clients/views/sidebar.php | 2 +- .../modules_core/cron/controllers/cron.php | 18 +- .../dashboard/controllers/dashboard.php | 6 + .../controllers/dashboard_settings.php | 12 + .../modules_core/dashboard/views/btn_add.php | 2 +- .../dashboard/views/dashboard.php | 43 +- .../modules_core/dashboard/views/header.php | 27 +- .../dashboard/views/header_menu.php | 4 +- .../modules_core/dashboard/views/settings.php | 25 +- .../modules_core/dashboard/views/sidebar.php | 8 +- .../views/sidebar_control_center.php | 10 + .../controllers/email_templates.php | 82 + .../models/mdl_email_templates.php | 43 + .../email_templates/views/form.php | 43 + .../email_templates/views/index.php | 51 + .../fields/controllers/fields.php | 2 - .../modules_core/fields/views/form.php | 4 +- .../modules_core/fields/views/index.php | 8 +- .../modules_core/fields/views/sidebar.php | 2 +- .../inventory/controllers/inventory.php | 79 +- .../inventory/controllers/inventory_types.php | 2 - .../inventory/models/mdl_inventory.php | 18 +- .../inventory/models/mdl_inventory_stock.php | 2 +- .../inventory/models/mdl_inventory_table.php | 25 + .../inventory/models/mdl_inventory_types.php | 72 +- .../modules_core/inventory/views/form.php | 31 +- .../modules_core/inventory/views/index.php | 32 +- .../inventory/views/inventory_select.php | 12 + .../inventory/views/inventory_types_form.php | 2 +- .../inventory/views/inventory_types_index.php | 14 +- .../inventory/views/jquery_inventory_form.php | 27 + .../modules_core/inventory/views/sidebar.php | 2 +- .../controllers/invoice_search.php | 2 +- .../controllers/search_results.php | 2 + .../invoice_search/views/results.php | 11 +- .../invoice_search/views/search.php | 8 +- .../controllers/invoice_statuses.php | 2 - .../invoice_statuses/views/form.php | 4 +- .../invoice_statuses/views/index.php | 10 +- .../invoice_statuses/views/sidebar.php | 2 +- .../invoices/controllers/invoice_groups.php | 2 - .../invoices/controllers/invoice_settings.php | 13 + .../invoices/controllers/invoices.php | 550 +- .../invoices/controllers/items.php | 174 +- .../invoices/libraries/Lib_output.php | 97 +- .../invoices/models/mdl_invoice_amounts.php | 2 +- .../invoices/models/mdl_invoice_groups.php | 6 +- .../invoices/models/mdl_invoice_history.php | 17 + .../invoices/models/mdl_invoice_table.php | 39 + .../invoices/models/mdl_invoices.php | 1098 ++-- .../invoices/models/mdl_items.php | 44 +- .../invoices/views/choose_client.php | 26 +- .../modules_core/invoices/views/index.php | 62 +- .../invoices/views/invoice_edit.php | 11 +- .../invoices/views/invoice_group_form.php | 12 +- .../invoices/views/invoice_group_index.php | 10 +- .../invoices/views/invoice_group_sidebar.php | 2 +- .../invoices/views/invoice_table.php | 96 +- .../views/invoice_templates/default.php | 40 +- .../invoice_templates/default_item_taxes.php | 204 + .../modules_core/invoices/views/item_form.php | 50 +- .../invoices/views/item_table.php | 10 +- .../invoices/views/jquery_choose_client.php | 14 +- .../invoices/views/jquery_client_ac.php | 20 + .../invoices/views/jquery_invoice_search.php | 19 + .../modules_core/invoices/views/settings.php | 56 +- .../modules_core/invoices/views/sidebar.php | 2 +- .../invoices/views/tab_general.php | 15 +- .../modules_core/invoices/views/tab_taxes.php | 2 +- .../mailer/controllers/invoice_mailer.php | 85 +- .../mailer/controllers/mailer.php | 5 +- .../mailer/helpers/phpmailer_helper.php | 118 +- .../modules_core/mailer/models/mdl_mailer.php | 213 +- .../mailer/views/invoice_mailer.php | 10 +- .../mailer/views/invoice_overdue.php | 10 +- .../mailer/views/payment_mailer.php | 10 +- .../modules_core/mailer/views/settings.php | 45 +- .../mcb_data/models/mdl_mcb_data.php | 14 +- .../mcb_data/models/mdl_mcb_userdata.php | 106 + .../modules_core/mcb_menu/config/mcb_menu.php | 345 +- .../mcb_menu/controllers/mcb_menu.php | 140 +- .../payments/controllers/client_credits.php | 97 + .../payments/controllers/payment_handler.php | 80 + .../payments/controllers/payment_settings.php | 18 +- .../payments/controllers/payments.php | 270 +- .../payments/models/mdl_client_credits.php | 97 + .../payments/models/mdl_payment_table.php | 25 + .../payments/models/mdl_payments.php | 92 +- .../payments/views/client_credit_form.php | 51 + .../payments/views/client_credit_index.php | 27 + .../payments/views/client_credit_table.php | 42 + .../modules_core/payments/views/form.php | 17 +- .../payments/views/form_no_invoices.php | 4 +- .../modules_core/payments/views/index.php | 10 +- .../payments/views/payment_method_form.php | 2 +- .../payments/views/payment_method_index.php | 12 +- .../modules_core/payments/views/settings.php | 45 +- .../modules_core/payments/views/table.php | 16 +- .../reports/controllers/client_statement.php | 70 +- .../reports/controllers/inventory_history.php | 4 +- .../reports/controllers/reports.php | 18 + .../reports/controllers/sales.php | 57 + .../reports/controllers/sales_by_customer.php | 68 + .../reports/models/mdl_client_statement.php | 10 +- .../modules_core/reports/models/mdl_sales.php | 56 + .../reports/models/mdl_sales_by_customer.php | 42 + .../reports/views/client_list_pdf.php | 36 +- .../reports/views/client_statement.php | 17 +- .../reports/views/client_statement_pdf.php | 18 +- .../reports/views/client_statement_view.php | 6 +- .../modules_core/reports/views/css.php | 4 + .../reports/views/inventory_history_pdf.php | 34 +- .../reports/views/inventory_history_view.php | 4 +- .../modules_core/reports/views/sales.php | 90 + .../reports/views/sales_by_customer.php | 92 + .../reports/views/sales_by_customer_pdf.php | 17 + .../reports/views/sales_by_customer_view.php | 28 + .../modules_core/reports/views/sales_pdf.php | 17 + .../modules_core/reports/views/sales_view.php | 23 + .../sessions/controllers/sessions.php | 8 + .../modules_core/sessions/models/mdl_auth.php | 1 + .../modules_core/sessions/views/login.php | 6 +- .../modules_core/sessions/views/recover.php | 6 +- .../sessions/views/recover_email.php | 6 +- .../settings/controllers/other_settings.php | 6 +- .../settings/views/other_settings.php | 20 +- .../modules_core/settings/views/settings.php | 15 +- .../modules_core/settings/views/sidebar.php | 2 +- .../modules_core/setup/models/mdl_setup.php | 1760 +++--- .../modules_core/setup/views/db_config.php | 6 +- .../setup/views/db_show_config.php | 6 +- .../modules_core/setup/views/header.php | 6 +- .../tax_rates/controllers/tax_rates.php | 2 - .../tax_rates/models/mdl_tax_rates.php | 6 +- .../modules_core/tax_rates/views/form.php | 4 +- .../modules_core/tax_rates/views/index.php | 12 +- .../modules_core/tax_rates/views/sidebar.php | 2 +- .../modules_core/templates/views/index.php | 10 +- .../users/controllers/profile.php | 75 + .../modules_core/users/controllers/users.php | 43 +- .../modules_core/users/models/mdl_users.php | 105 +- application/modules_core/users/views/form.php | 136 +- .../users/views/form_tab_details.php | 127 + .../users/views/form_tab_settings.php | 52 + .../modules_core/users/views/index.php | 14 +- .../modules_core/users/views/sidebar.php | 2 +- .../tasks/controllers/tasks.php | 8 +- .../modules_custom/tasks/models/mdl_tasks.php | 2 +- assets/jquery/fullcalendar/GPL-LICENSE.txt | 278 + assets/jquery/fullcalendar/MIT-LICENSE.txt | 20 + assets/jquery/fullcalendar/changelog.txt | 314 + assets/jquery/fullcalendar/fullcalendar.css | 618 ++ assets/jquery/fullcalendar/fullcalendar.js | 5210 +++++++++++++++++ .../jquery/fullcalendar/fullcalendar.min.js | 113 + .../fullcalendar/fullcalendar.print.css | 61 + assets/jquery/fullcalendar/gcal.js | 112 + assets/jquery/jquery-1.6.2.min.js | 18 + assets/jquery/jquery-ui-1.8.16.custom.min.js | 791 +++ .../images/ui-bg_flat_65_ffffff_40x100.png | Bin 0 -> 178 bytes .../images/ui-bg_flat_8_333333_40x100.png | Bin 0 -> 180 bytes .../images/ui-bg_glass_40_111111_1x400.png | Bin 0 -> 161 bytes .../images/ui-bg_glass_55_1c1c1c_1x400.png | Bin 0 -> 127 bytes .../ui-bg_highlight-hard_100_f9f9f9_1x100.png | Bin 0 -> 117 bytes .../ui-bg_highlight-hard_40_aaaaaa_1x100.png | Bin 0 -> 100 bytes .../ui-bg_highlight-soft_50_aaaaaa_1x100.png | Bin 0 -> 102 bytes .../ui-bg_inset-hard_45_cd0a0a_1x100.png | Bin 0 -> 123 bytes .../ui-bg_inset-hard_55_ffeb80_1x100.png | Bin 0 -> 113 bytes .../images/ui-icons_222222_256x240.png | Bin 0 -> 4369 bytes .../images/ui-icons_4ca300_256x240.png | Bin 0 -> 4369 bytes .../images/ui-icons_bbbbbb_256x240.png | Bin 0 -> 5355 bytes .../images/ui-icons_ededed_256x240.png | Bin 0 -> 4369 bytes .../images/ui-icons_ffcf29_256x240.png | Bin 0 -> 4369 bytes .../images/ui-icons_ffffff_256x240.png | Bin 0 -> 4369 bytes .../myclientbase/jquery-ui-1.8.16.custom.css | 568 ++ assets/style/css/general.css | 172 +- assets/style/css/superfish.css | 2 +- assets/style/img/icons/delete.png | Bin 678 -> 774 bytes assets/style/img/icons/edit.png | Bin 608 -> 556 bytes assets/style/img/icons/generate_invoice.png | Bin 757 -> 346 bytes assets/style/img/icons/generate_receipt.png | Bin 943 -> 346 bytes assets/style/img/icons/invoice.png | Bin 484 -> 344 bytes assets/style/img/icons/quote.png | Bin 644 -> 408 bytes index.php | 8 +- system/core/Benchmark.php | 5 + system/core/CodeIgniter.php | 74 +- system/core/Common.php | 144 +- system/core/Config.php | 114 +- system/core/Controller.php | 7 +- system/core/Exceptions.php | 21 +- system/core/Hooks.php | 25 +- system/core/Input.php | 93 +- system/core/Lang.php | 30 +- system/core/Loader.php | 370 +- system/core/Model.php | 1 + system/core/Output.php | 79 +- system/core/Router.php | 73 +- system/core/Security.php | 866 +++ system/core/URI.php | 96 +- system/core/Utf8.php | 2 +- system/database/DB.php | 23 +- system/database/DB_active_rec.php | 310 +- system/database/DB_cache.php | 2 +- system/database/DB_driver.php | 12 +- system/database/DB_forge.php | 4 +- system/database/DB_result.php | 137 +- system/database/DB_utility.php | 2 +- .../database/drivers/cubrid/cubrid_driver.php | 792 +++ .../database/drivers/cubrid/cubrid_forge.php | 288 + .../database/drivers/cubrid/cubrid_result.php | 202 + .../drivers/cubrid/cubrid_utility.php | 108 + system/database/drivers/cubrid/index.html | 10 + .../database/drivers/mssql/mssql_driver.php | 9 +- .../database/drivers/mysql/mysql_driver.php | 21 +- system/database/drivers/mysql/mysql_forge.php | 8 +- .../database/drivers/mysql/mysql_result.php | 17 +- .../database/drivers/mysql/mysql_utility.php | 2 +- .../database/drivers/mysqli/mysqli_driver.php | 40 +- .../database/drivers/mysqli/mysqli_forge.php | 8 +- .../database/drivers/mysqli/mysqli_result.php | 19 +- system/database/drivers/oci8/oci8_driver.php | 161 +- system/database/drivers/oci8/oci8_result.php | 98 +- system/database/drivers/odbc/odbc_driver.php | 5 +- system/database/drivers/pdo/index.html | 10 + system/database/drivers/pdo/pdo_driver.php | 803 +++ system/database/drivers/pdo/pdo_forge.php | 266 + system/database/drivers/pdo/pdo_result.php | 171 + system/database/drivers/pdo/pdo_utility.php | 103 + .../drivers/postgre/postgre_driver.php | 19 + .../database/drivers/sqlite/sqlite_driver.php | 1 + system/database/drivers/sqlsrv/index.html | 10 + .../database/drivers/sqlsrv/sqlsrv_driver.php | 599 ++ .../database/drivers/sqlsrv/sqlsrv_forge.php | 248 + .../database/drivers/sqlsrv/sqlsrv_result.php | 169 + .../drivers/sqlsrv/sqlsrv_utility.php | 88 + system/fonts/texb.ttf | Bin 152992 -> 143830 bytes system/helpers/date_helper.php | 2 +- system/helpers/download_helper.php | 9 +- system/helpers/file_helper.php | 11 +- system/helpers/form_helper.php | 42 +- system/helpers/html_helper.php | 20 +- system/helpers/inflector_helper.php | 111 +- system/helpers/security_helper.php | 34 +- system/helpers/smiley_helper.php | 18 +- system/helpers/string_helper.php | 17 + system/helpers/text_helper.php | 10 +- system/helpers/typography_helper.php | 5 +- system/helpers/url_helper.php | 11 +- .../language/english/form_validation_lang.php | 4 + system/language/english/ftp_lang.php | 14 +- system/language/english/migration_lang.php | 13 + system/language/english/profiler_lang.php | 3 + system/libraries/Cache/Cache.php | 6 +- system/libraries/Cache/drivers/Cache_apc.php | 6 +- .../libraries/Cache/drivers/Cache_dummy.php | 26 +- system/libraries/Cache/drivers/Cache_file.php | 2 +- .../Cache/drivers/Cache_memcached.php | 13 +- system/libraries/Calendar.php | 2 +- system/libraries/Cart.php | 12 +- system/libraries/Driver.php | 28 +- system/libraries/Email.php | 200 +- system/libraries/Encrypt.php | 2 +- system/libraries/Form_validation.php | 130 +- system/libraries/Javascript.php | 2 +- system/libraries/Log.php | 2 +- system/libraries/Migration.php | 338 ++ system/libraries/Pagination.php | 87 +- system/libraries/Profiler.php | 78 +- system/libraries/Session.php | 11 +- system/libraries/Upload.php | 90 +- system/libraries/User_agent.php | 12 +- system/libraries/Xmlrpc.php | 20 +- 320 files changed, 22440 insertions(+), 4714 deletions(-) create mode 100644 application/libraries/Merchant/Merchant.php create mode 100644 application/libraries/Merchant/drivers/Merchant_paypal.php create mode 100644 application/modules_core/calendar/controllers/calendar.php create mode 100644 application/modules_core/calendar/controllers/index.html create mode 100644 application/modules_core/calendar/credit.txt create mode 100644 application/modules_core/calendar/models/index.html create mode 100644 application/modules_core/calendar/views/header_insert.php create mode 100644 application/modules_core/calendar/views/index.html create mode 100644 application/modules_core/calendar/views/index.php create mode 100644 application/modules_core/client_center/views/jquery_client_ac.php create mode 100644 application/modules_core/client_center/views/jquery_hover_links.php create mode 100644 application/modules_core/client_center/views/merchant_cancel.php create mode 100644 application/modules_core/client_center/views/merchant_return.php create mode 100644 application/modules_core/client_center/views/quotes.php create mode 100644 application/modules_core/clients/models/mdl_client_table.php create mode 100644 application/modules_core/dashboard/views/sidebar_control_center.php create mode 100644 application/modules_core/email_templates/controllers/email_templates.php create mode 100644 application/modules_core/email_templates/models/mdl_email_templates.php create mode 100644 application/modules_core/email_templates/views/form.php create mode 100644 application/modules_core/email_templates/views/index.php create mode 100644 application/modules_core/inventory/models/mdl_inventory_table.php create mode 100644 application/modules_core/inventory/views/jquery_inventory_form.php create mode 100644 application/modules_core/invoices/models/mdl_invoice_table.php create mode 100644 application/modules_core/invoices/views/invoice_templates/default_item_taxes.php create mode 100644 application/modules_core/invoices/views/jquery_client_ac.php create mode 100644 application/modules_core/invoices/views/jquery_invoice_search.php create mode 100644 application/modules_core/mcb_data/models/mdl_mcb_userdata.php create mode 100644 application/modules_core/payments/controllers/client_credits.php create mode 100644 application/modules_core/payments/controllers/payment_handler.php create mode 100644 application/modules_core/payments/models/mdl_client_credits.php create mode 100644 application/modules_core/payments/models/mdl_payment_table.php create mode 100644 application/modules_core/payments/views/client_credit_form.php create mode 100644 application/modules_core/payments/views/client_credit_index.php create mode 100644 application/modules_core/payments/views/client_credit_table.php create mode 100644 application/modules_core/reports/controllers/reports.php create mode 100644 application/modules_core/reports/controllers/sales.php create mode 100644 application/modules_core/reports/controllers/sales_by_customer.php create mode 100644 application/modules_core/reports/models/mdl_sales.php create mode 100644 application/modules_core/reports/models/mdl_sales_by_customer.php create mode 100644 application/modules_core/reports/views/sales.php create mode 100644 application/modules_core/reports/views/sales_by_customer.php create mode 100644 application/modules_core/reports/views/sales_by_customer_pdf.php create mode 100644 application/modules_core/reports/views/sales_by_customer_view.php create mode 100644 application/modules_core/reports/views/sales_pdf.php create mode 100644 application/modules_core/reports/views/sales_view.php create mode 100644 application/modules_core/users/controllers/profile.php create mode 100644 application/modules_core/users/views/form_tab_details.php create mode 100644 application/modules_core/users/views/form_tab_settings.php create mode 100644 assets/jquery/fullcalendar/GPL-LICENSE.txt create mode 100644 assets/jquery/fullcalendar/MIT-LICENSE.txt create mode 100644 assets/jquery/fullcalendar/changelog.txt create mode 100644 assets/jquery/fullcalendar/fullcalendar.css create mode 100644 assets/jquery/fullcalendar/fullcalendar.js create mode 100644 assets/jquery/fullcalendar/fullcalendar.min.js create mode 100644 assets/jquery/fullcalendar/fullcalendar.print.css create mode 100644 assets/jquery/fullcalendar/gcal.js create mode 100644 assets/jquery/jquery-1.6.2.min.js create mode 100644 assets/jquery/jquery-ui-1.8.16.custom.min.js create mode 100644 assets/jquery/ui-themes/myclientbase/images/ui-bg_flat_65_ffffff_40x100.png create mode 100644 assets/jquery/ui-themes/myclientbase/images/ui-bg_flat_8_333333_40x100.png create mode 100644 assets/jquery/ui-themes/myclientbase/images/ui-bg_glass_40_111111_1x400.png create mode 100644 assets/jquery/ui-themes/myclientbase/images/ui-bg_glass_55_1c1c1c_1x400.png create mode 100644 assets/jquery/ui-themes/myclientbase/images/ui-bg_highlight-hard_100_f9f9f9_1x100.png create mode 100644 assets/jquery/ui-themes/myclientbase/images/ui-bg_highlight-hard_40_aaaaaa_1x100.png create mode 100644 assets/jquery/ui-themes/myclientbase/images/ui-bg_highlight-soft_50_aaaaaa_1x100.png create mode 100644 assets/jquery/ui-themes/myclientbase/images/ui-bg_inset-hard_45_cd0a0a_1x100.png create mode 100644 assets/jquery/ui-themes/myclientbase/images/ui-bg_inset-hard_55_ffeb80_1x100.png create mode 100644 assets/jquery/ui-themes/myclientbase/images/ui-icons_222222_256x240.png create mode 100644 assets/jquery/ui-themes/myclientbase/images/ui-icons_4ca300_256x240.png create mode 100644 assets/jquery/ui-themes/myclientbase/images/ui-icons_bbbbbb_256x240.png create mode 100644 assets/jquery/ui-themes/myclientbase/images/ui-icons_ededed_256x240.png create mode 100644 assets/jquery/ui-themes/myclientbase/images/ui-icons_ffcf29_256x240.png create mode 100644 assets/jquery/ui-themes/myclientbase/images/ui-icons_ffffff_256x240.png create mode 100644 assets/jquery/ui-themes/myclientbase/jquery-ui-1.8.16.custom.css create mode 100644 system/core/Security.php create mode 100644 system/database/drivers/cubrid/cubrid_driver.php create mode 100644 system/database/drivers/cubrid/cubrid_forge.php create mode 100644 system/database/drivers/cubrid/cubrid_result.php create mode 100644 system/database/drivers/cubrid/cubrid_utility.php create mode 100644 system/database/drivers/cubrid/index.html create mode 100644 system/database/drivers/pdo/index.html create mode 100644 system/database/drivers/pdo/pdo_driver.php create mode 100644 system/database/drivers/pdo/pdo_forge.php create mode 100644 system/database/drivers/pdo/pdo_result.php create mode 100644 system/database/drivers/pdo/pdo_utility.php create mode 100644 system/database/drivers/sqlsrv/index.html create mode 100644 system/database/drivers/sqlsrv/sqlsrv_driver.php create mode 100644 system/database/drivers/sqlsrv/sqlsrv_forge.php create mode 100644 system/database/drivers/sqlsrv/sqlsrv_result.php create mode 100644 system/database/drivers/sqlsrv/sqlsrv_utility.php create mode 100644 system/language/english/migration_lang.php create mode 100644 system/libraries/Migration.php diff --git a/application/core/Admin_Controller.php b/application/core/Admin_Controller.php index d86c627..86d1cc3 100644 --- a/application/core/Admin_Controller.php +++ b/application/core/Admin_Controller.php @@ -12,7 +12,9 @@ function __construct() { $this->load->helper('url'); - if (!$this->session->userdata('user_id')) { + $user_id = $this->session->userdata('user_id'); + + if (!$user_id) { redirect('sessions/login'); @@ -28,14 +30,19 @@ function __construct() { $this->load->database(); - $this->load->helper(array('uri', 'mcb_currency', 'mcb_invoice', 'mcb_date', 'mcb_icon', 'mcb_custom', 'mcb_app')); + $this->load->helper(array('uri', 'mcb_currency', 'mcb_invoice', + 'mcb_date', 'mcb_icon', 'mcb_custom', 'mcb_app', + 'mcb_invoice_amount', 'mcb_invoice_item', + 'mcb_invoice_payment', 'mcb_numbers')); - $this->load->model(array('mcb_modules/mdl_mcb_modules','mcb_data/mdl_mcb_data')); + $this->load->model(array('mcb_modules/mdl_mcb_modules','mcb_data/mdl_mcb_data','mcb_data/mdl_mcb_userdata')); $this->mdl_mcb_modules->set_module_data(); $this->mdl_mcb_data->set_session_data(); + $this->mdl_mcb_userdata->set_session_data($user_id); + $this->mdl_mcb_modules->load_custom_languages(); $this->load->language('mcb', $this->mdl_mcb_data->setting('default_language')); diff --git a/application/core/Client_Center_Controller.php b/application/core/Client_Center_Controller.php index 5ae8b23..83fa1c6 100644 --- a/application/core/Client_Center_Controller.php +++ b/application/core/Client_Center_Controller.php @@ -2,45 +2,48 @@ class Client_Center_Controller extends MX_Controller { - function __construct($var_required = NULL) { + function __construct($var_required = NULL) { - parent::__construct(); + parent::__construct(); - $this->load->database(); + $this->load->database(); - $this->load->helper('url'); + $this->load->helper('url'); - $this->load->model('mcb_modules/mdl_mcb_modules'); + $this->load->model('mcb_modules/mdl_mcb_modules'); - $this->load->library('session'); - - if ($this->session->userdata('is_admin')) { + $this->load->library('session'); - redirect('client_center/admin'); + if ($this->session->userdata('is_admin')) { - } + redirect('client_center/admin'); - if ($var_required and (!$this->session->userdata($var_required))) { + } - redirect('client_center/sessions/login'); + if ($var_required and (!$this->session->userdata($var_required))) { - } + redirect('sessions/login'); - $this->load->model('mcb_data/mdl_mcb_data'); + } - $this->mdl_mcb_data->set_session_data(); + $this->load->model('mcb_data/mdl_mcb_data'); - $this->load->helper(array('uri', 'mcb_currency', 'mcb_invoice', 'mcb_date', 'mcb_icon', 'mcb_custom', 'mcb_app')); + $this->mdl_mcb_data->set_session_data(); + + $this->load->helper(array('uri', 'mcb_currency', 'mcb_invoice', + 'mcb_date', 'mcb_icon', 'mcb_custom', 'mcb_app', + 'mcb_invoice_amount', 'mcb_invoice_item', + 'mcb_invoice_payment', 'mcb_numbers')); - $this->load->language('mcb', $this->mdl_mcb_data->setting('default_language')); + $this->load->language('mcb', $this->mdl_mcb_data->setting('default_language')); - $this->load->library('form_validation'); + $this->load->library('form_validation'); - $this->load->model('fields/mdl_fields'); + $this->load->model('fields/mdl_fields'); - $this->form_validation->set_error_delimiters('
', '
'); + $this->form_validation->set_error_delimiters('
', '
'); - } + } } diff --git a/application/core/MY_Model.php b/application/core/MY_Model.php index 007e351..d84bcb3 100644 --- a/application/core/MY_Model.php +++ b/application/core/MY_Model.php @@ -1,11 +1,14 @@ $value) { - $this->db->like($key, $value); + $this->db->where('(' . $key . " LIKE '%" . $value . "%' or " . $key . " LIKE '" . $value . "%')"); } diff --git a/application/helpers/mcb_currency_helper.php b/application/helpers/mcb_currency_helper.php index 7d63e20..176cdf3 100644 --- a/application/helpers/mcb_currency_helper.php +++ b/application/helpers/mcb_currency_helper.php @@ -1,10 +1,10 @@ mdl_mcb_data->setting('currency_symbol_placement') == 'before') { diff --git a/application/helpers/mcb_date_helper.php b/application/helpers/mcb_date_helper.php index 7c233ae..cc6e543 100644 --- a/application/helpers/mcb_date_helper.php +++ b/application/helpers/mcb_date_helper.php @@ -57,4 +57,84 @@ function standardize_date($date) { } +function date_formats($format = NULL, $element = NULL) { + + $date_formats = array( + 'm/d/Y' => array( + 'key' => 'm/d/Y', + 'picker' => 'mm/dd/yy', + 'mask' => '99/99/9999', + 'dropdown' => 'mm/dd/yyyy'), + 'm/d/y' => array( + 'key' => 'm/d/y', + 'picker' => 'mm/dd/y', + 'mask' => '99/99/99', + 'dropdown' => 'mm/dd/yy'), + 'Y/m/d' => array( + 'key' => 'Y/m/d', + 'picker' => 'yy/mm/dd', + 'mask' => '9999/99/99', + 'dropdown' => 'yyyy/mm/dd'), + 'd/m/Y' => array( + 'key' => 'd/m/Y', + 'picker' => 'dd/mm/yy', + 'mask' => '99/99/9999', + 'dropdown' => 'dd/mm/yyyy'), + 'd/m/y' => array( + 'key' => 'd/m/y', + 'picker' => 'dd/mm/y', + 'mask' => '99/99/99', + 'dropdown' => 'dd/mm/yy'), + 'm-d-Y' => array( + 'key' => 'm-d-Y', + 'picker' => 'mm-dd-yy', + 'mask' => '99-99-9999', + 'dropdown' => 'mm-dd-yyyy'), + 'm-d-y' => array( + 'key' => 'm-d-y', + 'picker' => 'mm-dd-y', + 'mask' => '99-99-99', + 'dropdown' => 'mm-dd-yy'), + 'Y-m-d' => array( + 'key' => 'Y-m-d', + 'picker' => 'yy-mm-dd', + 'mask' => '9999-99-99', + 'dropdown' => 'yyyy-mm-dd'), + 'y-m-d' => array( + 'key' => 'y-m-d', + 'picker' => 'y-mm-dd', + 'mask' => '99-99-99', + 'dropdown' => 'yy-mm-dd'), + 'd.m.Y' => array( + 'key' => 'd.m.Y', + 'picker' => 'dd.mm.yy', + 'mask' => '99.99.9999', + 'dropdown' => 'dd.mm.yyyy'), + 'd.m.y' => array( + 'key' => 'd.m.y', + 'picker' => 'dd.mm.y', + 'mask' => '99.99.99', + 'dropdown' => 'dd.mm.yy') + ); + + if ($format and $element) { + + return $date_formats[$format][$element]; + + } + + elseif ($format) { + + return $date_formats[$format]; + + } + + else { + + return $date_formats; + + } + +} + ?> \ No newline at end of file diff --git a/application/helpers/mcb_invoice_amount_helper.php b/application/helpers/mcb_invoice_amount_helper.php index 1fe6269..ad7daaa 100644 --- a/application/helpers/mcb_invoice_amount_helper.php +++ b/application/helpers/mcb_invoice_amount_helper.php @@ -60,8 +60,10 @@ function invoice_tax_rate_amount($invoice_tax_rate) { function invoice_tax_rate_name($invoice_tax_rate) { + $CI =& get_instance(); + /* Invoice tax rate */ - return $invoice_tax_rate->tax_rate_name . ' @ ' . $invoice_tax_rate->tax_rate_percent . '%'; + return $invoice_tax_rate->tax_rate_name . ' @ ' . format_number($invoice_tax_rate->tax_rate_percent, TRUE, $CI->mdl_mcb_data->setting('decimal_taxes_num')) . '%'; } diff --git a/application/helpers/mcb_invoice_helper.php b/application/helpers/mcb_invoice_helper.php index 0bba608..9d7de04 100644 --- a/application/helpers/mcb_invoice_helper.php +++ b/application/helpers/mcb_invoice_helper.php @@ -1,9 +1,5 @@ load->helper(array('mcb_invoice_amount', 'mcb_invoice_item', 'mcb_invoice_payment', 'mcb_numbers')); - /** * BEGIN COMPANY (FROM) SPECIFIC HELPERS */ @@ -57,6 +53,12 @@ function invoice_from_email($invoice) { } +function invoice_from_fax_number($invoice) { + + return $invoice->from_fax_number; + +} + function invoice_from_name($invoice) { /* First + Last name invoice is from */ @@ -99,6 +101,34 @@ function invoice_from_zip_city($invoice) { } +function invoice_payment_link($invoice) { + + global $CI; + + if ($CI->mdl_mcb_data->setting('merchant_enabled')) { + + $link = $CI->lib_output->payment_link($invoice); + + /** Unless I'm just stupid (highly likely), the PDF seems to want the + * entire GET string urlencoded... + */ + if ($CI->uri->segment(2) == 'generate_pdf') { + + $replace = substr($link, strpos($link, '?') + 1); + $replace = substr($replace, 0, strpos($replace, '">') - 2); + + $link = str_replace($replace, urlencode($replace), $link); + + } + + return $link; + + } + + return ''; + +} + function invoice_tax_id($invoice) { global $CI; @@ -165,7 +195,13 @@ function invoice_to_country($invoice) { function invoice_to_email_address($invoice) { - return $invoice->client_email_address; + return $invoice->client_email_address; + +} + +function invoice_to_fax_number($invoice) { + + return $invoice->client_fax_number; } @@ -279,14 +315,14 @@ function invoice_logo($output_type = 'pdf') { if ($output_type == 'pdf') { - /** Use a system path to include the image in the PDF **/ + /** Use a system path to include the image in the PDF **/ return ''; } elseif ($output_type == 'html') { - /** Use a URL to include the image in the HTML **/ + /** Use a URL to include the image in the HTML **/ return ''; } diff --git a/application/helpers/mcb_invoice_item_helper.php b/application/helpers/mcb_invoice_item_helper.php index f006002..843bfe8 100644 --- a/application/helpers/mcb_invoice_item_helper.php +++ b/application/helpers/mcb_invoice_item_helper.php @@ -49,7 +49,9 @@ function invoice_item_tax($item) { function invoice_item_tax_rate($item) { - return $item->tax_rate_percent . '%'; + $CI =& get_instance(); + + return format_number($item->tax_rate_percent, TRUE, $CI->mdl_mcb_data->setting('decimal_taxes_num')) . '%'; } @@ -62,8 +64,10 @@ function invoice_item_tax_sum($sum) { function invoice_item_tax_sum_name($sum) { + $CI =& get_instance(); + /* For display purposes */ - return $sum->tax_rate_name . ' @ ' . $sum->tax_rate_percent . '%'; + return $sum->tax_rate_name . ' @ ' . format_number($sum->tax_rate_percent, TRUE, $CI->mdl_mcb_data->setting('decimal_taxes_num')) . '%'; } function invoice_item_total($item) { diff --git a/application/helpers/mpdf_helper.php b/application/helpers/mpdf_helper.php index 85992a0..871d082 100644 --- a/application/helpers/mpdf_helper.php +++ b/application/helpers/mpdf_helper.php @@ -14,7 +14,7 @@ function pdf_create($html, $filename, $stream=TRUE) { if ($stream) { - $mpdf->Output($filename, 'I'); + $mpdf->Output($filename . '.pdf', 'I'); } diff --git a/application/language/english/mcb_lang.php b/application/language/english/mcb_lang.php index a4e621d..8c357c3 100644 --- a/application/language/english/mcb_lang.php +++ b/application/language/english/mcb_lang.php @@ -392,8 +392,9 @@ /* NEW FOR 0.9.4.1 */ $lang['item_tax_rate'] = 'Item Tax Rate'; $lang['item_tax_option'] = 'Item Tax Option'; -$lang['item_tax_option_0'] = 'Add to Total'; -$lang['item_tax_option_1'] = 'Include in Total'; +// These two items are changed below in 0.9.6 +//$lang['item_tax_option_0'] = 'Add to Total'; +//$lang['item_tax_option_1'] = 'Include in Total'; /* NEW FOR 0.9.4.2 */ $lang['default_quote_group'] = 'Default Quote Group'; @@ -456,4 +457,69 @@ $lang['footer'] = 'Footer'; $lang['inventory_type_in_use'] = 'The Inventory Type specified is already in use.'; +/* NEW FOR 0.9.6 (0.10)*/ +//$lang['item_tax_option_0'] = 'Add to Total'; +//$lang['item_tax_option_1'] = 'Include in Total'; +$lang['account_deposits'] = 'Account Deposits'; +$lang['apply_credit'] = 'Apply Credit'; +$lang['calendar_view'] = 'Calendar View'; +$lang['control_center'] = 'Control Center'; +$lang['copy'] = 'Copy'; +$lang['credit_amount'] = 'Credit Amount'; +$lang['dashboard_show_quotes'] = 'Show Quotes'; +$lang['email_body_template'] = 'Default Body Template'; +$lang['email_footer_template'] = 'Default Footer Template'; +$lang['enter_deposit'] = 'Enter Deposit'; +$lang['initial_stock_quantity'] = 'Initial Stock Quantity'; +$lang['invoice_count'] = 'Invoice Count'; +$lang['item_tax_option_0'] = 'Add to Amount'; +$lang['item_tax_option_1'] = 'Include in Amount'; +$lang['list_view'] = 'List View'; +$lang['my_profile'] = 'My Profile'; +$lang['sales'] = 'Sales'; +$lang['sales_with_tax'] = 'Sales With Tax'; +$lang['sales_by_customer'] = 'Sales by Customer'; + +/* Calendar */ +$lang['calendarToday'] = 'Today'; +$lang['calendarDay'] = 'Day'; +$lang['calendarWeek'] = 'Week'; +$lang['calendarMonth'] = 'Month'; +$lang['months'] = array("January","February","March","April","May","June","July","August","September","October","November","December"); +$lang['monthsShort'] = array("Jan","Feb","Mar","Apr","May","Jun","Jul","Aug","Sep","Oct","Nov","Dec"); +$lang['days'] = array("Sunday","Monday","Tuesday","Wednesday","Thursday","Friday","Saturday"); +$lang['daysShort'] = array("Sun","Mon","Tue","Wed","Thu","Fri","Sat"); + +/* NEW FOR 0.11 */ +$lang['active'] = 'Active'; +$lang['amount_greater_than_zero'] = 'The Amount must be greater than zero.'; +$lang['default_invoice_email_template'] = 'Default Invoice Email Template'; +$lang['default_item_tax_option'] = 'Default Item Tax Option'; +$lang['default_overdue_invoice_email_template'] = 'Default Overdue Invoice Email Template'; +$lang['default_payment_method'] = 'Default Payment Method'; +$lang['email_body'] = 'Email Body'; +$lang['email_footer'] = 'Email Footer'; +$lang['email_template_form'] = 'Email Template Form'; +$lang['email_template_title'] = 'Email Template Title'; +$lang['email_templates'] = 'Email Templates'; +$lang['merchant_account_id'] = 'Merchant Account ID'; +$lang['merchant_currency_code'] = 'Merchant Currency Code'; +$lang['merchant_driver'] = 'Merchant Driver'; +$lang['merchant_enabled'] = 'Merchant Enabled'; +$lang['merchant_online_payment'] = 'Online Payment'; +$lang['merchant_pay_online'] = 'Pay Online'; +$lang['merchant_payment_cancelled'] = 'Your payment has been cancelled.'; +$lang['merchant_payment_finished'] = 'Thank you for your payment.'; +$lang['merchant_test_mode'] = 'Merchant Test Mode'; +$lang['no'] = 'No'; +$lang['off'] = 'Off'; +$lang['on'] = 'On'; +$lang['yes'] = 'Yes'; + +/* NEW FOR 0.12 */ +$lang['clear'] = 'Clear'; +$lang['default_apply_invoice_tax'] = 'Default Apply Invoice Tax to Items'; +$lang['group_by'] = 'Group By'; +$lang['payment_entered'] = 'A payment of %s was applied'; + ?> \ No newline at end of file diff --git a/application/libraries/MY_Form_validation.php b/application/libraries/MY_Form_validation.php index d1fa463..046d633 100644 --- a/application/libraries/MY_Form_validation.php +++ b/application/libraries/MY_Form_validation.php @@ -2,6 +2,8 @@ class MY_Form_validation extends CI_Form_validation { + public $_field_data = array(); + function run($module = '', $group = '') { (is_object($module)) AND $this->CI =& $module; return parent::run($group); diff --git a/application/libraries/Merchant/Merchant.php b/application/libraries/Merchant/Merchant.php new file mode 100644 index 0000000..9ddd031 --- /dev/null +++ b/application/libraries/Merchant/Merchant.php @@ -0,0 +1,147 @@ +valid_drivers = array('merchant_paypal'); + + /** Load a copy of the CI object */ + $this->CI =& get_instance(); + + /** Load the language helper */ + $this->CI->load->helper('language'); + + } + + public function curl_get($url, $post_data = NULL) { + + /** Standard cURL function to send & receive responsee */ + + $ch = curl_init($url); + curl_setopt($ch, CURLOPT_HEADER, FALSE); + curl_setopt($ch, CURLOPT_RETURNTRANSFER, TRUE); + + if ($post_data) { + + if (is_array($post_data)) { + + $post_data = http_build_query($post_data); + + } + + curl_setopt($ch, CURLOPT_POST, TRUE); + curl_setopt($ch, CURLOPT_POSTFIELDS, $post_data); + + } + + $response = curl_exec($ch); + + curl_close($ch); + + return $response; + + } + + /** Generates and returns a form for payment, which posts to Merchant */ + public function payment_form($params, $form_name = 'merchant_form') { + + $post_url = $this->{$this->driver}->post_url(); + + $form_data = $this->{$this->driver}->form_data($params); + + $form = '
'; + + foreach ($form_data as $key => $value) { + + $form .= ''; + + } + + $form .= ''; + + $form .= '
'; + + return $form; + + } + + /** Generates and returns a link for payment, which directs to Merchant */ + public function payment_link($params) { + + $url = $this->{$this->driver}->post_url(); + + $data = $this->{$this->driver}->link_data($params); + + $return = '' . lang('merchant_pay_online') . ''; + + return $return; + + } + + /** The driver handles the merchant response via this method */ + public function notify() { + + return $this->{$this->driver}->driver_notify(); + + } + + /** @TODO This should be moved somewhere outside of the merchant library */ + public function save_response($response) { + + $this->CI->db->insert('mcb_merchant_responses', $response); + + } + +} + +?> \ No newline at end of file diff --git a/application/libraries/Merchant/drivers/Merchant_paypal.php b/application/libraries/Merchant/drivers/Merchant_paypal.php new file mode 100644 index 0000000..2cf3dbf --- /dev/null +++ b/application/libraries/Merchant/drivers/Merchant_paypal.php @@ -0,0 +1,119 @@ +test_mode == TRUE) ? self::PROCESS_URL_TEST : self::PROCESS_URL; + + } + + public function form_data($params) { + + $data = array( + 'rm' => '2', + 'cmd' => '_xclick', + 'business' => $params['merchant_account_id'], + 'return' => $params['return_url'], + 'cancel_return' => $params['cancel_url'], + 'notify_url' => $params['notify_url'], + 'item_name' => $params['reference'], + 'amount' => $params['amount'], + 'currency_code' => $params['currency_code'], + 'no_shipping' => 1, + 'custom' => $params['custom'] + ); + + return $data; + + } + + public function link_data($params) { + + $data = array( + 'rm' => '2', + 'cmd' => '_xclick', + 'business' => urlencode($params['merchant_account_id']), + 'return' => urlencode($params['return_url']), + 'cancel_return' => urlencode($params['cancel_url']), + 'notify_url' => urlencode($params['notify_url']), + 'item_name' => urlencode($params['reference']), + 'amount' => urlencode($params['amount']), + 'currency_code' => urlencode($params['currency_code']), + 'no_shipping' => 1, + 'custom' => urlencode($params['custom']) + ); + + return $data; + + } + + public function driver_notify() { + + $ipn_response = $_POST; + + $post_validation = $ipn_response; + $post_validation['cmd'] = '_notify-validate'; + + $response = $this->curl_get($this->post_url(), $post_validation); + + $db_array = array( + 'merchant_response_payment_id' => 0, + 'merchant_response_client_id' => 0, + 'merchant_response_invoice_id' => $ipn_response['custom'], + 'merchant_response_amount' => $ipn_response['mc_gross'], + 'merchant_response_method' => 'PayPal', + 'merchant_response_status' => $response, + 'merchant_response_payment_status' => $ipn_response['payment_status'], + 'merchant_response_post' => serialize($ipn_response) + ); + + $this->save_response($db_array); + + log_message('DEBUG', $response); + + if ($response == 'VERIFIED' and $ipn_response['payment_status'] == 'Completed') { + + return TRUE; + + } + + return FALSE; + + } + +} + +?> \ No newline at end of file diff --git a/application/modules_core/calendar/controllers/calendar.php b/application/modules_core/calendar/controllers/calendar.php new file mode 100644 index 0000000..3604cdf --- /dev/null +++ b/application/modules_core/calendar/controllers/calendar.php @@ -0,0 +1,54 @@ +input->post('btn_list_view')) { + + redirect('invoices'); + + } + + elseif ($this->input->post('btn_add_invoice')) { + + redirect('invoices/create'); + + } + + $this->load->model('invoices/mdl_invoices'); + + } + + function index() { + + $this->load->view('index'); + + } + + public function jquery_get_invoices($status = 'open') { + + $function = "get_" . $status; + + $invoices = $this->mdl_invoices->$function(); + + $inv_array = array(); + + foreach ($invoices as $invoice) { + + $inv_array[] = array( + 'id' => $invoice->invoice_id, + 'title' => $invoice->client_name . ' (' . display_currency($invoice->invoice_total) . ')', + 'start' => date('Y-m-d', $invoice->invoice_due_date), + 'url' => './invoices/edit/invoice_id/'. $invoice->invoice_id, + ); + + } + + echo json_encode($inv_array); + + } + +} \ No newline at end of file diff --git a/application/modules_core/calendar/controllers/index.html b/application/modules_core/calendar/controllers/index.html new file mode 100644 index 0000000..c942a79 --- /dev/null +++ b/application/modules_core/calendar/controllers/index.html @@ -0,0 +1,10 @@ + + + 403 Forbidden + + + +

Directory access is forbidden.

+ + + \ No newline at end of file diff --git a/application/modules_core/calendar/credit.txt b/application/modules_core/calendar/credit.txt new file mode 100644 index 0000000..e354bbb --- /dev/null +++ b/application/modules_core/calendar/credit.txt @@ -0,0 +1 @@ +Calendar module for MyClientBase provided by Omar Orellana \ No newline at end of file diff --git a/application/modules_core/calendar/models/index.html b/application/modules_core/calendar/models/index.html new file mode 100644 index 0000000..c942a79 --- /dev/null +++ b/application/modules_core/calendar/models/index.html @@ -0,0 +1,10 @@ + + + 403 Forbidden + + + +

Directory access is forbidden.

+ + + \ No newline at end of file diff --git a/application/modules_core/calendar/views/header_insert.php b/application/modules_core/calendar/views/header_insert.php new file mode 100644 index 0000000..0fa9f47 --- /dev/null +++ b/application/modules_core/calendar/views/header_insert.php @@ -0,0 +1,132 @@ + + + + +lang->line('buttonArr')); ?> + + + + \ No newline at end of file diff --git a/application/modules_core/calendar/views/index.html b/application/modules_core/calendar/views/index.html new file mode 100644 index 0000000..c942a79 --- /dev/null +++ b/application/modules_core/calendar/views/index.html @@ -0,0 +1,10 @@ + + + 403 Forbidden + + + +

Directory access is forbidden.

+ + + \ No newline at end of file diff --git a/application/modules_core/calendar/views/index.php b/application/modules_core/calendar/views/index.php new file mode 100644 index 0000000..ac04c4d --- /dev/null +++ b/application/modules_core/calendar/views/index.php @@ -0,0 +1,28 @@ +load->view('dashboard/header', array('header_insert'=>'calendar/header_insert')); ?> + +
+ +
+ +

lang->line('invoices') : $this->lang->line('quotes')); ?> + +
+ + +
+
+

+ +
+ + +
+ +
+ +
+ +
+ + +load->view('dashboard/footer'); ?> \ No newline at end of file diff --git a/application/modules_core/client_center/controllers/admin.php b/application/modules_core/client_center/controllers/admin.php index d8ed0b9..a019d4a 100644 --- a/application/modules_core/client_center/controllers/admin.php +++ b/application/modules_core/client_center/controllers/admin.php @@ -32,8 +32,6 @@ function form() { if (!$this->mdl_client_center->validate()) { - $this->load->helper('form'); - if (!$_POST AND uri_assoc('user_id', 4)) { $this->mdl_client_center->prep_validation(uri_assoc('user_id', 4)); @@ -42,11 +40,7 @@ function form() { $this->load->model('clients/mdl_clients'); - $data = array( - 'clients' => $this->mdl_clients->get() - ); - - $this->load->view('admin_form', $data); + $this->load->view('admin_form'); } @@ -86,4 +80,4 @@ function _post_handler() { } -?> +?> \ No newline at end of file diff --git a/application/modules_core/client_center/controllers/client_center.php b/application/modules_core/client_center/controllers/client_center.php index c6d7ad9..8e54c80 100644 --- a/application/modules_core/client_center/controllers/client_center.php +++ b/application/modules_core/client_center/controllers/client_center.php @@ -2,19 +2,24 @@ class Client_Center extends Client_Center_Controller { - function __construct() { + public function __construct() { parent::__construct('client_id'); - $this->load->model('invoices/mdl_invoices'); + $this->load->model( + array( + 'invoices/mdl_invoices', + 'mdl_client_center' + ) + ); - $this->load->model('mdl_client_center'); + $this->load->library('invoices/lib_output'); $this->load->helper('text'); } - function index() { + public function index() { $params = array( 'open' => array( @@ -57,7 +62,7 @@ function index() { } - function invoices() { + public function invoices() { $params = array( 'limit' => 25, @@ -78,42 +83,63 @@ function invoices() { } - function view_invoice() { + public function quotes() { $params = array( - 'where' => array( - 'mcb_invoices.invoice_id' => uri_assoc('invoice_id'), + 'limit' => 25, + 'paginate' => TRUE, + 'page' => uri_assoc('page', 4), + 'where' => array( 'mcb_invoices.client_id' => $this->session->userdata('client_id'), - 'mcb_invoices.invoice_is_quote' => 0 - ) + 'mcb_invoices.invoice_is_quote' => 1 + ), + 'set_client' => TRUE ); - $invoice = $this->mdl_invoices->get($params); + $data = array( + 'quotes' => $this->mdl_invoices->get($params) + ); - $invoice_items = $this->mdl_invoices->get_invoice_items($invoice->invoice_id); + $this->load->view('quotes', $data); - $invoice_tax_rates = $this->mdl_invoices->get_invoice_tax_rates($invoice->invoice_id); + } - $invoice_payments = $this->mdl_invoices->get_invoice_payments($invoice->invoice_id); + public function view_invoice() { - $data = array( - 'invoice' => $invoice, - 'invoice_items' => $invoice_items, - 'invoice_tax_rates' => $invoice_tax_rates, - 'invoice_payments' => $invoice_payments + $params = array( + 'where' => array( + 'mcb_invoices.invoice_id' => uri_assoc('invoice_id'), + 'mcb_invoices.client_id' => $this->session->userdata('client_id') + ) ); - if (!$data['invoice']) { + $invoice = $this->mdl_invoices->get($params); + + if (!$invoice) { redirect('client_center'); } + $invoice_items = $this->mdl_invoices->get_invoice_items($invoice->invoice_id); + + $invoice_tax_rates = $this->mdl_invoices->get_invoice_tax_rates($invoice->invoice_id); + + $invoice_payments = $this->mdl_invoices->get_invoice_payments($invoice->invoice_id); + + $data = array( + 'invoice' => $invoice, + 'invoice_items' => $invoice_items, + 'invoice_tax_rates' => $invoice_tax_rates, + 'invoice_payments' => $invoice_payments, + 'is_quote' => $invoice->invoice_is_quote + ); + $this->load->view('invoice_view', $data); } - function generate_pdf() { + public function generate_pdf() { $invoice_id = uri_assoc('invoice_id'); @@ -123,15 +149,15 @@ function generate_pdf() { } - $this->load->library('invoices/lib_output'); + $this->load->model('invoices/mdl_invoice_history'); - $this->mdl_invoices->save_invoice_history($invoice_id, $this->session->userdata('user_id'), $this->lang->line('client_generated_invoice_pdf')); + $this->mdl_invoice_history->save($invoice_id, $this->session->userdata('user_id'), $this->lang->line('client_generated_invoice_pdf')); $this->lib_output->pdf($invoice_id, $this->_get_invoice_template()); } - function generate_html() { + public function generate_html() { $invoice_id = uri_assoc('invoice_id'); @@ -141,29 +167,41 @@ function generate_html() { } - $this->load->library('invoices/lib_output'); + $this->load->model('invoices/mdl_invoice_history'); - $this->mdl_invoices->save_invoice_history($invoice_id, $this->session->userdata('user_id'), $this->lang->line('client_generated_invoice_html')); + $this->mdl_invoice_history->save($invoice_id, $this->session->userdata('user_id'), $this->lang->line('client_generated_invoice_html')); $this->lib_output->html($invoice_id, $this->_get_invoice_template()); } - function _get_invoice_template() { + public function _get_invoice_template() { - $this->load->model('mcb_data/mdl_mcb_client_data'); + $this->load->model('mcb_data/mdl_mcb_client_data'); - $invoice_template = $this->mdl_mcb_client_data->get($this->session->userdata('client_id'), 'default_invoice_template'); + $invoice_template = $this->mdl_mcb_client_data->get($this->session->userdata('client_id'), 'default_invoice_template'); - if (!$invoice_template) { + if (!$invoice_template) { - $invoice_template = $this->mdl_mcb_data->setting('default_invoice_template'); + $invoice_template = $this->mdl_mcb_data->setting('default_invoice_template'); - } + } + + return $invoice_template; + + } + + public function merchant_return() { - return $invoice_template; + $this->load->view('merchant_return'); - } + } + + public function merchant_cancel() { + + $this->load->view('merchant_cancel'); + + } } diff --git a/application/modules_core/client_center/models/mdl_client_center.php b/application/modules_core/client_center/models/mdl_client_center.php index 054e6a2..dae4048 100644 --- a/application/modules_core/client_center/models/mdl_client_center.php +++ b/application/modules_core/client_center/models/mdl_client_center.php @@ -2,7 +2,7 @@ class Mdl_Client_Center extends MY_Model { - function __construct() { + public function __construct() { parent::__construct(); @@ -20,20 +20,47 @@ function __construct() { } - function validate() { + public function validate() { + $this->form_validation->set_rules('client_id_autocomplete_label'); $this->form_validation->set_rules('client_id', $this->lang->line('client'), 'required'); - $this->form_validation->set_rules('username', $this->lang->line('username'), 'required'); + $this->form_validation->set_rules('username', $this->lang->line('username'), 'required|callback_username_check'); $this->form_validation->set_rules('password', $this->lang->line('password'), 'required'); $this->form_validation->set_rules('passwordv', $this->lang->line('passwordv'), 'required|matches[password]'); + $this->form_validation->set_rules('email_address', $this->lang->line('email_address'), 'required'); return parent::validate($this); } - function save($db_array, $user_id = NULL) { + public function username_check($username) { + + $this->db->where('username', $username); + + if (uri_assoc('user_id', 4)) { + + $this->db->where('user_id <>', uri_assoc('user_id', 4)); + + } + + $query = $this->db->get('mcb_users'); + + if ($query->num_rows()) { + + $this->form_validation->set_message('username_check', $this->lang->line('username_already_exists')); + + return FALSE; + + } + + return TRUE; + + } + + public function save($db_array, $user_id = NULL) { unset($db_array['passwordv']); + unset($db_array['client_id_autocomplete_label']); $db_array['password'] = md5($db_array['password']); @@ -41,7 +68,15 @@ function save($db_array, $user_id = NULL) { } - function invoice_belongs_to_client($invoice_id, $client_id) { + public function prep_validation($client_id) { + + parent::prep_validation($client_id); + + $this->form_values['client_id_autocomplete_label'] = $this->form_values['client_name']; + + } + + public function invoice_belongs_to_client($invoice_id, $client_id) { $this->db->where('invoice_id', $invoice_id); diff --git a/application/modules_core/client_center/views/account_form.php b/application/modules_core/client_center/views/account_form.php index 007da68..601bfa5 100644 --- a/application/modules_core/client_center/views/account_form.php +++ b/application/modules_core/client_center/views/account_form.php @@ -141,6 +141,6 @@ -load->view('dashboard/sidebar', array('side_block'=>'client_center/sidebar_change_pw')); ?> +load->view('sidebar_change_pw'); ?> load->view('dashboard/footer'); ?> \ No newline at end of file diff --git a/application/modules_core/client_center/views/admin_form.php b/application/modules_core/client_center/views/admin_form.php index 8e0b9f7..5473617 100644 --- a/application/modules_core/client_center/views/admin_form.php +++ b/application/modules_core/client_center/views/admin_form.php @@ -1,4 +1,4 @@ -load->view('dashboard/header'); ?> +load->view('dashboard/header', array('header_insert'=>array('client_center/jquery_client_ac'))); ?>
@@ -17,11 +17,8 @@
- + +
@@ -40,6 +37,11 @@
+
+
+
+
+
 
diff --git a/application/modules_core/client_center/views/admin_index.php b/application/modules_core/client_center/views/admin_index.php index 288e426..2d899aa 100644 --- a/application/modules_core/client_center/views/admin_index.php +++ b/application/modules_core/client_center/views/admin_index.php @@ -4,7 +4,11 @@
-

lang->line('client_center'); ?>load->view('dashboard/btn_add', array('btn_name'=>'btn_add_account', 'btn_value'=>$this->lang->line('create_account'))); ?>

+

lang->line('client_center'); ?> + + load->view('dashboard/btn_add', array('btn_name'=>'btn_add_account', 'btn_value'=>$this->lang->line('create_account'))); ?> + +

load->view('dashboard/system_messages'); ?> diff --git a/application/modules_core/client_center/views/admin_sidebar.php b/application/modules_core/client_center/views/admin_sidebar.php index 7b2397b..486be28 100644 --- a/application/modules_core/client_center/views/admin_sidebar.php +++ b/application/modules_core/client_center/views/admin_sidebar.php @@ -2,7 +2,7 @@
-

lang->line('quicklinks'); ?>

+

lang->line('quicklinks'); ?>