X-Git-Url: http://wagnertech.de/git?a=blobdiff_plain;ds=sidebyside;f=invoice_add.php;h=0ee614f97915028fa49f8a08ba1b50e0d921345e;hb=c46106d305d91e93fb63c0d601a5a006a02bb63a;hp=fb2c7fe3db5a3bcb2eed86ac5c44c4848b06dc4e;hpb=5ef582473f6b329be18ad83c61e053fdcd9c6ed5;p=timetracker.git diff --git a/invoice_add.php b/invoice_add.php index fb2c7fe3..0ee614f9 100644 --- a/invoice_add.php +++ b/invoice_add.php @@ -73,23 +73,23 @@ 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()"');