/**
  * @depends testGetAll
  */
 public function testGetById($objects)
 {
     $at = getenv("BB_ACCESS_TOKEN");
     $object = $objects[0];
     $object = AccountGroup::getById($at, $object->id);
     $this->assertInstanceOf('\\ClausConrad\\BillysBilling\\AccountGroup', $object, "getById returns an instance.");
     return $object;
 }
 /**
  * Deleting an object by its ID should not fail.
  */
 public function testDeleteById()
 {
     $at = getenv("BB_ACCESS_TOKEN");
     $accountGroups = AccountGroup::getAll($at);
     $accountGroup = $accountGroups[0];
     $object = new Account($at, 'newAccountName', $accountGroup->id);
     $object->save();
     Account::deleteById($at, $object->id);
 }
Beispiel #3
0
 public function getInputForm()
 {
     global $mandatorysign, $defaultorganization_id;
     $accoptionlist = $this->getSelectPlaceHolderAccounts(0);
     include "class/AccountGroup.php";
     $ag = new AccountGroup();
     $accgroupoptionlist = $ag->getSelectAccountGroup(0);
     $accountypeoption = $this->returnAccountsTypeXML(1);
     return "\r\n   <div id='errormsg' class='red' style='display:none'></div>\r\n        <A href=javascript:addChildAccounts(0)>[Add New]</a><br/>\r\n    <form onsubmit='return false' action='accounts.php' id='frmAccount' name='frmAccount'>\r\n       <table>\r\n    <tbody>\r\n    \r\n <tr>\r\n        <td class='head'>Accounts Code {$mandatorysign}</td>\r\n        <td class='even' >\r\n\t\r\n\t<input maxlength='7' size='7' id='accountcode_full' value='{$this->accountcode_full}'\r\n                onchange= validate(this.value,'numeric','',this)   onblur= validate(this.value,'numeric','',this)></td>\r\n      </tr>\r\n <tr>\r\n        <td class='head'>Accounts Name {$mandatorysign}</td>\r\n        <td class='even'>\r\n                <input maxlength='60' size='30' id='accounts_name' value='{$this->accounts_name}'\r\n                     onchange=validate(this.value,'text','',this)  onblur=validate(this.value,'text','',this)></td>\r\n      </tr>\r\n <tr>\r\n        <td class='head'>Accounts Group {$mandatorysign}</td>\r\n        <td class='even'><select id='accountgroup_id' >{$accgroupoptionlist}</select></td>\r\n      </tr>\r\n\r\n <tr>\r\n        <td class='head'>Account Type</td>\r\n        <td class='even' >\r\n                <select id='account_type'>{$accountypeoption}</select>\r\n\t</td>\r\n      </tr>\r\n\r\n\r\n    <tr>\r\n        <td class='head'>Parent Account</td>\r\n        <td class='even' >\r\n                <select id='parentaccounts_id' onfocus=refreshparentaccountlist(this.value)>\r\n                    {$accoptionlist}\r\n                </select>\r\n            </td>\r\n      </tr>\r\n      <tr>\r\n   \t<td class='head'>Default Level {$mandatorysign}</td>\r\n\t        <td class='even' ><input maxlength='3' size='3' id='defaultlevel'  value=10\r\n                    value='{$this->defaultlevel}'  validate(this.value,numeric,'',this)>\r\n\t</td>\r\n      </tr>\r\n\r\n <tr>\r\n        <td class='head'>Place Holder</td>\r\n        <td class='even'><input type='checkbox' id='placeholder'></td>\r\n      </tr>\r\n      <tr>\r\n        <td class='head'>Hide</td>\r\n        <td class='even'><input type='checkbox' id='ishide'></td>\r\n      </tr>\r\n    <tr>\r\n        <td class='head'>Description</td>\r\n        <td class='even'><textarea id='description' cols='30'>{$this->description}</textarea></td>\r\n      </tr>\r\n    </tbody>\r\n  </table>\r\n\r\n            <input id='tax_id' value='0' title='tax_id' type='hidden'>\r\n            <input id='accounts_id' value='0'  title='accounts_id' type='hidden'>\r\n            <input id='organization_id' value='{$defaultorganization_id}' type='hidden'  title='organization_id'>\r\n        <input name='save' onclick='saverecord()' type='submit' id='submit' value='Save'>\r\n        <input name='save' onclick='deleterecord()' type='button' id='delete' value='Delete'>\r\n</form>";
 }
Beispiel #4
0
        echo $o->getSelectPlaceHolderAccounts($o->accounts_id);
        break;
    case "ajaxselectaccounttype":
        $accounttype = $_GET['account_type'];
        if ($accounttype == "") {
            $accounttype = 1;
        }
        echo $o->returnAccountsTypeXML($accounttype);
        break;
    case "ajaxselectaccountgroup":
        $accountgroup_id = $_GET['accountgroup_id'];
        if ($accountgroup_id == "") {
            $accountgroup_id = 0;
        }
        include "class/AccountGroup.php";
        $ag = new AccountGroup();
        $accgroupoptionlist = $ag->getSelectAccountGroup($accountgroup_id);
        echo $accgroupoptionlist;
        break;
    default:
        $xoTheme->addStylesheet("{$url}/modules/simantz/include/window.css");
        $xoTheme->addStylesheet("{$url}/modules/simantz/include/popup.css");
        $xoTheme->addScript("{$url}/modules/simantz/include/popup.js");
        $xoTheme->addScript('browse.php?Frameworks/jquery/jquery.js');
        include "menu.php";
        $accountslist = $o->showChildAccountTree(0, 0);
        $formname = $o->getInputForm(0);
        echo <<<EOF
    <script>

    function reloadAccounts(){
<?php

include "system.php";
include "menu.php";
include_once 'class/Log.php';
include_once 'class/AccountGroup.php';
include_once 'class/SelectCtrl.php';
error_reporting(E_ERROR | E_WARNING | E_PARSE | E_NOTICE);
$log = new Log();
$o = new AccountGroup();
$s = new XoopsSecurity();
$ctrl = new SelectCtrl();
$orgctrl = "";
$action = "";
echo <<<EOF
<script type="text/javascript">
function autofocus(){
document.forms['frmAccountGroup'].accountgroup_name.focus();
}
function IsNumeric(sText)
{
   var ValidChars = "0123456789.-";
   var IsNumber=true;
   var Char;

 
   for (i = 0; i < sText.length && IsNumber == true; i++) 
      { 
      Char = sText.charAt(i); 
      if (ValidChars.indexOf(Char) == -1) 
         {