if ($obj_gl->data["code_gl"]) {
                     if (!$obj_gl->verify_code_gl()) {
                         // TODO: ?? Is this check even useful?
                     }
                 }
                 // verify transaction data
                 if ($obj_gl->data["num_trans"]) {
                     if (!$obj_gl->verify_valid_trans()) {
                         // TODO: ??
                     }
                 }
                 /*
                 	Update Database
                 */
                 if (!error_check()) {
                     $obj_gl->action_update();
                 }
                 unset($obj_gl);
                 unset($account);
                 unset($data);
                 break;
             default:
                 /*
                 	Unknown/System Failure
                 */
                 log_write("error", "process", "Unknown transaction type \"{$type}\" could not be processed");
                 break;
         }
         // end of case type
     }
 }
示例#2
0
 function set_gl_save($id)
 {
     log_debug("accounts_gl_manage", "Executing set_gl_save({$id})");
     if (user_permissions_get("accounts_gl_write")) {
         $obj_gl = new gl_transaction();
         /*
         	Load SOAP Data
         */
         if (!preg_match("/^[0-9]*\$/", $obj_gl->id)) {
             throw new SoapFault("Sender", "INVALID_INPUT");
         }
         /*
         	Load temporary stored data
         */
         $obj_gl->data = $this->data;
         /*
         	Error Handling
         */
         // verify transaction ID (if editing an existing transaction)
         if ($obj_gl->id) {
             if (!$obj_gl->verify_id()) {
                 throw new SoapFault("Sender", "INVALID_ID");
             }
             // make sure transaction is not locked
             if ($obj_gl->checklock()) {
                 throw new SoapFault("Sender", "LOCKED");
             }
         }
         // make sure we don't choose a code_gl that has already been taken
         if (!$obj_gl->verify_code_gl()) {
             throw new SoapFault("Sender", "DUPLICATE_CODE_GL");
         }
         // verify all the transaction rows
         $result = $obj_gl->verify_valid_trans();
         if ($result == 0) {
             throw new SoapFault("Sender", "UNBALANCED_TRANSACTIONS");
         } elseif ($result == -1) {
             throw new SoapFault("Sender", "MISSING_TRANS_DATA");
         }
         /*
         	Perform Changes
         */
         if ($obj_gl->action_update()) {
             // clear the prepared data
             $this->data = array();
             return $obj_gl->id;
         } else {
             throw new SoapFault("Sender", "UNEXPECTED_ACTION_ERROR");
         }
     } else {
         throw new SoapFault("Sender", "ACCESS DENIED");
     }
 }