Пример #1
0
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("&nbsp;&nbsp;", (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");
Пример #2
0
 * Copyright (C) 2006-2011 Alex Lance, Clancy Malcolm, Cyber IT Solutions
 * Pty. Ltd.
 * 
 * This file is part of the allocPSA application <*****@*****.**>.
 * 
 * allocPSA is free software: you can redistribute it and/or modify it
 * under the terms of the GNU Affero General Public License as published by
 * the Free Software Foundation, either version 3 of the License, or (at
 * your option) any later version.
 * 
 * allocPSA is distributed in the hope that it will be useful, but WITHOUT
 * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
 * FITNESS FOR A PARTICULAR PURPOSE. See the GNU Affero General Public
 * License for more details.
 * 
 * You should have received a copy of the GNU Affero General Public License
 * along with allocPSA. If not, see <http://www.gnu.org/licenses/>.
*/
require_once "../alloc.php";
$current_user =& singleton("current_user");
$db = new db_alloc();
$invoiceRepeat = new invoiceRepeat($_REQUEST["invoiceRepeatID"]);
if ($_POST["save"]) {
    $invoiceRepeat->set_value("invoiceID", $_POST["invoiceID"]);
    $invoiceRepeat->set_value("message", $_POST["message"]);
    $invoiceRepeat->set_value("active", 1);
    $invoiceRepeat->set_value("personID", $current_user->get_id());
    $invoiceRepeat->save($_POST["frequency"]);
    interestedParty::make_interested_parties("invoiceRepeat", $invoiceRepeat->get_id(), $_POST["commentEmailRecipients"]);
}
alloc_redirect($TPL["url_alloc_invoice"] . "invoiceID=" . $_POST["invoiceID"]);