X-Git-Url: http://wagnertech.de/gitweb/gitweb.cgi/timetracker.git/blobdiff_plain/098a79f0819ebb89b7d48df4a6b154af4560f68e..4df61856250643178176215235ffe106cb3cb4ea:/invoice_add.php diff --git a/invoice_add.php b/invoice_add.php index 4a25ddc1..0ee614f9 100644 --- a/invoice_add.php +++ b/invoice_add.php @@ -73,27 +73,26 @@ if ($request->getMethod() == 'POST') { if (!ttValidDate($cl_finish)) $errors->add($i18n->getKey('error.field'), $i18n->getKey('label.end_date')); $fields = array('date'=>$cl_date,'name'=>$cl_number,'client_id'=>$cl_client,'project_id'=>$cl_project,'start_date'=>$cl_start,'end_date'=>$cl_finish); - if ($errors->isEmpty()) { + if ($errors->no()) { if (ttInvoiceHelper::getInvoiceByName($cl_number)) $errors->add($i18n->getKey('error.invoice_exists')); - + if (!ttInvoiceHelper::invoiceableItemsExist($fields)) - $errors->add($i18n->getKey('error.no_invoiceable_items')); + $errors->add($i18n->getKey('error.no_invoiceable_items')); } - if ($errors->isEmpty()) { - // Now we can go ahead and create our invoice. + if ($errors->no()) { + // Now we can go ahead and create our invoice. if (ttInvoiceHelper::createInvoice($fields)) { header('Location: invoices.php'); exit(); } - $errors->add($i18n->getKey('error.db')); + $errors->add($i18n->getKey('error.db')); } -} // post +} // POST $smarty->assign('forms', array($form->getName()=>$form->toArray())); $smarty->assign('onload', 'onLoad="document.invoiceForm.number.focus()"'); $smarty->assign('title', $i18n->getKey('title.add_invoice')); $smarty->assign('content_page_name', 'invoice_add.tpl'); $smarty->display('index.tpl'); -?> \ No newline at end of file