// FOR A PARTICULAR PURPOSE. See the GNU General Public License for more // details. // // You should have received a copy of the GNU General Public License along with // this program. If not, see <http://www.gnu.org/licenses/>. // require_once '../../htdocs/inc/sso.php'; require_once '../../htdocs/inc/smarty.php'; try { // Check arguments if (empty($_GET['company_id'])) { throw new Exception('Missing argument'); } // Check permissions $company = new WebfinanceCompany($_GET['company_id']); $company->ValidatePermission($_SESSION['cybsso_user']['email']); // Display localized amounts and dates foreach (array(LC_MESSAGES, LC_TIME, LC_MONETARY, LC_CTYPE) as $locale) { setlocale($locale, $_SESSION['cybsso_user']['language'] . ".UTF-8") or die("locale {$locale} language failed {$_SESSION['cybsso_user']}[language]"); } $user = new WebfinanceUser($_SESSION['cybsso_user']['email']); $smarty->assign('this_company_id', $_GET['company_id']); $smarty->assign('companies', $user->GetCompanies()); $smarty->assign('company_info', $company->GetInfo()); $smarty->assign('invoices', $company->InvoicesGet()); } catch (SoapFault $fault) { $smarty->assign('error', $fault->getMessage()); } catch (Exception $fault) { $smarty->assign('error', $fault->getMessage()); } $smarty->display('company/index.tpl');
function testInvoicesGetEmpty() { $email = '*****@*****.**'; WebfinanceUser::Create($email); $company = array('name' => 'ACME', 'address1' => '1110 Gateway Drive', 'zip_code' => 'CA 94404', 'city' => 'San Mateo', 'country' => 'US', 'email' => $email); $company_id = WebfinanceCompany::Create($company); $company = new WebfinanceCompany($company_id); $invoice = array('type' => 'invoice', 'paid' => false, 'vat' => 20.0, 'period' => 'none', 'delivery' => 'email', 'payment_method' => 'unknown', 'items' => array(0 => array('description' => 'the item description', 'price' => 123.32, 'quantity' => 3))); $company->InvoiceCreate($invoice); $invoices = $company->InvoicesGet(); $this->assertEquals($invoice['type'], $invoices[0]['type']); $this->assertEquals($invoice['vat'], $invoices[0]['vat']); $this->assertEquals($invoice['paid'], $invoices[0]['paid']); $this->assertEquals($invoice['period'], $invoices[0]['period']); $this->assertEquals($invoice['delivery'], $invoices[0]['delivery']); $this->assertEquals($invoice['items'], $invoices[0]['items']); }