diff --git a/accounts/ap/ap.php b/accounts/ap/ap.php index d7482381..2a568e7b 100644 --- a/accounts/ap/ap.php +++ b/accounts/ap/ap.php @@ -44,13 +44,14 @@ function execute() $this->obj_table->add_column("price", "amount", "account_ap.amount"); $this->obj_table->add_column("price", "amount_total", "account_ap.amount_total"); $this->obj_table->add_column("price", "amount_paid", "account_ap.amount_paid"); + $this->obj_table->add_column("bool_tick", "closed", "(account_ap.amount_paid=account_ap.amount_total AND account_ap.amount_total>0)"); // totals $this->obj_table->total_columns = array("amount_tax", "amount", "amount_total", "amount_paid"); // defaults - $this->obj_table->columns = array("name_vendor", "code_invoice", "date_trans", "amount_total", "amount_paid"); + $this->obj_table->columns = array("name_vendor", "code_invoice", "date_trans", "amount_total", "amount_paid","closed"); $this->obj_table->columns_order = array("code_invoice"); $this->obj_table->columns_order_options = array("name_vendor", "code_invoice", "code_ordernumber", "code_ponumber", "name_staff", "date_trans", "date_due", "sent"); @@ -93,13 +94,11 @@ function execute() $structure = NULL; $structure["fieldname"] = "hide_closed"; $structure["type"] = "checkbox"; - $structure["options"]["label"] = "Hide Closed Invoices"; + $structure["options"]["label"] = "Hide Completed Invoices"; $structure["defaultvalue"] = "enabled"; - $structure["sql"] = "account_ap.amount_paid!=account_ap.amount_total"; + $structure["sql"] = "((account_ap.amount_paid<>account_ap.amount_total AND account_ap.amount_total>0) OR (account_ap.amount_total=0))"; $this->obj_table->add_filter($structure); - - // load options $this->obj_table->load_options_form(); @@ -158,6 +157,12 @@ function render_html() $structure["id"]["column"] = "id"; $this->obj_table->add_link("payments", "accounts/ap/invoice-payments.php", $structure); + // journal link + $structure = NULL; + $structure["id"]["column"] = "id"; + $this->obj_table->add_link("journal", "accounts/ap/journal.php", $structure); + + // display the table $this->obj_table->render_table_html(); diff --git a/accounts/ap/invoice-bulk-payments.php b/accounts/ap/invoice-bulk-payments.php index 7355bca6..ca2af00d 100644 --- a/accounts/ap/invoice-bulk-payments.php +++ b/accounts/ap/invoice-bulk-payments.php @@ -14,7 +14,7 @@ class page_output var $obj_table; var $obj_form; - function page_output() + function __construct() { // requirements $this->requires["css"][] = "include/accounts/css/invoice-bulk-payments.css"; diff --git a/accounts/ap/invoice-delete.php b/accounts/ap/invoice-delete.php index 2087fb1e..eea73248 100644 --- a/accounts/ap/invoice-delete.php +++ b/accounts/ap/invoice-delete.php @@ -21,7 +21,7 @@ class page_output var $obj_form_invoice; - function page_output() + function __construct() { // fetch vapiables $this->id = @security_script_input('/^[0-9]*$/', $_GET["id"]); diff --git a/accounts/ap/invoice-items-edit.php b/accounts/ap/invoice-items-edit.php index 1ee8d2af..6d42f8eb 100644 --- a/accounts/ap/invoice-items-edit.php +++ b/accounts/ap/invoice-items-edit.php @@ -28,10 +28,10 @@ class page_output var $obj_form_item; - function page_output() + function __construct() { //require javascript file - $this->requires["javascript"][] = "include/accounts/javascript/invoice-items-edit.js"; + $this->requires["javascript"][] = "include/accounts/javascript/invoice-items-edit_ap.js"; // fetch vapiables $this->id = @security_script_input('/^[0-9]*$/', $_GET["id"]); diff --git a/accounts/ap/invoice-items.php b/accounts/ap/invoice-items.php index 8046d14b..38e0ca04 100644 --- a/accounts/ap/invoice-items.php +++ b/accounts/ap/invoice-items.php @@ -21,7 +21,7 @@ class page_output var $obj_table_items; - function page_output() + function __construct() { $this->requires["css"][] = "include/accounts/css/invoice-items-edit.css"; // fetch vapiables diff --git a/accounts/ap/invoice-payments-edit.php b/accounts/ap/invoice-payments-edit.php index 6b0d94ea..08fbf17f 100644 --- a/accounts/ap/invoice-payments-edit.php +++ b/accounts/ap/invoice-payments-edit.php @@ -27,7 +27,7 @@ class page_output var $obj_form_item; - function page_output() + function __construct() { // fetch variables $this->id = @security_script_input('/^[0-9]*$/', $_GET["id"]); diff --git a/accounts/ap/invoice-payments.php b/accounts/ap/invoice-payments.php index cfc30dbb..d1947d77 100644 --- a/accounts/ap/invoice-payments.php +++ b/accounts/ap/invoice-payments.php @@ -20,7 +20,7 @@ class page_output var $obj_table_payments; - function page_output() + function __construct() { // fetch vapiables $this->id = @security_script_input('/^[0-9]*$/', $_GET["id"]); diff --git a/accounts/ap/invoice-view.php b/accounts/ap/invoice-view.php index 329cb5d2..fba38436 100644 --- a/accounts/ap/invoice-view.php +++ b/accounts/ap/invoice-view.php @@ -26,7 +26,7 @@ class page_output var $obj_form_invoice; - function page_output() + function __construct() { // fetch vapiables $this->id = @security_script_input('/^[0-9]*$/', $_GET["id"]); diff --git a/accounts/ap/journal-edit-process.php b/accounts/ap/journal-edit-process.php index eb863549..89b2864b 100644 --- a/accounts/ap/journal-edit-process.php +++ b/accounts/ap/journal-edit-process.php @@ -40,7 +40,7 @@ /// if there was an error, go back to the entry page - if ($_SESSION["error"]["message"]) + if (isset($_SESSION["error"]["message"])) { $_SESSION["error"]["form"]["journal_edit"] = "failed"; header("Location: ../../index.php?page=accounts/ap/journal.php&id=". $journal->structure["customid"] ."&journalid=". $journal->structure["id"] ."&action=". $journal->structure["action"] .""); diff --git a/accounts/ap/journal-edit.php b/accounts/ap/journal-edit.php index 5ea88f32..04b5f0ea 100644 --- a/accounts/ap/journal-edit.php +++ b/accounts/ap/journal-edit.php @@ -20,7 +20,7 @@ class page_output var $obj_form_journal; - function page_output() + function __construct() { // fetch vapiables $this->id = @security_script_input('/^[0-9]*$/', $_GET["id"]); diff --git a/accounts/ap/journal.php b/accounts/ap/journal.php index 35e3c12c..7c194c9a 100644 --- a/accounts/ap/journal.php +++ b/accounts/ap/journal.php @@ -17,7 +17,7 @@ class page_output var $obj_journal; - function page_output() + function __construct() { // fetch vapiables $this->id = @security_script_input('/^[0-9]*$/', $_GET["id"]); @@ -113,6 +113,8 @@ function render_html() format_msgbox("locked", "
Note: your permissions limit you to read-only access to the journal
"); } + + // display options form $this->obj_journal->render_options_form(); diff --git a/accounts/ar/account-statements.php b/accounts/ar/account-statements.php index 31481d5f..1f106825 100644 --- a/accounts/ar/account-statements.php +++ b/accounts/ar/account-statements.php @@ -15,7 +15,7 @@ class page_output var $obj_table; var $obj_form; - function page_output() + function __construct() { // requirements $this->requires["css"][] = "include/accounts/css/account-statements.css"; diff --git a/accounts/ar/ar.php b/accounts/ar/ar.php index bd494bfd..9bf68e64 100644 --- a/accounts/ar/ar.php +++ b/accounts/ar/ar.php @@ -46,13 +46,15 @@ function execute() $this->obj_table->add_column("price", "amount_total", "account_ar.amount_total"); $this->obj_table->add_column("price", "amount_paid", "account_ar.amount_paid"); $this->obj_table->add_column("bool_tick", "sent", "account_ar.sentmethod"); + $this->obj_table->add_column("bool_tick", "cancelled", "account_ar.cancelled"); + $this->obj_table->add_column("bool_tick", "closed", "(account_ar.amount_paid=account_ar.amount_total AND account_ar.amount_total>0)"); // totals $this->obj_table->total_columns = array("amount_tax", "amount", "amount_total", "amount_paid"); // defaults - $this->obj_table->columns = array("code_invoice", "name_customer", "date_trans", "amount_total", "amount_paid"); + $this->obj_table->columns = array("code_invoice", "name_customer", "date_trans", "amount_total", "amount_paid","closed"); $this->obj_table->columns_order = array("code_invoice"); $this->obj_table->columns_order_options = array("code_invoice", "code_ordernumber", "code_ponumber", "name_customer", "name_staff", "date_trans", "date_due", "sent"); @@ -93,13 +95,23 @@ function execute() $this->obj_table->add_filter($structure); $structure = NULL; - $structure["fieldname"] = "hide_closed"; - $structure["type"] = "checkbox"; - $structure["options"]["label"] = "Hide Closed Invoices"; - $structure["defaultvalue"] = "enabled"; - $structure["sql"] = "account_ar.amount_paid!=account_ar.amount_total"; + $structure["fieldname"] = "hide_closed"; + $structure["type"] = "checkbox"; + $structure["options"]["label"] = "Hide Completed Invoices"; + $structure["defaultvalue"] = "enabled"; + $structure["sql"] = "((account_ar.amount_paid<>account_ar.amount_total AND account_ar.amount_total>0) OR (account_ar.amount_total=0))"; $this->obj_table->add_filter($structure); - + + $structure = NULL; + $structure["fieldname"] = "hide_cancelled"; + $structure["type"] = "checkbox"; + $structure["options"]["label"] = "Hide Cancelled Invoices"; + $structure["options"]["no_fieldname"] = true; + $structure["options"]["no_shift"] = true; + $structure["defaultvalue"] = "enabled"; + $structure["sql"] = "account_ar.cancelled=0"; + $this->obj_table->add_filter($structure); + // load options $this->obj_table->load_options_form(); @@ -158,6 +170,15 @@ function render_html() $structure["id"]["column"] = "id"; $this->obj_table->add_link("payments", "accounts/ar/invoice-payments.php", $structure); + // journal link + $structure = NULL; + $structure["id"]["column"] = "id"; + $this->obj_table->add_link("journal", "accounts/ar/journal.php", $structure); + + // export link + $structure = NULL; + $structure["id"]["column"] = "id"; + $this->obj_table->add_link("export", "accounts/ar/invoice-export.php", $structure); diff --git a/accounts/ar/credit-add.php b/accounts/ar/credit-add.php index 27abd20d..6c2d4867 100644 --- a/accounts/ar/credit-add.php +++ b/accounts/ar/credit-add.php @@ -18,7 +18,7 @@ class page_output var $obj_menu_nav; var $obj_form_credit; - function page_output() + function __construct() { $this->requires["javascript"][] = "include/customers/javascript/populate_invoices_dropdown.js"; } diff --git a/accounts/ar/credit-delete.php b/accounts/ar/credit-delete.php index c1575903..0de87589 100644 --- a/accounts/ar/credit-delete.php +++ b/accounts/ar/credit-delete.php @@ -22,7 +22,7 @@ class page_output var $obj_form_credit; - function page_output() + function __construct() { // fetch variables $this->id = @security_script_input('/^[0-9]*$/', $_GET["id"]); diff --git a/accounts/ar/credit-export.php b/accounts/ar/credit-export.php index 5b51fbe4..9b96f703 100644 --- a/accounts/ar/credit-export.php +++ b/accounts/ar/credit-export.php @@ -21,7 +21,7 @@ class page_output var $obj_form_credit; - function page_output() + function __construct() { $this->requires["javascript"][] = "include/accounts/javascript/credit-export.js"; diff --git a/accounts/ar/credit-items-edit.php b/accounts/ar/credit-items-edit.php index d0696a22..9869f32d 100644 --- a/accounts/ar/credit-items-edit.php +++ b/accounts/ar/credit-items-edit.php @@ -29,10 +29,10 @@ class page_output var $obj_form_item; - function page_output() + function __construct() { //require javascript file - $this->requires["javascript"][] = "include/accounts/javascript/invoice-items-edit.js"; + $this->requires["javascript"][] = "include/accounts/javascript/invoice-items-edit_ar.js"; // fetch variables $this->id = @@security_script_input('/^[0-9]*$/', $_GET["id"]); diff --git a/accounts/ar/credit-items.php b/accounts/ar/credit-items.php index bd8ba9c1..137d0475 100644 --- a/accounts/ar/credit-items.php +++ b/accounts/ar/credit-items.php @@ -22,7 +22,7 @@ class page_output var $obj_table_items; - function page_output() + function __construct() { $this->requires["css"][] = "include/accounts/css/invoice-items-edit.css"; diff --git a/accounts/ar/credit-journal-edit.php b/accounts/ar/credit-journal-edit.php index 794f8bc6..c3751df2 100644 --- a/accounts/ar/credit-journal-edit.php +++ b/accounts/ar/credit-journal-edit.php @@ -20,7 +20,7 @@ class page_output var $obj_form_journal; - function page_output() + function __construct() { // fetch variables $this->id = @@security_script_input('/^[0-9]*$/', $_GET["id"]); diff --git a/accounts/ar/credit-journal.php b/accounts/ar/credit-journal.php index 35f67946..679ce32a 100644 --- a/accounts/ar/credit-journal.php +++ b/accounts/ar/credit-journal.php @@ -17,7 +17,7 @@ class page_output var $obj_journal; - function page_output() + function __construct() { // fetch variables $this->id = @security_script_input('/^[0-9]*$/', $_GET["id"]); diff --git a/accounts/ar/credit-payments.php b/accounts/ar/credit-payments.php index ce1f6994..979929b7 100644 --- a/accounts/ar/credit-payments.php +++ b/accounts/ar/credit-payments.php @@ -20,7 +20,7 @@ class page_output var $obj_table_items; - function page_output() + function __construct() { $this->requires["css"][] = "include/accounts/css/invoice-items-edit.css"; diff --git a/accounts/ar/credit-view.php b/accounts/ar/credit-view.php index 0648ce18..f89a488b 100644 --- a/accounts/ar/credit-view.php +++ b/accounts/ar/credit-view.php @@ -21,7 +21,7 @@ class page_output var $obj_form_credit; - function page_output() + function __construct() { // fetch variables $this->id = @security_script_input('/^[0-9]*$/', $_GET["id"]); diff --git a/accounts/ar/invoice-bulk-payments.php b/accounts/ar/invoice-bulk-payments.php index ba9c4ac8..6f6f092b 100644 --- a/accounts/ar/invoice-bulk-payments.php +++ b/accounts/ar/invoice-bulk-payments.php @@ -14,7 +14,7 @@ class page_output var $obj_table; var $obj_form; - function page_output() + function __construct() { // requirements $this->requires["css"][] = "include/accounts/css/invoice-bulk-payments.css"; diff --git a/accounts/ar/invoice-delete.php b/accounts/ar/invoice-delete.php index 3a5e18fa..07019b03 100644 --- a/accounts/ar/invoice-delete.php +++ b/accounts/ar/invoice-delete.php @@ -21,7 +21,7 @@ class page_output var $obj_form_invoice; - function page_output() + function __construct() { // fetch variables $this->id = @security_script_input('/^[0-9]*$/', $_GET["id"]); @@ -34,7 +34,15 @@ function page_output() $this->obj_menu_nav->add_item("Invoice Payments", "page=accounts/ar/invoice-payments.php&id=". $this->id .""); $this->obj_menu_nav->add_item("Invoice Journal", "page=accounts/ar/journal.php&id=". $this->id .""); $this->obj_menu_nav->add_item("Export Invoice", "page=accounts/ar/invoice-export.php&id=". $this->id .""); - $this->obj_menu_nav->add_item("Delete Invoice", "page=accounts/ar/invoice-delete.php&id=". $this->id ."", TRUE); + if($GLOBALS["config"]["ACCOUNTS_CANCEL_DELETE"]=="1") + { + $title="Cancel Invoice"; + } + else + { + $title="Delete Invoice"; + } + $this->obj_menu_nav->add_item($title, "page=accounts/ar/invoice-delete.php&id=". $this->id ."",TRUE); } @@ -77,10 +85,18 @@ function execute() function render_html() { - // heading - print "This page allows you to delete incorrect invoices, provided that they have not been locked.
"; - + if($GLOBALS["config"]["ACCOUNTS_CANCEL_DELETE"]=="1") + { + // heading + print "This page allows you to cancel incorrect invoices, provided that they have not been locked.
"; + } + else + { + // heading + print "This page allows you to delete incorrect invoices, provided that they have not been locked.
"; + } // display summary box invoice_render_summarybox("ar", $this->id); diff --git a/accounts/ar/invoice-export.php b/accounts/ar/invoice-export.php index c8d8c2ed..047dc208 100644 --- a/accounts/ar/invoice-export.php +++ b/accounts/ar/invoice-export.php @@ -20,7 +20,7 @@ class page_output var $obj_form_invoice; - function page_output() + function __construct() { $this->requires["javascript"][] = "include/accounts/javascript/invoice-export.js"; @@ -36,9 +36,20 @@ function page_output() $this->obj_menu_nav->add_item("Invoice Journal", "page=accounts/ar/journal.php&id=". $this->id .""); $this->obj_menu_nav->add_item("Export Invoice", "page=accounts/ar/invoice-export.php&id=". $this->id ."", TRUE); - if (user_permissions_get("accounts_ar_write")) + if (user_permissions_get("accounts_ar_write") + && ((sql_get_singlevalue("SELECT cancelled as value FROM account_ar WHERE id='".$this->id."'")=='0' && $GLOBALS["config"]["ACCOUNTS_CANCEL_DELETE"]=="1") + || $GLOBALS["config"]["ACCOUNTS_CANCEL_DELETE"]=="0") + ) { - $this->obj_menu_nav->add_item("Delete Invoice", "page=accounts/ar/invoice-delete.php&id=". $this->id .""); + if($GLOBALS["config"]["ACCOUNTS_CANCEL_DELETE"]=="1") + { + $title="Cancel Invoice"; + } + else + { + $title="Delete Invoice"; + } + $this->obj_menu_nav->add_item($title, "page=accounts/ar/invoice-delete.php&id=". $this->id .""); } } diff --git a/accounts/ar/invoice-items-edit.php b/accounts/ar/invoice-items-edit.php index 0017952d..7197d43b 100644 --- a/accounts/ar/invoice-items-edit.php +++ b/accounts/ar/invoice-items-edit.php @@ -22,6 +22,7 @@ class page_output var $id; var $itemid; var $item_type; + var $productid; var $requires; var $obj_menu_nav; @@ -29,10 +30,10 @@ class page_output var $obj_form_item; - function page_output() + function __construct() { //require javascript file - $this->requires["javascript"][] = "include/accounts/javascript/invoice-items-edit.js"; + $this->requires["javascript"][] = "include/accounts/javascript/invoice-items-edit_ar.js"; // fetch variables $this->id = @@security_script_input('/^[0-9]*$/', $_GET["id"]); @@ -48,7 +49,22 @@ function page_output() $this->obj_menu_nav->add_item("Invoice Payments", "page=accounts/ar/invoice-payments.php&id=". $this->id .""); $this->obj_menu_nav->add_item("Invoice Journal", "page=accounts/ar/journal.php&id=". $this->id .""); $this->obj_menu_nav->add_item("Export Invoice", "page=accounts/ar/invoice-export.php&id=". $this->id .""); - $this->obj_menu_nav->add_item("Delete Invoice", "page=accounts/ar/invoice-delete.php&id=". $this->id .""); + + if (user_permissions_get("accounts_ar_write") + && ((sql_get_singlevalue("SELECT cancelled as value FROM account_ar WHERE id='".$this->id."'")=='0' && $GLOBALS["config"]["ACCOUNTS_CANCEL_DELETE"]=="1") + || $GLOBALS["config"]["ACCOUNTS_CANCEL_DELETE"]=="0") + ) + { + if($GLOBALS["config"]["ACCOUNTS_CANCEL_DELETE"]=="1") + { + $title="Cancel Invoice"; + } + else + { + $title="Delete Invoice"; + } + $this->obj_menu_nav->add_item($title, "page=accounts/ar/invoice-delete.php&id=". $this->id .""); + } } diff --git a/accounts/ar/invoice-items.php b/accounts/ar/invoice-items.php index 2e921951..ab8ddfd4 100644 --- a/accounts/ar/invoice-items.php +++ b/accounts/ar/invoice-items.php @@ -21,7 +21,7 @@ class page_output var $obj_table_items; - function page_output() + function __construct() { $this->requires["css"][] = "include/accounts/css/invoice-items-edit.css"; // fetch variables @@ -36,9 +36,20 @@ function page_output() $this->obj_menu_nav->add_item("Invoice Journal", "page=accounts/ar/journal.php&id=". $this->id .""); $this->obj_menu_nav->add_item("Export Invoice", "page=accounts/ar/invoice-export.php&id=". $this->id .""); - if (user_permissions_get("accounts_ar_write")) + if (user_permissions_get("accounts_ar_write") + && ((sql_get_singlevalue("SELECT cancelled as value FROM account_ar WHERE id='".$this->id."'")=='0' && $GLOBALS["config"]["ACCOUNTS_CANCEL_DELETE"]=="1") + || $GLOBALS["config"]["ACCOUNTS_CANCEL_DELETE"]=="0") + ) { - $this->obj_menu_nav->add_item("Delete Invoice", "page=accounts/ar/invoice-delete.php&id=". $this->id .""); + if($GLOBALS["config"]["ACCOUNTS_CANCEL_DELETE"]=="1") + { + $title="Cancel Invoice"; + } + else + { + $title="Delete Invoice"; + } + $this->obj_menu_nav->add_item($title, "page=accounts/ar/invoice-delete.php&id=". $this->id .""); } } diff --git a/accounts/ar/invoice-payments-edit.php b/accounts/ar/invoice-payments-edit.php index e2a7a215..2dc2f6c5 100644 --- a/accounts/ar/invoice-payments-edit.php +++ b/accounts/ar/invoice-payments-edit.php @@ -27,7 +27,7 @@ class page_output var $obj_form_item; - function page_output() + function __construct() { // fetch variables $this->id = @@security_script_input('/^[0-9]*$/', $_GET["id"]); @@ -41,7 +41,21 @@ function page_output() $this->obj_menu_nav->add_item("Invoice Payments", "page=accounts/ar/invoice-payments.php&id=". $this->id ."", TRUE); $this->obj_menu_nav->add_item("Invoice Journal", "page=accounts/ar/journal.php&id=". $this->id .""); $this->obj_menu_nav->add_item("Export Invoice", "page=accounts/ar/invoice-export.php&id=". $this->id .""); - $this->obj_menu_nav->add_item("Delete Invoice", "page=accounts/ar/invoice-delete.php&id=". $this->id .""); + if (user_permissions_get("accounts_ar_write") + && ((sql_get_singlevalue("SELECT cancelled as value FROM account_ar WHERE id='".$this->id."'")=='0' && $GLOBALS["config"]["ACCOUNTS_CANCEL_DELETE"]=="1") + || $GLOBALS["config"]["ACCOUNTS_CANCEL_DELETE"]=="0") + ) + { + if($GLOBALS["config"]["ACCOUNTS_CANCEL_DELETE"]=="1") + { + $title="Cancel Invoice"; + } + else + { + $title="Delete Invoice"; + } + $this->obj_menu_nav->add_item($title, "page=accounts/ar/invoice-delete.php&id=". $this->id .""); + } } diff --git a/accounts/ar/invoice-payments.php b/accounts/ar/invoice-payments.php index 6e1372b2..e9ffb72f 100644 --- a/accounts/ar/invoice-payments.php +++ b/accounts/ar/invoice-payments.php @@ -20,7 +20,7 @@ class page_output var $obj_table_payments; - function page_output() + function __construct() { // fetch variables $this->id = @security_script_input('/^[0-9]*$/', $_GET["id"]); @@ -34,9 +34,20 @@ function page_output() $this->obj_menu_nav->add_item("Invoice Journal", "page=accounts/ar/journal.php&id=". $this->id .""); $this->obj_menu_nav->add_item("Export Invoice", "page=accounts/ar/invoice-export.php&id=". $this->id .""); - if (user_permissions_get("accounts_ar_write")) + if (user_permissions_get("accounts_ar_write") + && ((sql_get_singlevalue("SELECT cancelled as value FROM account_ar WHERE id='".$this->id."'")=='0' && $GLOBALS["config"]["ACCOUNTS_CANCEL_DELETE"]=="1") + || $GLOBALS["config"]["ACCOUNTS_CANCEL_DELETE"]=="0") + ) { - $this->obj_menu_nav->add_item("Delete Invoice", "page=accounts/ar/invoice-delete.php&id=". $this->id .""); + if($GLOBALS["config"]["ACCOUNTS_CANCEL_DELETE"]=="1") + { + $title="Cancel Invoice"; + } + else + { + $title="Delete Invoice"; + } + $this->obj_menu_nav->add_item($title, "page=accounts/ar/invoice-delete.php&id=". $this->id .""); } } diff --git a/accounts/ar/invoice-view.php b/accounts/ar/invoice-view.php index 9e4eb8ba..9a991e80 100644 --- a/accounts/ar/invoice-view.php +++ b/accounts/ar/invoice-view.php @@ -20,7 +20,7 @@ class page_output var $obj_form_invoice; - function page_output() + function __construct() { // fetch variables $this->id = @security_script_input('/^[0-9]*$/', $_GET["id"]); @@ -34,9 +34,20 @@ function page_output() $this->obj_menu_nav->add_item("Invoice Journal", "page=accounts/ar/journal.php&id=". $this->id .""); $this->obj_menu_nav->add_item("Export Invoice", "page=accounts/ar/invoice-export.php&id=". $this->id .""); - if (user_permissions_get("accounts_ar_write")) + if (user_permissions_get("accounts_ar_write") + && ((sql_get_singlevalue("SELECT cancelled as value FROM account_ar WHERE id='".$this->id."'")=='0' && $GLOBALS["config"]["ACCOUNTS_CANCEL_DELETE"]=="1") + || $GLOBALS["config"]["ACCOUNTS_CANCEL_DELETE"]=="0") + ) { - $this->obj_menu_nav->add_item("Delete Invoice", "page=accounts/ar/invoice-delete.php&id=". $this->id .""); + if($GLOBALS["config"]["ACCOUNTS_CANCEL_DELETE"]=="1") + { + $title="Cancel Invoice"; + } + else + { + $title="Delete Invoice"; + } + $this->obj_menu_nav->add_item($title, "page=accounts/ar/invoice-delete.php&id=". $this->id .""); } } diff --git a/accounts/ar/journal-edit.php b/accounts/ar/journal-edit.php index b7cbb31d..f7961806 100644 --- a/accounts/ar/journal-edit.php +++ b/accounts/ar/journal-edit.php @@ -20,7 +20,7 @@ class page_output var $obj_form_journal; - function page_output() + function __construct() { // fetch variables $this->id = @@security_script_input('/^[0-9]*$/', $_GET["id"]); @@ -37,7 +37,22 @@ function page_output() $this->obj_menu_nav->add_item("Invoice Payments", "page=accounts/ar/invoice-payments.php&id=". $this->id .""); $this->obj_menu_nav->add_item("Invoice Journal", "page=accounts/ar/journal.php&id=". $this->id ."", TRUE); $this->obj_menu_nav->add_item("Export Invoice", "page=accounts/ar/invoice-export.php&id=". $this->id .""); - $this->obj_menu_nav->add_item("Delete Invoice", "page=accounts/ar/invoice-delete.php&id=". $this->id .""); + + if (user_permissions_get("accounts_ar_write") + && ((sql_get_singlevalue("SELECT cancelled as value FROM account_ar WHERE id='".$this->id."'")=='0' && $GLOBALS["config"]["ACCOUNTS_CANCEL_DELETE"]=="1") + || $GLOBALS["config"]["ACCOUNTS_CANCEL_DELETE"]=="0") + ) + { + if($GLOBALS["config"]["ACCOUNTS_CANCEL_DELETE"]=="1") + { + $title="Cancel Invoice"; + } + else + { + $title="Delete Invoice"; + } + $this->obj_menu_nav->add_item($title, "page=accounts/ar/invoice-delete.php&id=". $this->id .""); + } } diff --git a/accounts/ar/journal.php b/accounts/ar/journal.php index 6f26f678..3342680d 100644 --- a/accounts/ar/journal.php +++ b/accounts/ar/journal.php @@ -17,7 +17,7 @@ class page_output var $obj_journal; - function page_output() + function __construct() { // fetch variables $this->id = @security_script_input('/^[0-9]*$/', $_GET["id"]); @@ -31,9 +31,20 @@ function page_output() $this->obj_menu_nav->add_item("Invoice Journal", "page=accounts/ar/journal.php&id=". $this->id ."", TRUE); $this->obj_menu_nav->add_item("Export Invoice", "page=accounts/ar/invoice-export.php&id=". $this->id .""); - if (user_permissions_get("accounts_ar_write")) + if (user_permissions_get("accounts_ar_write") + && ((sql_get_singlevalue("SELECT cancelled as value FROM account_ar WHERE id='".$this->id."'")=='0' && $GLOBALS["config"]["ACCOUNTS_CANCEL_DELETE"]=="1") + || $GLOBALS["config"]["ACCOUNTS_CANCEL_DELETE"]=="0") + ) { - $this->obj_menu_nav->add_item("Delete Invoice", "page=accounts/ar/invoice-delete.php&id=". $this->id .""); + if($GLOBALS["config"]["ACCOUNTS_CANCEL_DELETE"]=="1") + { + $title="Cancel Invoice"; + } + else + { + $title="Delete Invoice"; + } + $this->obj_menu_nav->add_item($title, "page=accounts/ar/invoice-delete.php&id=". $this->id .""); } } diff --git a/accounts/charts/delete.php b/accounts/charts/delete.php index 10bf0b2d..de94bbf0 100644 --- a/accounts/charts/delete.php +++ b/accounts/charts/delete.php @@ -22,7 +22,7 @@ class page_output var $locked; - function page_output() + function __construct() { // fetch variables $this->id = @security_script_input('/^[0-9]*$/', $_GET["id"]); diff --git a/accounts/charts/ledger.php b/accounts/charts/ledger.php index 9c198aa7..b8c02e20 100644 --- a/accounts/charts/ledger.php +++ b/accounts/charts/ledger.php @@ -20,7 +20,7 @@ class page_output var $obj_ledger; - function page_output() + function __construct() { // fetch variables $this->id = @security_script_input('/^[0-9]*$/', $_GET["id"]); diff --git a/accounts/charts/view.php b/accounts/charts/view.php index 32b687a3..a2506dce 100644 --- a/accounts/charts/view.php +++ b/accounts/charts/view.php @@ -19,7 +19,7 @@ class page_output var $chart_type; // hold the ID of the chart type - function page_output() + function __construct() { // fetch variables $this->id = @security_script_input('/^[0-9]*$/', $_GET["id"]); diff --git a/accounts/gl/delete.php b/accounts/gl/delete.php index ee9cf0ba..eee6880a 100644 --- a/accounts/gl/delete.php +++ b/accounts/gl/delete.php @@ -18,7 +18,7 @@ class page_output var $locked; - function page_output() + function __construct() { // fetch variables $this->id = @security_script_input('/^[0-9]*$/', $_GET["id"]); diff --git a/accounts/gl/view.php b/accounts/gl/view.php index 5db98796..024b1495 100644 --- a/accounts/gl/view.php +++ b/accounts/gl/view.php @@ -22,7 +22,7 @@ class page_output var $num_trans; - function page_output() + function __construct() { // define page dependencies $this->requires["javascript"][] = "include/accounts/javascript/gl.js"; diff --git a/accounts/import/bankstatement-assign.php b/accounts/import/bankstatement-assign.php index 65639750..d3042184 100644 --- a/accounts/import/bankstatement-assign.php +++ b/accounts/import/bankstatement-assign.php @@ -20,7 +20,7 @@ class page_output var $obj_form; - function page_output() + function __construct() { $this->requires["javascript"][] = "include/accounts/javascript/import.js"; $this->requires["css"][] = "include/accounts/css/bankstatement-assign.css"; diff --git a/accounts/import/bankstatement-csv.php b/accounts/import/bankstatement-csv.php index a9789bb9..624c5647 100644 --- a/accounts/import/bankstatement-csv.php +++ b/accounts/import/bankstatement-csv.php @@ -15,7 +15,7 @@ class page_output var $example_array; - function page_output() + function __construct() { $this->requires["javascript"][] = "include/accounts/javascript/import.js"; $this->requires["css"][] = "include/accounts/css/bankstatement-csv.css"; diff --git a/accounts/quotes/journal-edit.php b/accounts/quotes/journal-edit.php index 2f22eae0..d497626b 100644 --- a/accounts/quotes/journal-edit.php +++ b/accounts/quotes/journal-edit.php @@ -19,7 +19,7 @@ class page_output var $obj_form_journal; - function page_output() + function __construct() { // fetch quote ID $this->id = @security_script_input('/^[0-9]*$/', $_GET["id"]); @@ -35,6 +35,7 @@ function page_output() $this->obj_menu_nav->add_item("Quote Items", "page=accounts/quotes/quotes-items.php&id=". $this->id .""); $this->obj_menu_nav->add_item("Quote Journal", "page=accounts/quotes/journal.php&id=". $this->id ."", TRUE); $this->obj_menu_nav->add_item("Export Quote", "page=accounts/quotes/quotes-export.php&id=". $this->id .""); + $this->obj_menu_nav->add_item("Create Project", "page=accounts/quotes/quotes-convert-project.php&id=". $this->id .""); $this->obj_menu_nav->add_item("Convert to Invoice", "page=accounts/quotes/quotes-convert.php&id=". $this->id .""); $this->obj_menu_nav->add_item("Delete Quote", "page=accounts/quotes/quotes-delete.php&id=". $this->id .""); } diff --git a/accounts/quotes/journal.php b/accounts/quotes/journal.php index 6931213a..98fd6d1e 100644 --- a/accounts/quotes/journal.php +++ b/accounts/quotes/journal.php @@ -18,7 +18,7 @@ class page_output var $obj_journal; - function page_output() + function __construct() { // fetch quote ID $this->id = @security_script_input('/^[0-9]*$/', $_GET["id"]); @@ -33,6 +33,7 @@ function page_output() if (user_permissions_get("accounts_quotes_write")) { + $this->obj_menu_nav->add_item("Create Project", "page=accounts/quotes/quotes-convert-project.php&id=". $this->id .""); $this->obj_menu_nav->add_item("Convert to Invoice", "page=accounts/quotes/quotes-convert.php&id=". $this->id .""); $this->obj_menu_nav->add_item("Delete Quote", "page=accounts/quotes/quotes-delete.php&id=". $this->id .""); } diff --git a/accounts/quotes/quotes-convert-project.php b/accounts/quotes/quotes-convert-project.php new file mode 100644 index 00000000..40df4f14 --- /dev/null +++ b/accounts/quotes/quotes-convert-project.php @@ -0,0 +1,130 @@ +id = @security_script_input('/^[0-9]*$/', $_GET["id"]); + + // define the navigiation menu + $this->obj_menu_nav = New menu_nav; + + $this->obj_menu_nav->add_item("Quote Details", "page=accounts/quotes/quotes-view.php&id=". $this->id .""); + $this->obj_menu_nav->add_item("Quote Items", "page=accounts/quotes/quotes-items.php&id=". $this->id .""); + $this->obj_menu_nav->add_item("Quote Journal", "page=accounts/quotes/journal.php&id=". $this->id .""); + $this->obj_menu_nav->add_item("Export Quote", "page=accounts/quotes/quotes-export.php&id=". $this->id .""); + $this->obj_menu_nav->add_item("Create Project", "page=accounts/quotes/quotes-convert-project.php&id=". $this->id ."",TRUE); + $this->obj_menu_nav->add_item("Convert to Invoice", "page=accounts/quotes/quotes-convert.php&id=". $this->id .""); + $this->obj_menu_nav->add_item("Delete Quote", "page=accounts/quotes/quotes-delete.php&id=". $this->id .""); + } + + function check_permissions() + { + return user_permissions_get("projects_write"); + } + + function check_requirements() + { + // nothing todo + return 1; + } + + + function execute() + { + /* + Define form structure + */ + $this->obj_form = New form_input; + $this->obj_form->formname = "project_add"; + $this->obj_form->language = $_SESSION["user"]["lang"]; + + $this->obj_form->action = "projects/edit-process.php"; + $this->obj_form->method = "post"; + + + // general + $structure = NULL; + $structure["fieldname"] = "name_project"; + $structure["type"] = "input"; + $structure["options"]["req"] = "yes"; + $this->obj_form->add_input($structure); + + $structure = NULL; + $structure["fieldname"] = "code_project"; + $structure["type"] = "input"; + $this->obj_form->add_input($structure); + + $structure = NULL; + $structure["fieldname"] = "project_quote"; + $structure["type"] = "input"; + $structure["defaultvalue"] = sql_get_singlevalue("SELECT code_quote as value FROM account_quotes WHERE id=".$this->id); + $this->obj_form->add_input($structure); + + $structure = NULL; + $structure["fieldname"] = "date_start"; + $structure["type"] = "date"; + $structure["defaultvalue"] = date("Y-m-d"); + $structure["options"]["req"] = "yes"; + $this->obj_form->add_input($structure); + + $structure = NULL; + $structure["fieldname"] = "date_end"; + $structure["type"] = "date"; + $this->obj_form->add_input($structure); + + $structure = NULL; + $structure["fieldname"] = "internal_only"; + $structure["type"] = "checkbox"; + $structure["options"]["label"] = "This is an internal project - do not alert to unbilled hours"; + $this->obj_form->add_input($structure); + + $structure = NULL; + $structure["fieldname"] = "details"; + $structure["type"] = "textarea"; + $this->obj_form->add_input($structure); + + + // submit button + $structure = NULL; + $structure["fieldname"] = "submit"; + $structure["type"] = "submit"; + $structure["defaultvalue"] = "Create Project"; + $this->obj_form->add_input($structure); + + + // define subforms + $this->obj_form->subforms["project_view"] = array("code_project", "name_project", "project_quote", "date_start", "date_end", "internal_only", "details"); + $this->obj_form->subforms["submit"] = array("submit"); + + // load any data returned due to errors + $this->obj_form->load_data_error(); + + } + + function render_html() + { + // Title + Summary + print "This page allows you to add a new project.
"; + + + // display the form + $this->obj_form->render_form(); + } + +} + +?> diff --git a/accounts/quotes/quotes-convert.php b/accounts/quotes/quotes-convert.php index 1b8795d9..13690524 100644 --- a/accounts/quotes/quotes-convert.php +++ b/accounts/quotes/quotes-convert.php @@ -20,7 +20,7 @@ class page_output var $obj_form_quote; - function page_output() + function __construct() { // fetch quote ID $this->id = @security_script_input('/^[0-9]*$/', $_GET["id"]); @@ -32,6 +32,7 @@ function page_output() $this->obj_menu_nav->add_item("Quote Items", "page=accounts/quotes/quotes-items.php&id=". $this->id .""); $this->obj_menu_nav->add_item("Quote Journal", "page=accounts/quotes/journal.php&id=". $this->id .""); $this->obj_menu_nav->add_item("Export Quote", "page=accounts/quotes/quotes-export.php&id=". $this->id .""); + $this->obj_menu_nav->add_item("Create Project", "page=accounts/quotes/quotes-convert-project.php&id=". $this->id .""); $this->obj_menu_nav->add_item("Convert to Invoice", "page=accounts/quotes/quotes-convert.php&id=". $this->id ."", TRUE); $this->obj_menu_nav->add_item("Delete Quote", "page=accounts/quotes/quotes-delete.php&id=". $this->id .""); } diff --git a/accounts/quotes/quotes-delete.php b/accounts/quotes/quotes-delete.php index 797a9d92..a6fcc269 100644 --- a/accounts/quotes/quotes-delete.php +++ b/accounts/quotes/quotes-delete.php @@ -19,7 +19,7 @@ class page_output var $obj_form_quote; - function page_output() + function __construct() { // fetch quote ID $this->id = @security_script_input('/^[0-9]*$/', $_GET["id"]); @@ -31,6 +31,7 @@ function page_output() $this->obj_menu_nav->add_item("Quote Items", "page=accounts/quotes/quotes-items.php&id=". $this->id .""); $this->obj_menu_nav->add_item("Quote Journal", "page=accounts/quotes/journal.php&id=". $this->id .""); $this->obj_menu_nav->add_item("Export Quote", "page=accounts/quotes/quotes-export.php&id=". $this->id .""); + $this->obj_menu_nav->add_item("Create Project", "page=accounts/quotes/quotes-convert-project.php&id=". $this->id .""); $this->obj_menu_nav->add_item("Convert to Invoice", "page=accounts/quotes/quotes-convert.php&id=". $this->id .""); $this->obj_menu_nav->add_item("Delete Quote", "page=accounts/quotes/quotes-delete.php&id=". $this->id ."", TRUE); } diff --git a/accounts/quotes/quotes-export.php b/accounts/quotes/quotes-export.php index 076c2881..ad882679 100644 --- a/accounts/quotes/quotes-export.php +++ b/accounts/quotes/quotes-export.php @@ -21,7 +21,7 @@ class page_output var $obj_form_invoice; - function page_output() + function __construct() { // fetch variables $this->id = @security_script_input('/^[0-9]*$/', $_GET["id"]); @@ -36,6 +36,7 @@ function page_output() if (user_permissions_get("accounts_quotes_write")) { + $this->obj_menu_nav->add_item("Create Project", "page=accounts/quotes/quotes-convert-project.php&id=". $this->id .""); $this->obj_menu_nav->add_item("Convert to Invoice", "page=accounts/quotes/quotes-convert.php&id=". $this->id .""); $this->obj_menu_nav->add_item("Delete Quote", "page=accounts/quotes/quotes-delete.php&id=". $this->id .""); } diff --git a/accounts/quotes/quotes-items-edit.php b/accounts/quotes/quotes-items-edit.php index 41d91810..db3e5fce 100644 --- a/accounts/quotes/quotes-items-edit.php +++ b/accounts/quotes/quotes-items-edit.php @@ -28,10 +28,10 @@ class page_output var $obj_form_item; - function page_output() + function __construct() { //require javascript file - $this->requires["javascript"][] = "include/accounts/javascript/invoice-items-edit.js"; + $this->requires["javascript"][] = "include/accounts/javascript/invoice-items-edit_ar.js"; // fetch vapiables $this->id = @security_script_input('/^[0-9]*$/', $_GET["id"]); @@ -46,6 +46,7 @@ function page_output() $this->obj_menu_nav->add_item("Quote Items", "page=accounts/quotes/quotes-items.php&id=". $this->id ."", TRUE); $this->obj_menu_nav->add_item("Quote Journal", "page=accounts/quotes/journal.php&id=". $this->id .""); $this->obj_menu_nav->add_item("Export Quote", "page=accounts/quotes/quotes-export.php&id=". $this->id .""); + $this->obj_menu_nav->add_item("Create Project", "page=accounts/quotes/quotes-convert-project.php&id=". $this->id .""); $this->obj_menu_nav->add_item("Convert to Invoice", "page=accounts/quotes/quotes-convert.php&id=". $this->id .""); $this->obj_menu_nav->add_item("Delete Quote", "page=accounts/quotes/quotes-delete.php&id=". $this->id .""); diff --git a/accounts/quotes/quotes-items.php b/accounts/quotes/quotes-items.php index b2a1b2ef..294db685 100644 --- a/accounts/quotes/quotes-items.php +++ b/accounts/quotes/quotes-items.php @@ -22,7 +22,7 @@ class page_output var $obj_table_items; - function page_output() + function __construct() { $this->requires["css"][] = "include/accounts/css/invoice-items-edit.css"; // fetch quote ID @@ -38,6 +38,7 @@ function page_output() if (user_permissions_get("accounts_quotes_write")) { + $this->obj_menu_nav->add_item("Create Project", "page=accounts/quotes/quotes-convert-project.php&id=". $this->id .""); $this->obj_menu_nav->add_item("Convert to Invoice", "page=accounts/quotes/quotes-convert.php&id=". $this->id .""); $this->obj_menu_nav->add_item("Delete Quote", "page=accounts/quotes/quotes-delete.php&id=". $this->id .""); } diff --git a/accounts/quotes/quotes-view.php b/accounts/quotes/quotes-view.php index 0e15b068..0933e990 100644 --- a/accounts/quotes/quotes-view.php +++ b/accounts/quotes/quotes-view.php @@ -20,7 +20,7 @@ class page_output var $obj_form_quote; - function page_output() + function __construct() { // fetch quote ID $this->id = @security_script_input('/^[0-9]*$/', $_GET["id"]); @@ -35,6 +35,7 @@ function page_output() if (user_permissions_get("accounts_quotes_write")) { + $this->obj_menu_nav->add_item("Create Project", "page=accounts/quotes/quotes-convert-project.php&id=". $this->id .""); $this->obj_menu_nav->add_item("Convert to Invoice", "page=accounts/quotes/quotes-convert.php&id=". $this->id .""); $this->obj_menu_nav->add_item("Delete Quote", "page=accounts/quotes/quotes-delete.php&id=". $this->id .""); } diff --git a/accounts/reports/incomestatement.php b/accounts/reports/incomestatement.php index e5583487..d0355a27 100644 --- a/accounts/reports/incomestatement.php +++ b/accounts/reports/incomestatement.php @@ -232,6 +232,8 @@ function execute() $sql_obj->prepare_sql_addwhere("date_trans <= '". $this->date_end ."'"); } + // Only include uncancelled invoices only + $sql_obj->prepare_sql_addwhere("cancelled='0'"); // paid invoices only if ($this->mode == "Cash") diff --git a/accounts/taxes/delete.php b/accounts/taxes/delete.php index b5bee3f8..34001922 100644 --- a/accounts/taxes/delete.php +++ b/accounts/taxes/delete.php @@ -19,7 +19,7 @@ class page_output var $locked; - function page_output() + function __construct() { // fetch variables $this->id = @security_script_input('/^[0-9]*$/', $_GET["id"]); diff --git a/accounts/taxes/ledger.php b/accounts/taxes/ledger.php index 76c96a9c..f70ef09e 100644 --- a/accounts/taxes/ledger.php +++ b/accounts/taxes/ledger.php @@ -17,7 +17,7 @@ class page_output var $obj_sql_tax; - function page_output() + function __construct() { // fetch variables $this->id = @security_script_input('/^[0-9]*$/', $_GET["id"]); diff --git a/accounts/taxes/tax_collected.php b/accounts/taxes/tax_collected.php index 809f41be..ec143a81 100644 --- a/accounts/taxes/tax_collected.php +++ b/accounts/taxes/tax_collected.php @@ -19,7 +19,7 @@ class page_output var $obj_taxreport; - function page_output() + function __construct() { // fetch variables $this->id = @security_script_input('/^[0-9]*$/', $_GET["id"]); diff --git a/accounts/taxes/tax_paid.php b/accounts/taxes/tax_paid.php index db008bb6..73538366 100644 --- a/accounts/taxes/tax_paid.php +++ b/accounts/taxes/tax_paid.php @@ -20,7 +20,7 @@ class page_output var $obj_taxreport; - function page_output() + function __construct() { // fetch variables $this->id = @security_script_input('/^[0-9]*$/', $_GET["id"]); diff --git a/accounts/taxes/view.php b/accounts/taxes/view.php index a8c5829c..bf256d96 100644 --- a/accounts/taxes/view.php +++ b/accounts/taxes/view.php @@ -21,7 +21,7 @@ class page_output var $obj_form; - function page_output() + function __construct() { // fetch variables $this->id = @security_script_input('/^[0-9]*$/', $_GET["id"]); diff --git a/admin/config_application-process.php b/admin/config_application-process.php index 1140e7b4..3a7950ce 100644 --- a/admin/config_application-process.php +++ b/admin/config_application-process.php @@ -35,6 +35,7 @@ $data["ACCOUNTS_SERVICES_DATESHIFT"] = @security_form_input_predefined("int", "ACCOUNTS_SERVICES_DATESHIFT", 1, ""); $data["ACCOUNTS_TERMS_DAYS"] = @security_form_input_predefined("int", "ACCOUNTS_TERMS_DAYS", 0, ""); $data["ACCOUNTS_AUTOPAY"] = @security_form_input_predefined("checkbox", "ACCOUNTS_AUTOPAY", 0, ""); + $data["ACCOUNTS_CANCEL_DELETE"] = @security_form_input_predefined("checkbox", "ACCOUNTS_CANCEL_DELETE", 0, ""); $data["ACCOUNTS_EMAIL_ADDRESS"] = @security_form_input_predefined("email", "ACCOUNTS_EMAIL_ADDRESS", 1, ""); $data["ACCOUNTS_EMAIL_AUTOBCC"] = @security_form_input_predefined("checkbox", "ACCOUNTS_EMAIL_AUTOBCC", 1, ""); diff --git a/admin/config_application.php b/admin/config_application.php index 7c7db4f2..840df9d4 100644 --- a/admin/config_application.php +++ b/admin/config_application.php @@ -139,6 +139,12 @@ function execute() $structure["options"]["label"] = " Check to have invoices automatically paid where there is credit or reoccuring billing details."; $this->obj_form->add_input($structure); + $structure = NULL; + $structure["fieldname"] = "ACCOUNTS_CANCEL_DELETE"; + $structure["type"] = "checkbox"; + $structure["options"]["no_translate_fieldname"] = "yes"; + $structure["options"]["label"] = " Check to have invoices cancelled when 'deleted'. Uncheck for proper deletion."; + $this->obj_form->add_input($structure); // email options @@ -358,7 +364,7 @@ function execute() // define subforms $this->obj_form->subforms["config_defcodes"] = array("ACCOUNTS_AP_INVOICENUM", "ACCOUNTS_AR_INVOICENUM", "ACCOUNTS_GL_TRANSNUM", "ACCOUNTS_QUOTES_NUM", "ACCOUNTS_CREDIT_NUM", "CODE_ACCOUNT", "CODE_CUSTOMER", "CODE_VENDOR", "CODE_PRODUCT", "CODE_PROJECT", "CODE_STAFF"); - $this->obj_form->subforms["config_accounts"] = array("ACCOUNTS_SERVICES_ADVANCEBILLING", "ACCOUNTS_SERVICES_DATESHIFT", "ACCOUNTS_TERMS_DAYS", "ACCOUNTS_AUTOPAY"); + $this->obj_form->subforms["config_accounts"] = array("ACCOUNTS_SERVICES_ADVANCEBILLING", "ACCOUNTS_SERVICES_DATESHIFT", "ACCOUNTS_TERMS_DAYS", "ACCOUNTS_AUTOPAY", "ACCOUNTS_CANCEL_DELETE"); $this->obj_form->subforms["config_accounts_email"] = array("ACCOUNTS_EMAIL_ADDRESS", "ACCOUNTS_INVOICE_AUTOEMAIL", "ACCOUNTS_EMAIL_AUTOBCC", "ACCOUNTS_INVOICE_BATCHREPORT"); $this->obj_form->subforms["config_services_email"] = array("SERVICES_USAGEALERTS_ENABLE"); $this->obj_form->subforms["config_orders"] = array("ORDERS_BILL_ONSERVICE", "ORDERS_BILL_ENDOFMONTH"); diff --git a/admin/config_company-process.php b/admin/config_company-process.php index dcb34f3d..0198a5bc 100644 --- a/admin/config_company-process.php +++ b/admin/config_company-process.php @@ -29,9 +29,15 @@ $data["COMPANY_ADDRESS1_COUNTRY"] = @security_form_input_predefined("any", "COMPANY_ADDRESS1_COUNTRY", 1, ""); $data["COMPANY_ADDRESS1_ZIPCODE"] = @security_form_input_predefined("any", "COMPANY_ADDRESS1_ZIPCODE", 0, ""); $data["COMPANY_PAYMENT_DETAILS"] = @security_form_input_predefined("any", "COMPANY_PAYMENT_DETAILS", 1, ""); - - - + $data["COMPANY_TAX_NUMBER"] = @security_form_input_predefined("any", "COMPANY_TAX_NUMBER", 0, ""); + $data["COMPANY_REG_NUMBER"] = @security_form_input_predefined("any", "COMPANY_REG_NUMBER", 0, ""); + $data["COMPANY_ADDRESS2_STREET"] = @security_form_input_predefined("any", "COMPANY_ADDRESS2_STREET", 1, ""); + $data["COMPANY_ADDRESS2_CITY"] = @security_form_input_predefined("any", "COMPANY_ADDRESS2_CITY", 1, ""); + $data["COMPANY_ADDRESS2_STATE"] = @security_form_input_predefined("any", "COMPANY_ADDRESS2_STATE", 0, ""); + $data["COMPANY_ADDRESS2_COUNTRY"] = @security_form_input_predefined("any", "COMPANY_ADDRESS2_COUNTRY", 1, ""); + $data["COMPANY_ADDRESS2_ZIPCODE"] = @security_form_input_predefined("any", "COMPANY_ADDRESS2_ZIPCODE", 0, ""); + $data["COMPANY_B2C_TERMS"] = @security_form_input_predefined("html", "COMPANY_B2C_TERMS", 0,""); + $data["COMPANY_B2B_TERMS"] = @security_form_input_predefined("html", "COMPANY_B2B_TERMS", 0,""); /* Process company logo upload and verify content if any has been supplied. Enforce png only diff --git a/admin/config_company.php b/admin/config_company.php index a5511577..62be6d03 100644 --- a/admin/config_company.php +++ b/admin/config_company.php @@ -44,6 +44,18 @@ function execute() $structure["type"] = "input"; $structure["options"]["no_translate_fieldname"] = "yes"; $this->obj_form->add_input($structure); + + $structure = NULL; + $structure["fieldname"] = "COMPANY_REG_NUMBER"; + $structure["type"] = "input"; + $structure["options"]["no_translate_fieldname"] = "yes"; + $this->obj_form->add_input($structure); + + $structure = NULL; + $structure["fieldname"] = "COMPANY_TAX_NUMBER"; + $structure["type"] = "input"; + $structure["options"]["no_translate_fieldname"] = "yes"; + $this->obj_form->add_input($structure); $structure = NULL; $structure["fieldname"] = "COMPANY_CONTACT_EMAIL"; @@ -102,7 +114,64 @@ function execute() $structure["options"]["height"] = "60"; $structure["options"]["no_translate_fieldname"] = "yes"; $this->obj_form->add_input($structure); - + + $structure = NULL; + $structure["fieldname"] = "COMPANY_ADDRESS2_STREET"; + $structure["type"] = "textarea"; + $structure["options"]["width"] = "300"; + $structure["options"]["height"] = "60"; + $structure["options"]["no_translate_fieldname"] = "yes"; + $this->obj_form->add_input($structure); + + $structure = NULL; + $structure["fieldname"] = "COMPANY_ADDRESS2_CITY"; + $structure["type"] = "input"; + $structure["options"]["no_translate_fieldname"] = "yes"; + $this->obj_form->add_input($structure); + + $structure = NULL; + $structure["fieldname"] = "COMPANY_ADDRESS2_STATE"; + $structure["type"] = "input"; + $structure["options"]["no_translate_fieldname"] = "yes"; + $this->obj_form->add_input($structure); + + $structure = NULL; + $structure["fieldname"] = "COMPANY_ADDRESS2_COUNTRY"; + $structure["type"] = "input"; + $structure["options"]["no_translate_fieldname"] = "yes"; + $this->obj_form->add_input($structure); + + $structure = NULL; + $structure["fieldname"] = "COMPANY_ADDRESS2_ZIPCODE"; + $structure["type"] = "input"; + $structure["options"]["no_translate_fieldname"] = "yes"; + $this->obj_form->add_input($structure); + + $structure = NULL; + $structure["fieldname"] = "COMPANY_ADDRESS_MSG"; + $structure["type"] = "message"; + $structure["defaultvalue"] = "Enter the registered address of the company below, if different to the contact address."; + $structure["options"]["no_translate_fieldname"] = "yes"; + $this->obj_form->add_input($structure); + + $structure = NULL; + $structure["fieldname"] = "COMPANY_B2C_TERMS"; + $structure["type"] = "tinymce"; + $structure["options"]["width"] = 500; + $structure["options"]["height"] = 100; + $structure["options"]["no_translate_fieldname"] = "yes"; + $structure["options"]["css_field_class"] = "tinymce"; + $this->obj_form->add_input($structure); + + $structure = NULL; + $structure["fieldname"] = "COMPANY_B2B_TERMS"; + $structure["type"] = "tinymce"; + $structure["options"]["width"] = 500; + $structure["options"]["height"] = 100; + $structure["options"]["no_translate_fieldname"] = "yes"; + $structure["options"]["css_field_class"] = "tinymce"; + $this->obj_form->add_input($structure); + $structure = NULL; $structure["fieldname"] = "COMPANY_LOGO"; $structure["type"] = "file"; @@ -127,7 +196,8 @@ function execute() // define subforms $this->obj_form->subforms["config_company_details"] = array("COMPANY_NAME", "COMPANY_LOGO", "COMPANY_LOGO_MSG"); $this->obj_form->subforms["config_company_contact"] = array("COMPANY_CONTACT_EMAIL", "COMPANY_CONTACT_PHONE", "COMPANY_CONTACT_FAX", "COMPANY_ADDRESS1_STREET", "COMPANY_ADDRESS1_CITY","COMPANY_ADDRESS1_STATE","COMPANY_ADDRESS1_COUNTRY", "COMPANY_ADDRESS1_ZIPCODE"); - $this->obj_form->subforms["config_company_invoices"] = array("COMPANY_PAYMENT_DETAILS"); + $this->obj_form->subforms["config_company_registration"] = array("COMPANY_TAX_NUMBER","COMPANY_REG_NUMBER","COMPANY_ADDRESS_MSG","COMPANY_ADDRESS2_STREET","COMPANY_ADDRESS2_CITY","COMPANY_ADDRESS2_STATE","COMPANY_ADDRESS2_COUNTRY","COMPANY_ADDRESS2_ZIPCODE"); + $this->obj_form->subforms["config_company_terms"] = array("COMPANY_PAYMENT_DETAILS","COMPANY_B2C_TERMS","COMPANY_B2B_TERMS"); $this->obj_form->subforms["submit"] = array("submit"); if (error_check()) diff --git a/admin/templates.php b/admin/templates.php index 9d2cb431..5e4e69e1 100644 --- a/admin/templates.php +++ b/admin/templates.php @@ -14,7 +14,7 @@ class page_output var $email_template_array = array(); var $obj_sql_invoice_data = array(); - function page_output() + function __construct() { // define page dependencies $this->requires["css"][] = "include/admin/css/templates.css"; @@ -266,7 +266,7 @@ function render_html() print "You can adjust the PDFs generated by the Amberdms Billing System by using different templates - these templates may include different languages, different layouts or other styling effects.
"; - format_msgbox("info", "If you have made your own template you would like to contribute back or if you need customisation work, please contact support@amberdms.com for details and we will be happy to assist.
"); + //format_msgbox("info", "If you have made your own template you would like to contribute back or if you need customisation work, please contact support@amberdms.com for details and we will be happy to assist.
"); foreach ( $this->obj_sql_invoice_data as $invoice_type_name => $invoice_type_data ) diff --git a/customers/add.php b/customers/add.php index d5a6e438..eaf28ebc 100644 --- a/customers/add.php +++ b/customers/add.php @@ -14,7 +14,7 @@ class page_output var $num_contacts; var $tax_array = array(); - function page_output() + function __construct() { // required pages $this->requires["javascript"][] = "include/customers/javascript/addedit_customers.js"; @@ -103,6 +103,7 @@ function execute() $structure = NULL; $structure["fieldname"] = "contact_" .$i; $structure["type"] = "input"; + $structure["defaultvalue"] = ""; if (isset($_SESSION["error"]["contact_" .$i. "-error"])) { $structure["options"]["css_field_class"] = "hidden_form_field_error"; @@ -153,6 +154,7 @@ function execute() $structure = NULL; $structure["fieldname"] = "description_" .$i; $structure["type"] = "textarea"; + $structure["defaultvalue"] = ""; if (isset($_SESSION["error"]["contact_" .$i. "-error"])) { $structure["options"]["css_field_class"] = "hidden_form_field_error"; @@ -443,7 +445,7 @@ function render_html() { print ""; } - else if ($_SESSION["error"]["contact_" .$i. "-error"]) + else if (isset($_SESSION["error"]["contact_" .$i. "-error"])) { print ""; } @@ -459,7 +461,7 @@ function render_html() { print ""; } - else if ($_SESSION["error"]["contact_" .$i. "-error"]) + else if (isset($_SESSION["error"]["contact_" .$i. "-error"])) { print ""; } @@ -473,7 +475,7 @@ function render_html() $this->obj_form->render_field("num_records_$i"); print "]*>/gi,"[quote]"),c(/<\/blockquote>/gi,"[/quote]"),c(/
/gi,"\n"),c(/
/gi,"\n"),c(/
/gi,"\n"),c(//gi,""),c(/<\/p>/gi,"\n"),c(/ |\u00a0/gi," "),c(/"/gi,'"'),c(/</gi,"<"),c(/>/gi,">"),c(/&/gi,"&"),a},_punbb_bbcode2html:function(a){function c(b,c){a=a.replace(b,c)}return a=b.trim(a),c(/\n/gi,"
"),c(/\[b\]/gi,""),c(/\[\/b\]/gi,""),c(/\[i\]/gi,""),c(/\[\/i\]/gi,""),c(/\[u\]/gi,""),c(/\[\/u\]/gi,""),c(/\[url=([^\]]+)\](.*?)\[\/url\]/gi,'$2'),c(/\[url\](.*?)\[\/url\]/gi,'$1'),c(/\[img\](.*?)\[\/img\]/gi,''),c(/\[color=(.*?)\](.*?)\[\/color\]/gi,'$2'),c(/\[code\](.*?)\[\/code\]/gi,'$1 '),c(/\[quote.*?\](.*?)\[\/quote\]/gi,'$1 '),a}}}),function(){}}),d("0")()}(); \ No newline at end of file diff --git a/external/tinymce/js/tinymce/plugins/charmap/plugin.min.js b/external/tinymce/js/tinymce/plugins/charmap/plugin.min.js new file mode 100644 index 00000000..3fd9e23d --- /dev/null +++ b/external/tinymce/js/tinymce/plugins/charmap/plugin.min.js @@ -0,0 +1 @@ +!function(){var a={},b=function(b){for(var c=a[b],e=c.deps,f=c.defn,g=e.length,h=new Array(g),i=0;i
';var i=g(),j=Math.min(i.length,25),k=Math.ceil(i.length/j);for(e=0;e ",d=0;d ";var o={type:"container",html:c,onclick:function(a){var c=a.target;if(/^(TD|DIV)$/.test(c.nodeName)){var d=b(c).firstChild;d&&d.hasAttribute("data-chr")&&(h(d.getAttribute("data-chr")),a.ctrlKey||f.close())}},onmouseover:function(a){var c=b(a.target);c&&c.firstChild?(f.find("#preview").text(c.firstChild.firstChild.data),f.find("#previewTitle").text(c.title)):(f.find("#preview").text(" "),f.find("#previewTitle").text(" "))}};f=a.windowManager.open({title:"Special character",spacing:10,padding:10,items:[o,{type:"container",layout:"flex",direction:"column",align:"center",spacing:5,minWidth:160,minHeight:160,items:[{type:"label",name:"preview",text:" ",style:"font-size: 40px; text-align: center",border:1,minWidth:140,minHeight:80},{type:"spacer",minHeight:20},{type:"label",name:"previewTitle",text:" ",style:"white-space: pre-wrap;",border:1,minWidth:140}]}],buttons:[{text:"Close",onclick:function(){f.close()}}]})}var j=b.isArray;return a.addCommand("mceShowCharmap",i),a.addButton("charmap",{icon:"charmap",tooltip:"Special character",cmd:"mceShowCharmap"}),a.addMenuItem("charmap",{icon:"charmap",text:"Special character",cmd:"mceShowCharmap",context:"insert"}),{getCharMap:g,insertChar:h}}),function(){}}),d("0")()}(); \ No newline at end of file diff --git a/external/tinymce/js/tinymce/plugins/code/plugin.min.js b/external/tinymce/js/tinymce/plugins/code/plugin.min.js new file mode 100644 index 00000000..7a0437ed --- /dev/null +++ b/external/tinymce/js/tinymce/plugins/code/plugin.min.js @@ -0,0 +1 @@ +!function(){var a={},b=function(b){for(var c=a[b],e=c.deps,f=c.defn,g=e.length,h=new Array(g),i=0;i '+n+""}else c+=""}c+=""}c+=" code[class*="language-"], +pre[class*="language-"] { + background: #f5f2f0; +} + +/* Inline code */ +:not(pre) > code[class*="language-"] { + padding: .1em; + border-radius: .3em; +} + +.token.comment, +.token.prolog, +.token.doctype, +.token.cdata { + color: slategray; +} + +.token.punctuation { + color: #999; +} + +.namespace { + opacity: .7; +} + +.token.property, +.token.tag, +.token.boolean, +.token.number, +.token.constant, +.token.symbol, +.token.deleted { + color: #905; +} + +.token.selector, +.token.attr-name, +.token.string, +.token.char, +.token.builtin, +.token.inserted { + color: #690; +} + +.token.operator, +.token.entity, +.token.url, +.language-css .token.string, +.style .token.string { + color: #a67f59; + background: hsla(0, 0%, 100%, .5); +} + +.token.atrule, +.token.attr-value, +.token.keyword { + color: #07a; +} + +.token.function { + color: #DD4A68; +} + +.token.regex, +.token.important, +.token.variable { + color: #e90; +} + +.token.important, +.token.bold { + font-weight: bold; +} +.token.italic { + font-style: italic; +} + +.token.entity { + cursor: help; +} + diff --git a/external/tinymce/js/tinymce/plugins/codesample/plugin.min.js b/external/tinymce/js/tinymce/plugins/codesample/plugin.min.js new file mode 100644 index 00000000..a0285edc --- /dev/null +++ b/external/tinymce/js/tinymce/plugins/codesample/plugin.min.js @@ -0,0 +1 @@ +!function(){var a={},b=function(b){for(var c=a[b],e=c.deps,f=c.defn,g=e.length,h=new Array(g),i=0;i a.length)break a;if(!(q instanceof e)){k.lastIndex=0;var r=k.exec(q);if(r){m&&(n=r[1].length);var s=r.index-1+n,r=r[0].slice(n),t=r.length,u=s+t,v=q.slice(0,s+1),w=q.slice(u+1),x=[p,1];v&&x.push(v);var y=new e(h,l?c.tokenize(r,l):r,o);x.push(y),w&&x.push(w),Array.prototype.splice.apply(f,x)}}}}}return f},hooks:{all:{},add:function(a,b){var d=c.hooks.all;d[a]=d[a]||[],d[a].push(b)},run:function(a,b){var d=c.hooks.all[a];if(d&&d.length)for(var e,f=0;e=d[f++];)e(b)}}},d=c.Token=function(a,b,c){this.type=a,this.content=b,this.alias=c};if(d.stringify=function(a,b,e){if("string"==typeof a)return a;if("Array"===c.util.type(a))return a.map(function(c){return d.stringify(c,b,a)}).join("");var f={type:a.type,content:d.stringify(a.content,b,e),tag:"span",classes:["token",a.type],attributes:{},language:b,parent:e};if("comment"==f.type&&(f.attributes.spellcheck="true"),a.alias){var g="Array"===c.util.type(a.alias)?a.alias:[a.alias];Array.prototype.push.apply(f.classes,g)}c.hooks.run("wrap",f);var h="";for(var i in f.attributes)h+=(h?" ":"")+i+'="'+(f.attributes[i]||"")+'"';return"<"+f.tag+' class="'+f.classes.join(" ")+'" '+h+">"+f.content+""+f.tag+">"},!b.document)return b.addEventListener?(b.addEventListener("message",function(a){var d=JSON.parse(a.data),e=d.language,f=d.code,g=d.immediateClose;b.postMessage(c.highlight(f,c.languages[e],e)),g&&b.close()},!1),b.Prism):b.Prism}();return"undefined"!=typeof module&&module.exports&&(module.exports=c),"undefined"!=typeof global&&(global.Prism=c),c.languages.markup={comment://,prolog:/<\?[\w\W]+?\?>/,doctype://,cdata://i,tag:{pattern:/<\/?[^\s>\/=.]+(?:\s+[^\s>\/=]+(?:=(?:("|')(?:\\\1|\\?(?!\1)[\w\W])*\1|[^\s'">=]+))?)*\s*\/?>/i,inside:{tag:{pattern:/^<\/?[^\s>\/]+/i,inside:{punctuation:/^<\/?/,namespace:/^[^\s>\/:]+:/}},"attr-value":{pattern:/=(?:('|")[\w\W]*?(\1)|[^\s>]+)/i,inside:{punctuation:/[=>"']/}},punctuation:/\/?>/,"attr-name":{pattern:/[^\s>\/]+/,inside:{namespace:/^[^\s>\/:]+:/}}}},entity:/?[\da-z]{1,8};/i},c.hooks.add("wrap",function(a){"entity"===a.type&&(a.attributes.title=a.content.replace(/&/,"&"))}),c.languages.xml=c.languages.markup,c.languages.html=c.languages.markup,c.languages.mathml=c.languages.markup,c.languages.svg=c.languages.markup,c.languages.css={comment:/\/\*[\w\W]*?\*\//,atrule:{pattern:/@[\w-]+?.*?(;|(?=\s*\{))/i,inside:{rule:/@[\w-]+/}},url:/url\((?:(["'])(\\(?:\r\n|[\w\W])|(?!\1)[^\\\r\n])*\1|.*?)\)/i,selector:/[^\{\}\s][^\{\};]*?(?=\s*\{)/,string:/("|')(\\(?:\r\n|[\w\W])|(?!\1)[^\\\r\n])*\1/,property:/(\b|\B)[\w-]+(?=\s*:)/i,important:/\B!important\b/i,"function":/[-a-z0-9]+(?=\()/i,punctuation:/[(){};:]/},c.languages.css.atrule.inside.rest=c.util.clone(c.languages.css),c.languages.markup&&(c.languages.insertBefore("markup","tag",{style:{pattern:/