if (is_object($invoice) && $invoice->get_id()) { $q = prepare("SELECT * FROM invoiceRepeat WHERE invoiceID = %d LIMIT 1", $invoice->get_id()); $qid1 = $db->query($q); if ($db->row($qid1)) { $invoiceRepeat->read_db_record($db); $invoiceRepeat->set_values("invoiceRepeat_"); foreach (explode(" ", $TPL["invoiceRepeat_frequency"]) as $id) { if ($id) { $qid2 = $db->query("SELECT * FROM invoice WHERE invoiceRepeatID = %d AND invoiceRepeatDate = '%s'", $invoiceRepeat->get_id(), $id); if ($idrow = $db->row($qid2)) { $links[] = "<a href='" . $TPL["url_alloc_invoice"] . "invoiceID=" . $idrow["invoiceID"] . "'>" . $id . "</a>"; } else { $links[] = $id; } } } $TPL["message_help_no_esc"][] = "This invoice is also a template for the scheduled creation of new invoices on the following dates:\n <br>" . implode(" ", (array) $links) . "\n <br>Click the Repeating Invoice link for more information."; } if ($invoice->get_value("invoiceRepeatID")) { $ir = new invoiceRepeat(); $ir->set_id($invoice->get_value("invoiceRepeatID")); $ir->select(); $i = new invoice(); $i->set_id($ir->get_value("invoiceID")); $i->select(); $TPL["message_help_no_esc"][] = "This invoice was automatically generated by the\n <a href='" . $TPL["url_alloc_invoice"] . "invoiceID=" . $ir->get_value("invoiceID") . "'>\n repeating invoice " . $i->get_value("invoiceNum") . "</a>"; } } $TPL["invoice"] = $invoice; $TPL["invoiceRepeat"] = $invoiceRepeat; include_template("templates/invoiceM.tpl");