From: Janusz Dobrowolski Date: Sun, 13 Jun 2010 18:37:54 +0000 (+0000) Subject: Documents inheritance added. X-Git-Tag: v2.4.2~19^2~858 X-Git-Url: https://delta.frontaccounting.com/gitweb/?a=commitdiff_plain;h=1e7b8219f088f069b70d7ede70c4d01d39288b08;p=fa-stable.git Documents inheritance added. --- diff --git a/includes/types.inc b/includes/types.inc index 570f0c68..35ed2d84 100644 --- a/includes/types.inc +++ b/includes/types.inc @@ -47,6 +47,31 @@ define('ST_DIMENSION', 40); define ('ST_STATEMENT', 91); define ('ST_CHEQUE', 92); +// document inheritance +$document_child_types = array( + ST_SALESQUOTE => ST_SALESORDER, + ST_SALESORDER => ST_CUSTDELIVERY, + ST_CUSTDELIVERY => ST_SALESINVOICE, + ST_SALESINVOICE => ST_CUSTCREDIT, + + ST_PURCHORDER => ST_SUPPRECEIVE, + ST_SUPPRECEIVE => ST_SUPPINVOICE, + ST_SUPPINVOICE => ST_SUPPCREDIT, +); + +function get_child_type($type) +{ + global $document_child_types; + return isset($document_child_types[$type]) ? $document_child_types[$type] : 0; +} + +function get_parent_type($type) +{ + global $document_child_types; + $child = array_search($type, $document_child_types); + return $child ? $child : 0; +} + //---------------------------------------------------------------------------------- // Bank transaction types //