}
     unset($item);
     unset($data);
     break;
 case "transfer":
 case "bank_fee":
 case "interest":
     /*
     	TRANSFER / BANK_FEE / INTEREST
     
     	These transaction types are all basic GL transactions, we just need to validate to/from accounts
     	and to create the transaction.
     */
     $account = array();
     $data = array();
     $obj_gl = new gl_transaction();
     if ($type == "transfer") {
         //determine to and from account
         $transferto = @security_form_input_predefined("int", $name . "-transferto", 1, "");
         $transferfrom = @security_form_input_predefined("int", $name . "-transferfrom", 1, "");
         $account['origin'] = $transferto;
         $account['destination'] = $transferfrom;
     } else {
         if ($type == "bank_fee") {
             //determine expense and asset account
             $bankfeeexpense = @security_form_input_predefined("int", $name . "-bankfeesexpense", 1, "");
             $bankfeeasset = @security_form_input_predefined("int", $name . "-bankfeesasset", 1, "");
             $account['origin'] = $bankfeeasset;
             $account['destination'] = $bankfeeexpense;
         } else {
             //determine asset, expense, and income account
Esempio n. 2
0
<?php

/*
	accounts/gl/delete-process.php

	access: account_gl_write

	Deletes a transaction, provided that it has not been locked.
*/
// includes
require "../../include/config.php";
require "../../include/amberphplib/main.php";
// custom includes
require "../../include/accounts/inc_gl.php";
if (user_permissions_get('accounts_gl_write')) {
    $obj_gl = new gl_transaction();
    /*
    	Import POST Data
    */
    $obj_gl->id = @security_form_input_predefined("int", "id_transaction", 1, "");
    // these exist to make error handling work right
    $obj_gl->data["code_gl"] = @security_form_input_predefined("any", "code_gl", 0, "");
    $obj_gl->data["description"] = @security_form_input_predefined("any", "description", 0, "");
    // confirm deletion
    $obj_gl->data["delete_confirm"] = @security_form_input_predefined("any", "delete_confirm", 1, "You must confirm the deletion");
    /*
    	Error Handling
    */
    // make sure the transaction actually exists
    if (!$obj_gl->verify_id()) {
        log_write("error", "process", "The transaction you have attempted to edit - " . $obj_gl->id . " - does not exist in this system.");
Esempio n. 3
0
 function delete_gl($id)
 {
     log_debug("gl_manage_soap", "Executing delete_gl({$id})");
     if (user_permissions_get("accounts_gl_write")) {
         $obj_gl = new gl_transaction();
         /*
         	Load SOAP Data
         */
         $obj_gl->id = @security_script_input_predefined("int", $id);
         if (!$obj_gl->id || $obj_gl->id == "error") {
             throw new SoapFault("Sender", "INVALID_INPUT");
         }
         /*
         	Error Handling
         */
         // verify transaction ID
         if (!$obj_gl->verify_id()) {
             throw new SoapFault("Sender", "INVALID_ID");
         }
         // check that the transaction can be safely deleted
         if ($obj_gl->check_delete_lock()) {
             throw new SoapFault("Sender", "LOCKED");
         }
         /*
         	Perform Changes
         */
         if ($obj_gl->action_delete()) {
             return 1;
         } else {
             throw new SoapFault("Sender", "UNEXPECTED_ACTION_ERROR");
         }
     } else {
         throw new SoapFault("Sender", "ACCESS DENIED");
     }
 }
Esempio n. 4
0
/*
	accounts/transactions/edit-process.php

	access: accounts_gl_write

	Allows existing accounts to be modified or new accounts to be created
*/
// includes
require "../../include/config.php";
require "../../include/amberphplib/main.php";
// custom includes
require "../../include/accounts/inc_ledger.php";
require "../../include/accounts/inc_gl.php";
if (user_permissions_get('accounts_gl_write')) {
    $obj_gl = new gl_transaction();
    /*
    	Import POST Data
    */
    $obj_gl->id = @security_form_input_predefined("int", "id_transaction", 0, "");
    // general details
    $obj_gl->data["code_gl"] = @security_form_input_predefined("any", "code_gl", 0, "");
    $obj_gl->data["date_trans"] = @security_form_input_predefined("date", "date_trans", 1, "");
    $obj_gl->data["employeeid"] = @security_form_input_predefined("any", "employeeid", 1, "");
    $obj_gl->data["description"] = @security_form_input_predefined("any", "description", 1, "");
    $obj_gl->data["description_useall"] = @security_form_input_predefined("any", "description_useall", 0, "");
    $obj_gl->data["notes"] = @security_form_input_predefined("any", "notes", 0, "");
    // transaction rows
    $obj_gl->data["num_trans"] = @security_form_input_predefined("int", "num_trans", $required, "");
    for ($i = 0; $i < $obj_gl->data["num_trans"]; $i++) {
        $obj_gl->data["trans"][$i]["account"] = @security_form_input_predefined("int", "trans_" . $i . "_account", 0, "");