Established new hooks class convention.
authorJanusz Dobrowolski <janusz@frontaccounting.eu>
Sat, 13 Nov 2010 09:38:27 +0000 (09:38 +0000)
committerJanusz Dobrowolski <janusz@frontaccounting.eu>
Sat, 13 Nov 2010 09:38:27 +0000 (09:38 +0000)
CHANGELOG.txt
includes/hooks.inc
includes/session.inc
lang/new_language_template/locale.inc

index 400810108f7e9c3332324e5aef95e0846e3bf56a..e915fb21a2a335cb7f12393084d94450154a16c6 100644 (file)
@@ -19,6 +19,34 @@ Legend:
 ! -> Note
 $ -> Affected files
 
+13-Nov-2010 Janusz Dobrowolski
++ New hooks system added
+$ /includes/hooks.inc (new)
+  /includes/session.inc
+  /lang/new_language_template/locale.inc
+! Old hooks converted to new hooks API
+$ /gl/includes/db/gl_db_rates.inc
+  /includes/ui/ui_view.inc
+  /reporting/rep709.php
++ Added transaction db_write/db_void hooks
+$ /gl/includes/db/gl_db_banking.inc
+  /inventory/includes/db/items_adjust_db.inc
+  /inventory/includes/db/items_transfer_db.inc
+  /manufacturing/includes/db/work_order_issues_db.inc
+  /manufacturing/includes/db/work_order_produce_items_db.inc
+  /manufacturing/includes/db/work_orders_db.inc
+  /manufacturing/includes/db/work_orders_quick_db.inc
+  /purchasing/po_entry_items.php
+  /purchasing/includes/db/grn_db.inc
+  /purchasing/includes/db/invoice_db.inc
+  /purchasing/includes/db/po_db.inc
+  /purchasing/includes/db/supp_payment_db.inc
+  /sales/includes/db/payment_db.inc
+  /sales/includes/db/sales_credit_db.inc
+  /sales/includes/db/sales_delivery_db.inc
+  /sales/includes/db/sales_invoice_db.inc
+  /sales/includes/db/sales_order_db.inc
+
 12-Nov-2010 Janusz Dobrowolski
 # Added missing due date on direct purchase invoice.
 $ /purchasing/po_entry_items.php
@@ -31,7 +59,7 @@ $ /purchasing/po_entry_items.php
 $ /inventory/manage/items.php
 # Fixed a couple of edition ui bugs
 $ /gl/manage/gl_quick_entries.php
-+ Added db_close() for optional use
++ Added db_close() for optional  use
 $ /includes/db/connect_db.inc
 
 11-Nov-2010 Janusz Dobrowolski
index 91ab8427bf72c88af76fd5114bc4dd9bb643b977..079d834ae186ca291d4d1c7d51f464f553137c73 100644 (file)
@@ -9,7 +9,7 @@
     MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  
     See the License here <http://www.gnu.org/licenses/gpl-3.0.html>.
 ***********************************************************************/
-class Hook{
+class hooks {
        //
        // Price in words. $doc_type is set to document type and can be used to suppress 
        // price in words printing for selected document types.
index 72ff7cdb129d9c8ed128ac4f3dd03741a6838919..612957ae2f8777ca05aa413b090387f559686d77 100644 (file)
@@ -213,7 +213,10 @@ $Hooks = array();
 if (file_exists($path_to_root . "/lang/".$_SESSION['language']->code."/locale.inc"))
 {
        include_once($path_to_root . "/lang/".$_SESSION['language']->code."/locale.inc");
-       $Hooks[] = new Hooks();
+       $code = $_SESSION['language']->code;
+       $hook_class = 'hooks_'.$code;
+       $Hooks[$code] = new $hook_class;
+       unset($code, $hook_class);
 }
 
 include_once($path_to_root . "/includes/access_levels.inc");
index ad1e5d88110666113cd0e414545a93feeafda47b..3e3a7c4e8d0e33cf5fe3174b777cb3aa7df6f756 100644 (file)
        If your locale needs special functionality provided by hook functions
        copy this file to respective lang/xx_XX directory and edit templates below.
        You can safely remove not used function templates.
+       
+       Name it after language code e.g. hooks_en_US
 */
-class Hooks {
+class hooks_xx_XX extends hooks {
 /*
        //
        // Price in words. $doc_type is set to document type and can be used to suppress