Permalink
Browse files

Merged billing module from branches/flo/surprise. Thanks again Former…

… 03 GmbH

git-svn-id: file:///var/svn/trunk@2103 45fdb5c4-e40b-0410-b369-9aab4fe9a275
  • Loading branch information...
1 parent e04ce78 commit ab57f934f232224fe6f002dd2c1c7bf3b733a3a2 @flol committed Jun 28, 2008
Showing with 12,812 additions and 315 deletions.
  1. +421 −10 syscp/admin_admins.php
  2. +320 −12 syscp/admin_customers.php
  3. +307 −126 syscp/admin_domains.php
  4. +1 −1 syscp/admin_message.php
  5. +240 −0 syscp/billing_domains_templates.php
  6. +193 −0 syscp/billing_invoices.php
  7. +479 −0 syscp/billing_openinvoices.php
  8. +397 −0 syscp/billing_other.php
  9. +248 −0 syscp/billing_other_templates.php
  10. +196 −0 syscp/billing_taxrates.php
  11. +303 −0 syscp/install/billing.sql
  12. +18 −18 syscp/install/scripts/htpasswd-htaccess-remover.php
  13. +345 −1 syscp/install/syscp.sql
  14. +299 −3 syscp/install/updatesql_1.2.19-20.inc.php
  15. +230 −0 syscp/lib/billing_class_diskspace.php
  16. +323 −0 syscp/lib/billing_class_domains.php
  17. +65 −0 syscp/lib/billing_class_hosting.php
  18. +867 −0 syscp/lib/billing_class_invoice.php
  19. +94 −0 syscp/lib/billing_class_other.php
  20. +194 −0 syscp/lib/billing_class_pdf.php
  21. +188 −0 syscp/lib/billing_class_pdfcontract.php
  22. +254 −0 syscp/lib/billing_class_pdfinvoice.php
  23. +149 −0 syscp/lib/billing_class_pdfreminder.php
  24. +648 −0 syscp/lib/billing_class_servicecategory.php
  25. +328 −0 syscp/lib/billing_class_taxcontroller.php
  26. +229 −0 syscp/lib/billing_class_traffic.php
  27. +1 −1 syscp/lib/cron_httpd.class.php
  28. +555 −2 syscp/lib/functions.php
  29. +7 −0 syscp/lib/init.php
  30. +261 −0 syscp/lib/pdf/font/helvetica.php
  31. +261 −0 syscp/lib/pdf/font/helveticab.php
  32. +261 −0 syscp/lib/pdf/font/helveticabi.php
  33. +261 −0 syscp/lib/pdf/font/helveticai.php
  34. +1,647 −0 syscp/lib/pdf/fpdf.php
  35. +26 −2 syscp/lib/tables.inc.php
  36. +162 −1 syscp/lng/english.lng.php
  37. +164 −3 syscp/lng/german.lng.php
  38. +1 −1 syscp/scripts/cron_lighttp.htaccess.php
  39. +46 −18 syscp/scripts/cron_traffic.php
  40. +167 −6 syscp/templates/admin/admins/admins_add.tpl
  41. +202 −18 syscp/templates/admin/admins/admins_edit.tpl
  42. +30 −0 syscp/templates/admin/billing/domains_templates.tpl
  43. +50 −0 syscp/templates/admin/billing/domains_templates_add.tpl
  44. +50 −0 syscp/templates/admin/billing/domains_templates_edit.tpl
  45. +9 −0 syscp/templates/admin/billing/domains_templates_row.tpl
  46. +31 −0 syscp/templates/admin/billing/invoices.tpl
  47. +66 −0 syscp/templates/admin/billing/invoices_edit.tpl
  48. +13 −0 syscp/templates/admin/billing/invoices_row.tpl
  49. +60 −0 syscp/templates/admin/billing/openinvoices_cacheinvoicefees.tpl
  50. +31 −0 syscp/templates/admin/billing/openinvoices_invoice.tpl
  51. +28 −0 syscp/templates/admin/billing/openinvoices_invoice_fix.tpl
  52. +4 −0 syscp/templates/admin/billing/openinvoices_invoice_group.tpl
  53. +4 −0 syscp/templates/admin/billing/openinvoices_invoice_history.tpl
  54. +4 −0 syscp/templates/admin/billing/openinvoices_invoice_history_row_deleted.tpl
  55. +9 −0 syscp/templates/admin/billing/openinvoices_invoice_history_row_edited.tpl
  56. +9 −0 syscp/templates/admin/billing/openinvoices_invoice_history_row_original.tpl
  57. +10 −0 syscp/templates/admin/billing/openinvoices_invoice_row.tpl
  58. +10 −0 syscp/templates/admin/billing/openinvoices_invoice_row_edit.tpl
  59. +29 −0 syscp/templates/admin/billing/openinvoices_overview.tpl
  60. +8 −0 syscp/templates/admin/billing/openinvoices_overview_row.tpl
  61. +37 −0 syscp/templates/admin/billing/other.tpl
  62. +76 −0 syscp/templates/admin/billing/other_add.tpl
  63. +90 −0 syscp/templates/admin/billing/other_edit.tpl
  64. +16 −0 syscp/templates/admin/billing/other_row.tpl
  65. +31 −0 syscp/templates/admin/billing/other_templates.tpl
  66. +54 −0 syscp/templates/admin/billing/other_templates_add.tpl
  67. +54 −0 syscp/templates/admin/billing/other_templates_edit.tpl
  68. +10 −0 syscp/templates/admin/billing/other_templates_row.tpl
  69. +27 −0 syscp/templates/admin/billing/taxrates.tpl
  70. +30 −0 syscp/templates/admin/billing/taxrates_add.tpl
  71. +30 −0 syscp/templates/admin/billing/taxrates_edit.tpl
  72. +6 −0 syscp/templates/admin/billing/taxrates_row.tpl
  73. +1 −3 syscp/templates/admin/customers/customers.tpl
  74. +153 −19 syscp/templates/admin/customers/customers_add.tpl
  75. +12 −14 syscp/templates/admin/customers/customers_customer.tpl
  76. +154 −9 syscp/templates/admin/customers/customers_edit.tpl
  77. +57 −2 syscp/templates/admin/domains/domains_add.tpl
  78. +2 −2 syscp/templates/admin/domains/domains_domain.tpl
  79. +68 −2 syscp/templates/admin/domains/domains_edit.tpl
  80. +2 −2 syscp/templates/admin/logger/logger_action.tpl
  81. +6 −6 syscp/templates/admin/logger/logger_log.tpl
  82. +33 −33 syscp/templates/header_no_robots.tpl
  83. +50 −0 syscp/templates/main.css
