Cleanup.
[fa-stable.git] / inventory / includes / db / items_transfer_db.inc
index 73fe3ae60330a3e3049bccfeb2541cac042886ff..da1ceec24b43fbfb1a1c6fd52fbfd3113edf67af 100644 (file)
@@ -1,21 +1,23 @@
 <?php
 /**********************************************************************
     Copyright (C) FrontAccounting, LLC.
-       Released under the terms of the GNU Affero General Public License,
-       AGPL, as published by the Free Software Foundation, either version 
-       of the License, or (at your option) any later version.
+       Released under the terms of the GNU General Public License, GPL, 
+       as published by the Free Software Foundation, either version 3 
+       of the License, or (at your option) any later version.
     This program is distributed in the hope that it will be useful,
     but WITHOUT ANY WARRANTY; without even the implied warranty of
     MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  
-    See the License here <http://www.gnu.org/licenses/agpl-3.0.html>.
+    See the License here <http://www.gnu.org/licenses/gpl-3.0.html>.
 ***********************************************************************/
 //-------------------------------------------------------------------------------------------------------------
 
 function add_stock_transfer($Items, $location_from, $location_to, $date_, $type, $reference, $memo_)
 {
+       global $Refs;
+
        begin_transaction();
 
-       $transfer_id = get_next_trans_no(systypes::location_transfer());
+       $transfer_id = get_next_trans_no(ST_LOCTRANSFER);
 
        foreach ($Items as $line_item)
        {
@@ -23,9 +25,10 @@ function add_stock_transfer($Items, $location_from, $location_to, $date_, $type,
                        $location_to, $date_, $type, $reference, $line_item->quantity);
        }
 
-       add_comments(systypes::location_transfer(), $transfer_id, $date_, $memo_);
+       add_comments(ST_LOCTRANSFER, $transfer_id, $date_, $memo_);
 
-       references::save_last($reference, systypes::location_transfer());
+       $Refs->save(ST_LOCTRANSFER, $transfer_id, $reference);
+       add_audit_trail(ST_LOCTRANSFER, $transfer_id, $date_);
 
        commit_transaction();
 
@@ -42,10 +45,10 @@ function add_stock_transfer($Items, $location_from, $location_to, $date_, $type,
 function add_stock_transfer_item($transfer_id, $stock_id, $location_from, $location_to,
        $date_, $type, $reference, $quantity)
 {
-       add_stock_move(systypes::location_transfer(), $stock_id, $transfer_id, $location_from,
+       add_stock_move(ST_LOCTRANSFER, $stock_id, $transfer_id, $location_from,
                $date_, $reference, -$quantity, 0, $type);
 
-       add_stock_move(systypes::location_transfer(), $stock_id, $transfer_id, $location_to,
+       add_stock_move(ST_LOCTRANSFER, $stock_id, $transfer_id, $location_to,
                $date_, $reference, $quantity, 0, $type);
 
 }
@@ -77,7 +80,7 @@ function get_stock_transfer($trans_no)
 
 function get_stock_transfer_items($trans_no)
 {
-       $result = get_stock_moves(systypes::location_transfer(), $trans_no);
+       $result = get_stock_moves(ST_LOCTRANSFER, $trans_no);
 
        if (db_num_rows($result) == 0)
        {
@@ -91,7 +94,7 @@ function get_stock_transfer_items($trans_no)
 
 function void_stock_transfer($type_no)
 {
-       void_stock_move(systypes::location_transfer(), $type_no);
+       void_stock_move(ST_LOCTRANSFER, $type_no);
 }
 
 ?>
\ No newline at end of file