diff --git a/add_rows.php b/add_rows.php index 646b45d8..e8c1de87 100755 --- a/add_rows.php +++ b/add_rows.php @@ -52,8 +52,8 @@ return; } -$invoiceId = getPostOrQuery('id', false); -$templateId = getPostOrQuery('from_template', false); +$invoiceId = getPostOrQuery('id'); +$templateId = getPostOrQuery('template_id'); if (!$invoiceId || !$templateId) { echo htmlPageStart(); diff --git a/copy_invoice.php b/copy_invoice.php index fcb4bf3e..447cea67 100755 --- a/copy_invoice.php +++ b/copy_invoice.php @@ -130,46 +130,7 @@ $invoiceData['template_invoice_id'] = $intInvoiceId; } - switch ($invoiceData['interval_type']) { - // Month - case 2: - $invoiceData['next_interval_date'] = date( - 'Ymd', mktime(0, 0, 0, date('m') + 1, date('d'), date('Y')) - ); - break; - // Year - case 3: - $invoiceData['next_interval_date'] = date( - 'Ymd', mktime(0, 0, 0, date('m'), date('d'), date('Y') + 1) - ); - break; - // 2 to 6 months - case 4: - case 5: - case 6: - case 7: - case 8: - $invoiceData['next_interval_date'] = date( - 'Ymd', - mktime( - 0, 0, 0, date('m') + $invoiceData['interval_type'] - 2, - date('d'), date('Y') - ) - ); - break; - // 2 years - case 14: - $invoiceData['next_interval_date'] = date( - 'Ymd', mktime(0, 0, 0, date('m'), date('d'), date('Y') + 2) - ); - break; - // 3 years - case 15: - $invoiceData['next_interval_date'] = date( - 'Ymd', mktime(0, 0, 0, date('m'), date('d'), date('Y') + 3) - ); - break; - } + advanceInvoiceIntervalData($invoiceData); dbQueryCheck('SET AUTOCOMMIT = 0'); dbQueryCheck('BEGIN'); diff --git a/create_invoice_from_template.php b/create_invoice_from_template.php new file mode 100755 index 00000000..c34e1668 --- /dev/null +++ b/create_invoice_from_template.php @@ -0,0 +1,167 @@ + + * @license http://opensource.org/licenses/gpl-2.0.php GNU General Public License + * @link http://labs.fi/mlinvoice.eng.php + */ +require_once 'htmlfuncs.php'; +require_once 'sqlfuncs.php'; +require_once 'sessionfuncs.php'; + +initDbConnection(); +sesVerifySession(); + +require_once 'translator.php'; +require_once 'datefuncs.php'; +require_once 'miscfuncs.php'; +require_once 'settings.php'; + +if (!sesWriteAccess()) { + echo htmlPageStart(); + ?> +
+