View

Large diffs are not rendered by default.

Oops, something went wrong.
View

Large diffs are not rendered by default.

Oops, something went wrong.
View

Large diffs are not rendered by default.

Oops, something went wrong.
View
@@ -12,7 +12,7 @@
* @author Florian Lippert <flo@syscp.org>
* @license GPLv2 http://files.syscp.org/misc/COPYING.txt
* @package Panel
- * @version $Id: admin_admins.php 1845 2008-05-02 23:51:50Z atari $
+ * @version $Id$
*/
define('AREA', 'admin');
@@ -0,0 +1,240 @@
+<?php
+
+/**
+ * Manage Domain Templates (billing_domains_templates.php)
+ *
+ * This file manages domain templates (list, add, delete, edit)
+ *
+ * @author Florian Lippert <flo@syscp.org>
+ * @version 1.0
+ */
+
+define('AREA', 'admin');
+
+/**
+ * Include our init.php, which manages Sessions, Language etc.
+ */
+
+require ("./lib/init.php");
+
+if(isset($_POST['id']))
+{
+ $id = intval($_POST['id']);
+}
+elseif(isset($_GET['id']))
+{
+ $id = intval($_GET['id']);
+}
+
+if($userinfo['customers_see_all'] == '1')
+{
+ $taxclasses = array();
+ $taxclasses_option = '';
+ $taxclasses_result = $db->query('SELECT `classid`, `classname` FROM `' . TABLE_BILLING_TAXCLASSES . '` ');
+
+ while($taxclasses_row = $db->fetch_array($taxclasses_result))
+ {
+ $taxclasses[$taxclasses_row['classid']] = $taxclasses_row['classname'];
+ $taxclasses_option.= makeoption($taxclasses_row['classname'], $taxclasses_row['classid']);
+ }
+
+ if($action == '')
+ {
+ $fields = array(
+ 'tld' => $lng['domains']['topleveldomain'],
+ 'valid_from' => $lng['service']['valid_from'],
+ 'valid_to' => $lng['service']['valid_to'],
+ 'interval_fee' => $lng['service']['interval_fee'],
+ 'interval_length' => $lng['service']['interval_length'],
+ 'setup_fee' => $lng['service']['setup_fee'],
+ );
+ $paging = new paging($userinfo, $db, TABLE_BILLING_SERVICE_DOMAINS_TEMPLATES, $fields, $settings['panel']['paging'], $settings['panel']['natsorting']);
+ $customers = '';
+ $result = $db->query("SELECT * " . "FROM `" . TABLE_BILLING_SERVICE_DOMAINS_TEMPLATES . "` " . $paging->getSqlWhere() . " " . $paging->getSqlOrderBy() . " " . $paging->getSqlLimit());
+ $paging->setEntries($db->num_rows($result));
+ $sortcode = $paging->getHtmlSortCode($lng);
+ $arrowcode = $paging->getHtmlArrowCode($filename . '?s=' . $s);
+ $searchcode = $paging->getHtmlSearchCode($lng);
+ $pagingcode = $paging->getHtmlPagingCode($filename . '?s=' . $s);
+ $i = 0;
+ $domainstemplates = '';
+
+ while($row = $db->fetch_array($result))
+ {
+ if($paging->checkDisplay($i))
+ {
+ $row = htmlentities_array($row);
+ eval("\$domainstemplates.=\"" . getTemplate("billing/domains_templates_row") . "\";");
+ }
+
+ $i++;
+ }
+
+ eval("echo \"" . getTemplate("billing/domains_templates") . "\";");
+ }
+
+ if($action == 'add')
+ {
+ if(isset($_POST['send'])
+ && $_POST['send'] == 'send')
+ {
+ $tld = validate($_POST['tld'], $lng['domains']['topleveldomain']);
+
+ if($tld == '')
+ {
+ standard_error('notallreqfieldsorerrors');
+ exit;
+ }
+
+ if($_POST['valid_from'] != '0')
+ {
+ $valid_from = validate($_POST['valid_from'], $lng['service']['valid_from'], '/^(19|20)\d\d[-](0[1-9]|1[012])[-](0[1-9]|[12][0-9]|3[01])$/');
+ }
+ else
+ {
+ $valid_from = '0';
+ }
+
+ if($_POST['valid_to'] != '0')
+ {
+ $valid_to = validate($_POST['valid_to'], $lng['service']['valid_to'], '/^(19|20)\d\d[-](0[1-9]|1[012])[-](0[1-9]|[12][0-9]|3[01])$/');
+ }
+ else
+ {
+ $valid_to = '0';
+ }
+
+ if(isset($taxclasses[$_POST['taxclass']]))
+ {
+ $taxclass = $_POST['taxclass'];
+ }
+ else
+ {
+ $taxclass_keys = array_keys($taxclasses);
+ $taxclass = $taxclass_keys[0];
+ unset($taxclass_keys);
+ }
+
+ $interval_fee = doubleval(str_replace(',', '.', $_POST['interval_fee']));
+ $interval_length = intval($_POST['interval_length']);
+ $interval_type = (in_array($_POST['interval_type'], getIntervalTypes('array')) ? $_POST['interval_type'] : 'm');
+ $interval_payment = intval($_POST['interval_payment']);
+ $setup_fee = doubleval(str_replace(',', '.', $_POST['setup_fee']));
+
+ if($interval_payment != '1')
+ {
+ $interval_payment = '0';
+ }
+
+ $db->query('INSERT INTO `' . TABLE_BILLING_SERVICE_DOMAINS_TEMPLATES . '` (`tld`, `valid_from`, `valid_to`, `interval_fee` , `interval_length` , `interval_type` , `interval_payment` , `setup_fee`, `taxclass`) VALUES( \'' . $db->escape($tld) . '\', \'' . $db->escape($valid_from) . '\', \'' . $db->escape($valid_to) . '\', \'' . $db->escape($interval_fee) . '\', \'' . $db->escape($interval_length) . '\', \'' . $db->escape($interval_type) . '\', \'' . $db->escape($interval_payment) . '\', \'' . $db->escape($setup_fee) . '\', \'' . $db->escape($taxclass) . '\' ) ');
+ redirectTo($filename, Array(
+ 's' => $s
+ ));
+ }
+ else
+ {
+ $valid_from = date('Y-m-d');
+ $valid_to = date('Y-m-d');
+ $interval_type = getIntervalTypes('option');
+ $interval_payment = makeoption($lng['service']['interval_payment_prepaid'], '0', '0', true) . makeoption($lng['service']['interval_payment_postpaid'], '1', '0', true);
+ eval("echo \"" . getTemplate("billing/domains_templates_add") . "\";");
+ }
+ }
+
+ if($action == 'delete')
+ {
+ $result = $db->query_first('SELECT * FROM `' . TABLE_BILLING_SERVICE_DOMAINS_TEMPLATES . '` WHERE `id` = \'' . $id . '\' ');
+
+ if($result['id'] == $id
+ && $id != '0')
+ {
+ if(isset($_POST['send'])
+ && $_POST['send'] == 'send')
+ {
+ $db->query('DELETE FROM `' . TABLE_BILLING_SERVICE_DOMAINS_TEMPLATES . '` WHERE `id` = \'' . $id . '\' ');
+ redirectTo($filename, Array(
+ 's' => $s
+ ));
+ }
+ else
+ {
+ ask_yesno('billing_domains_template_reallydelete', $filename, array(
+ 'id' => $id,
+ 'action' => $action
+ ), $result['tld'] . ' (' . $result['valid_from'] . ' - ' . $result['valid_to'] . ')');
+ }
+ }
+ }
+
+ if($action == 'edit')
+ {
+ $result = $db->query_first('SELECT * FROM `' . TABLE_BILLING_SERVICE_DOMAINS_TEMPLATES . '` WHERE `id` = \'' . $id . '\' ');
+
+ if($result['id'] == $id
+ && $id != '0')
+ {
+ if(isset($_POST['send'])
+ && $_POST['send'] == 'send')
+ {
+ if($_POST['valid_from'] != '0')
+ {
+ $valid_from = validate($_POST['valid_from'], $lng['service']['valid_from'], '/^(19|20)\d\d[-](0[1-9]|1[012])[-](0[1-9]|[12][0-9]|3[01])$/');
+ }
+ else
+ {
+ $valid_from = '0';
+ }
+
+ if($_POST['valid_to'] != '0')
+ {
+ $valid_to = validate($_POST['valid_to'], $lng['service']['valid_to'], '/^(19|20)\d\d[-](0[1-9]|1[012])[-](0[1-9]|[12][0-9]|3[01])$/');
+ }
+ else
+ {
+ $valid_to = '0';
+ }
+
+ if(isset($taxclasses[$_POST['taxclass']]))
+ {
+ $taxclass = $_POST['taxclass'];
+ }
+ else
+ {
+ $taxclass_keys = array_keys($taxclasses);
+ $taxclass = $taxclass_keys[0];
+ unset($taxclass_keys);
+ }
+
+ $interval_fee = doubleval(str_replace(',', '.', $_POST['interval_fee']));
+ $interval_length = intval($_POST['interval_length']);
+ $interval_type = (in_array($_POST['interval_type'], getIntervalTypes('array')) ? $_POST['interval_type'] : 'm');
+ $interval_payment = intval($_POST['interval_payment']);
+ $setup_fee = doubleval(str_replace(',', '.', $_POST['setup_fee']));
+
+ if($interval_payment != '1')
+ {
+ $interval_payment = '0';
+ }
+
+ $db->query('UPDATE `' . TABLE_BILLING_SERVICE_DOMAINS_TEMPLATES . '` SET `valid_from` = \'' . $db->escape($valid_from) . '\', `valid_to` = \'' . $db->escape($valid_to) . '\', `interval_fee` = \'' . $db->escape($interval_fee) . '\', `interval_length` = \'' . $db->escape($interval_length) . '\', `interval_type` = \'' . $db->escape($interval_type) . '\', `interval_payment` = \'' . $db->escape($interval_payment) . '\', `setup_fee` = \'' . $db->escape($setup_fee) . '\', `taxclass` = \'' . $db->escape($taxclass) . '\' WHERE `id` = \'' . $id . '\' ');
+ redirectTo($filename, Array(
+ 's' => $s
+ ));
+ }
+ else
+ {
+ $interval_type = getIntervalTypes('option', $result['interval_type']);
+ $interval_payment = makeoption($lng['service']['interval_payment_prepaid'], '0', $result['interval_payment'], true) . makeoption($lng['service']['interval_payment_postpaid'], '1', $result['interval_payment'], true);
+ $taxclasses_option = '';
+ foreach($taxclasses as $classid => $classname)
+ {
+ $taxclasses_option.= makeoption($classname, $classid, $result['taxclass']);
+ }
+
+ eval("echo \"" . getTemplate("billing/domains_templates_edit") . "\";");
+ }
+ }
+ }
+}
+
+?>
Oops, something went wrong.

0 comments on commit ab57f93

Please sign in to comment.