From dc18ebad5f3d3eea96a505c7be156e032a73412a Mon Sep 17 00:00:00 2001 From: TomGanske Date: Sun, 16 Jul 2017 20:39:19 +0200 Subject: [PATCH] fix, update, add to v 0.0.5 --- INSTALLATION_DE.md | 43 +++++ INSTALLATION_EN.md | 43 +++++ LICENSE | 165 ++++++++++++++++++ Readme.md | 2 +- changelog.md | 10 +- composer.json | 2 - .../contao/classes/FinancialDocument.php | 19 +- src/Resources/contao/classes/Invoice.php | 30 +++- src/Resources/contao/classes/InvoiceData.php | 31 +++- src/Resources/contao/config/autoload.ini | 19 -- src/Resources/contao/config/autoload.php | 39 ----- src/Resources/contao/config/config.php | 10 +- .../contao/dca/tl_invoice_business.php | 14 +- .../contao/dca/tl_invoice_customers.php | 9 +- .../contao/dca/tl_invoice_invoices.php | 19 +- .../contao/dca/tl_invoice_invoicesElement.php | 2 +- .../contao/dca/tl_invoice_settings.php | 14 +- src/Resources/contao/languages/de/default.php | 53 ++++++ .../languages/de/tl_invoice_business.php | 44 +++++ .../languages/de/tl_invoice_customers.php | 37 ++++ .../languages/de/tl_invoice_docTrans.php | 41 +++++ .../languages/de/tl_invoice_hosting.php | 17 ++ .../languages/de/tl_invoice_hosting_url.php | 15 ++ .../languages/de/tl_invoice_invoices.php | 74 ++++++++ .../de/tl_invoice_invoicesElement.php | 15 ++ .../contao/languages/de/tl_invoice_outbox.php | 18 ++ .../languages/de/tl_invoice_services.php | 11 ++ .../languages/de/tl_invoice_settings.php | 35 ++++ src/Resources/contao/languages/en/default.php | 5 +- .../languages/en/tl_invoice_business.php | 10 +- .../languages/en/tl_invoice_customers.php | 43 +++-- .../languages/en/tl_invoice_docTrans.php | 5 +- .../en/tl_invoice_invoicesElement.php | 24 +-- .../contao/languages/en/tl_invoice_outbox.php | 2 +- .../languages/en/tl_invoice_services.php | 47 +---- .../contao/templates/be_invoiceHTML.html5 | 7 +- .../contao/templates/be_noData.html5 | 5 + src/Resources/public/css/resetBackend.css | 1 + 38 files changed, 780 insertions(+), 200 deletions(-) create mode 100755 INSTALLATION_DE.md create mode 100755 INSTALLATION_EN.md create mode 100755 LICENSE delete mode 100755 src/Resources/contao/config/autoload.ini delete mode 100644 src/Resources/contao/config/autoload.php create mode 100755 src/Resources/contao/languages/de/default.php create mode 100755 src/Resources/contao/languages/de/tl_invoice_business.php create mode 100755 src/Resources/contao/languages/de/tl_invoice_customers.php create mode 100644 src/Resources/contao/languages/de/tl_invoice_docTrans.php create mode 100644 src/Resources/contao/languages/de/tl_invoice_hosting.php create mode 100644 src/Resources/contao/languages/de/tl_invoice_hosting_url.php create mode 100644 src/Resources/contao/languages/de/tl_invoice_invoices.php create mode 100755 src/Resources/contao/languages/de/tl_invoice_invoicesElement.php create mode 100644 src/Resources/contao/languages/de/tl_invoice_outbox.php create mode 100644 src/Resources/contao/languages/de/tl_invoice_services.php create mode 100644 src/Resources/contao/languages/de/tl_invoice_settings.php create mode 100644 src/Resources/contao/templates/be_noData.html5 diff --git a/INSTALLATION_DE.md b/INSTALLATION_DE.md new file mode 100755 index 0000000..7a40ad0 --- /dev/null +++ b/INSTALLATION_DE.md @@ -0,0 +1,43 @@ +# Installation von Contao Invoice Bundle + +Es gibt zwei Installationsmöglichkeiten. + +* mit dem Contao-Manger, nur für die Contao Managed-Editon +* über die Kommandozeile, für Contao Standard-Edition und Managed-Editon + + +## Installation über den Contao-Manager + +* Suche das Paket: `cteye/invoice-bundle` auf www.packagist.com +* Installation der Erweiterung +* Klick auf "Install Tool" +* Anmelden und Datenbank Update durchführen + + +## Installation über die Kommandozeile + +### Installation in einer Contao Managed-Edition + +Installation in einer Composer-basierenden Contao 4.3+ Managed-Edition: + +* `composer require "cteye/invoice-bundle"` +* Aufruf http(s)://deine-domain.de/contao/install +* Datenbank Update durchführen + + +### Installation in einer Contao Standard-Edition + +Installation in einer Composer-basierenden Contao 4.3+ Standard-Edition: + +* `composer require "cteye/invoice-bundle"` + +Füge folgende Zeile in `app/AppKernel.php` am Ende des Array `$bundles` ein: + +* `new CtEye\InvoiceBundle\CtEyeInvoiceBundle(),` + +Anschließend muss der Cache geleert werden mit folgenden Befehlen: + +* `vendor/bin/contao-console cache:clear --env=prod` +* `vendor/bin/contao-console cache:warmup -e prod` +* Aufruf http(s)://deine-domain.de/contao/install +* Datenbank Update durchführen \ No newline at end of file diff --git a/INSTALLATION_EN.md b/INSTALLATION_EN.md new file mode 100755 index 0000000..3c7e0db --- /dev/null +++ b/INSTALLATION_EN.md @@ -0,0 +1,43 @@ +# Installation of Contao Invoice Bundle + +There are two ways to install the bundle. + +* with the Contao-Manger, only for Contao Managed-Editon +* via the command line, for Contao Standard-Edition and Managed-Editon + + +## Installation with Contao-Manager + +* Search for package: `cteye/invoice-bundle` on www.packagist.com +* Install the package +* Click on "Install Tool" +* Login and update the database + + +## Installation via command line + +### Installation for Contao Managed-Edition + +Installation in a Composer-based Contao 4.3+ Managed-Edition: + +* `composer require "cteye/invoice-bundle"` +* Call http(s)://your-domain.com/contao/install +* Login and update the database + + +### Installation for Contao Standard-Edition + +Installation in a Composer-based Contao 4.3+ Standard-Edition + +* `composer require "cteye/invoice-bundle"` + +Add follow line in `app/AppKernel.php` at the end of the `$bundles` array: + +* `new CtEye\InvoiceBundle\CtEyeInvoiceBundle(),` + +Clear the cache: + +* `vendor/bin/contao-console cache:clear --env=prod` +* `vendor/bin/contao-console cache:warmup -e prod` +* Call http(s)://your-domain.com/contao/install +* Login and update the database diff --git a/LICENSE b/LICENSE new file mode 100755 index 0000000..65c5ca8 --- /dev/null +++ b/LICENSE @@ -0,0 +1,165 @@ + GNU LESSER GENERAL PUBLIC LICENSE + Version 3, 29 June 2007 + + Copyright (C) 2007 Free Software Foundation, Inc. + Everyone is permitted to copy and distribute verbatim copies + of this license document, but changing it is not allowed. + + + This version of the GNU Lesser General Public License incorporates +the terms and conditions of version 3 of the GNU General Public +License, supplemented by the additional permissions listed below. + + 0. Additional Definitions. + + As used herein, "this License" refers to version 3 of the GNU Lesser +General Public License, and the "GNU GPL" refers to version 3 of the GNU +General Public License. + + "The Library" refers to a covered work governed by this License, +other than an Application or a Combined Work as defined below. + + An "Application" is any work that makes use of an interface provided +by the Library, but which is not otherwise based on the Library. +Defining a subclass of a class defined by the Library is deemed a mode +of using an interface provided by the Library. + + A "Combined Work" is a work produced by combining or linking an +Application with the Library. The particular version of the Library +with which the Combined Work was made is also called the "Linked +Version". + + The "Minimal Corresponding Source" for a Combined Work means the +Corresponding Source for the Combined Work, excluding any source code +for portions of the Combined Work that, considered in isolation, are +based on the Application, and not on the Linked Version. + + The "Corresponding Application Code" for a Combined Work means the +object code and/or source code for the Application, including any data +and utility programs needed for reproducing the Combined Work from the +Application, but excluding the System Libraries of the Combined Work. + + 1. Exception to Section 3 of the GNU GPL. + + You may convey a covered work under sections 3 and 4 of this License +without being bound by section 3 of the GNU GPL. + + 2. Conveying Modified Versions. + + If you modify a copy of the Library, and, in your modifications, a +facility refers to a function or data to be supplied by an Application +that uses the facility (other than as an argument passed when the +facility is invoked), then you may convey a copy of the modified +version: + + a) under this License, provided that you make a good faith effort to + ensure that, in the event an Application does not supply the + function or data, the facility still operates, and performs + whatever part of its purpose remains meaningful, or + + b) under the GNU GPL, with none of the additional permissions of + this License applicable to that copy. + + 3. Object Code Incorporating Material from Library Header Files. + + The object code form of an Application may incorporate material from +a header file that is part of the Library. You may convey such object +code under terms of your choice, provided that, if the incorporated +material is not limited to numerical parameters, data structure +layouts and accessors, or small macros, inline functions and templates +(ten or fewer lines in length), you do both of the following: + + a) Give prominent notice with each copy of the object code that the + Library is used in it and that the Library and its use are + covered by this License. + + b) Accompany the object code with a copy of the GNU GPL and this license + document. + + 4. Combined Works. + + You may convey a Combined Work under terms of your choice that, +taken together, effectively do not restrict modification of the +portions of the Library contained in the Combined Work and reverse +engineering for debugging such modifications, if you also do each of +the following: + + a) Give prominent notice with each copy of the Combined Work that + the Library is used in it and that the Library and its use are + covered by this License. + + b) Accompany the Combined Work with a copy of the GNU GPL and this license + document. + + c) For a Combined Work that displays copyright notices during + execution, include the copyright notice for the Library among + these notices, as well as a reference directing the user to the + copies of the GNU GPL and this license document. + + d) Do one of the following: + + 0) Convey the Minimal Corresponding Source under the terms of this + License, and the Corresponding Application Code in a form + suitable for, and under terms that permit, the user to + recombine or relink the Application with a modified version of + the Linked Version to produce a modified Combined Work, in the + manner specified by section 6 of the GNU GPL for conveying + Corresponding Source. + + 1) Use a suitable shared library mechanism for linking with the + Library. A suitable mechanism is one that (a) uses at run time + a copy of the Library already present on the user's computer + system, and (b) will operate properly with a modified version + of the Library that is interface-compatible with the Linked + Version. + + e) Provide Installation Information, but only if you would otherwise + be required to provide such information under section 6 of the + GNU GPL, and only to the extent that such information is + necessary to install and execute a modified version of the + Combined Work produced by recombining or relinking the + Application with a modified version of the Linked Version. (If + you use option 4d0, the Installation Information must accompany + the Minimal Corresponding Source and Corresponding Application + Code. If you use option 4d1, you must provide the Installation + Information in the manner specified by section 6 of the GNU GPL + for conveying Corresponding Source.) + + 5. Combined Libraries. + + You may place library facilities that are a work based on the +Library side by side in a single library together with other library +facilities that are not Applications and are not covered by this +License, and convey such a combined library under terms of your +choice, if you do both of the following: + + a) Accompany the combined library with a copy of the same work based + on the Library, uncombined with any other library facilities, + conveyed under the terms of this License. + + b) Give prominent notice with the combined library that part of it + is a work based on the Library, and explaining where to find the + accompanying uncombined form of the same work. + + 6. Revised Versions of the GNU Lesser General Public License. + + The Free Software Foundation may publish revised and/or new versions +of the GNU Lesser General Public License from time to time. Such new +versions will be similar in spirit to the present version, but may +differ in detail to address new problems or concerns. + + Each version is given a distinguishing version number. If the +Library as you received it specifies that a certain numbered version +of the GNU Lesser General Public License "or any later version" +applies to it, you have the option of following the terms and +conditions either of that published version or of any later version +published by the Free Software Foundation. If the Library as you +received it does not specify a version number of the GNU Lesser +General Public License, you may choose any version of the GNU Lesser +General Public License ever published by the Free Software Foundation. + + If the Library as you received it specifies that a proxy can decide +whether future versions of the GNU Lesser General Public License shall +apply, that proxy's public statement of acceptance of any version is +permanent authorization for you to choose that version for the +Library. diff --git a/Readme.md b/Readme.md index 91aef8a..f304b65 100644 --- a/Readme.md +++ b/Readme.md @@ -7,7 +7,7 @@ Contao 4 - Invoice Bundle Developer: Tom Ganske, CT-EYE Website: http://www.ct-eye.com Year: 2017 -Version: 0.0.1 +Version: 0.0.5 CMS: Contao 4 Bundle ``` diff --git a/changelog.md b/changelog.md index 1189771..2dc1c85 100644 --- a/changelog.md +++ b/changelog.md @@ -2,7 +2,15 @@ ###### Changelog 2017 -#### 0.0.2 (2017-06-07) +#### 0.0.5 (2017-07-16) + - fix invoice Template + - fix queries + - remove autoload.ini and autoload.php + - add INSTALLATION.md in english and german + - add german translation + - add license file + +#### 0.0.2 - 0.0.4 (2017-06-07) - fix templates for annual overview - new send Invoice by E-Mail directly to customer or just a link - track email delivery diff --git a/composer.json b/composer.json index 5599f05..17d8f6c 100755 --- a/composer.json +++ b/composer.json @@ -31,8 +31,6 @@ "src/Resources/contao/" ], "exclude-from-classmap": [ - "src/Resources/contao/config/", - "src/Resources/contao/dca/", "src/Resources/contao/languages/", "src/Resources/contao/templates/" ] diff --git a/src/Resources/contao/classes/FinancialDocument.php b/src/Resources/contao/classes/FinancialDocument.php index 7efc942..2b537d5 100644 --- a/src/Resources/contao/classes/FinancialDocument.php +++ b/src/Resources/contao/classes/FinancialDocument.php @@ -12,16 +12,29 @@ public function financialDocument() $GLOBALS['TL_CSS']['resetBackend'] = 'bundles/cteyeinvoice/css/resetBackend.css'; $GLOBALS['TL_CSS']['bootstrap'] = 'bundles/cteyeinvoice/css/bootstrap.min.css'; + + // Variables $year = (!empty(Input::get('year')) ? Input::get('year') : date("Y") ); // Objects - $oBusiness = \InvoiceBusinessModel::findAll()->last(); - $aCustomers = \InvoiceCustomersModel::findAll()->fetchAll(); + $oBusiness = \InvoiceBusinessModel::findAll(); + if(!is_null($oBusiness)) + $oBusiness = $oBusiness->last(); + + $aCustomers = \InvoiceCustomersModel::findAll(); + if(!is_null($aCustomers)) + $aCustomers = $aCustomers->fetchAll(); + + if(is_null($oBusiness) || is_null($aCustomers)) { + $oTemplate = new \BackendTemplate('be_noData'); + $oTemplate->noData = $GLOBALS['TL_LANG']['Invoice']['noData']; + return($oTemplate->parse()); + } + $oInvoices = \InvoiceInvoicesModel::currentYear($year); $oAllYears = \InvoiceInvoicesModel::getAllYears(); - foreach($aCustomers as $v) { $arrCustomers[$v['invoiceId']] = $v; } diff --git a/src/Resources/contao/classes/Invoice.php b/src/Resources/contao/classes/Invoice.php index 18f361d..b033234 100644 --- a/src/Resources/contao/classes/Invoice.php +++ b/src/Resources/contao/classes/Invoice.php @@ -1,4 +1,5 @@ execute("SELECT YEAR(FROM_UNIXTIME(payDay)) AS payYear FROM tl_invoice_invoices GROUP BY payYear DESC")->fetchAllAssoc(); } - // return total income of the year + /** + * return total income of the year + * @param int $year + */ public function getTotalAmountYear($year = null){ $result = \Contao\Database::getInstance()->prepare("SELECT SUM(price) AS amount FROM tl_invoice_invoices WHERE YEAR(FROM_UNIXTIME(payDay))=?")->execute(date("Y"))->fetchAssoc(); return $this->priceFormat($result['amount']); } - // return average income by month + /** + * return average income by month + */ public function getAverageIncomeByMonth() { $result = \Contao\Database::getInstance()->prepare("SELECT SUM(price) AS amount FROM tl_invoice_invoices WHERE YEAR(FROM_UNIXTIME(payDay))=?")->execute(date("Y"))->fetchAssoc(); return $this->priceFormat($result['amount'] / 12); } - /** * Create automatic Invoices for Web-Hosting Contracts */ @@ -179,7 +185,6 @@ public function createHostingInvoices() return $objTemplate->parse(); } - /** * return Formated Date String * @param string $timestamp @@ -201,7 +206,9 @@ public static function getDate($timestamp, $format = '', $factor = '') return date($f,$timestamp); } - + /** + * Create a Hosting Invoice Document + */ public static function createHostingInvoiceDocument($aData) { $dataSet = [ @@ -262,7 +269,8 @@ public static function createHostingInvoiceDocument($aData) public function amountOverview() { // RESET CSS - $GLOBALS['TL_CSS'][] = 'bundles/cteyeinvoice/css/resetBackend.css'; + $GLOBALS['TL_CSS'][] = 'bundles/cteyeinvoice/css/resetBackend.css'; + $GLOBALS['TL_CSS']['bootstrap'] = 'bundles/cteyeinvoice/css/bootstrap.min.css'; if(\Input::get('do')=='InvoiceInvoice' && \Input::get('key')=='amountOverview') { @@ -273,7 +281,11 @@ public function amountOverview() $strAmCurYear = []; $strAmLasYear = []; - + if(is_null($invCurYear) || is_null($invLasYear)) { + $oTemplate = new \BackendTemplate('be_noData'); + $oTemplate->noData = $GLOBALS['TL_LANG']['Invoice']['noData']; + return($oTemplate->parse()); + } while($invCurYear->next()) { $strAmCurYear[] = "[Date.UTC(".date("Y",$invCurYear->payDay).",".date("m",$invCurYear->payDay).",".date("d",$invCurYear->payDay)."),".$invCurYear->totalPrice.']'; diff --git a/src/Resources/contao/classes/InvoiceData.php b/src/Resources/contao/classes/InvoiceData.php index 1f78358..557b59b 100644 --- a/src/Resources/contao/classes/InvoiceData.php +++ b/src/Resources/contao/classes/InvoiceData.php @@ -14,16 +14,33 @@ class InvoiceData extends Backend public function __construct() { - $settings = \InvoiceSettingsModel::findAll()->fetchAll(); - foreach($settings as $value) { - self::$settings[$value['id']] = $value; + /** + * Fill Variable $settings if result exists + */ + $settings = \InvoiceSettingsModel::findAll(); + if($settings !== NULL) { + $settings = $settings->fetchAll(); + foreach ($settings as $value) { + self::$settings[$value['id']] = $value; + } } - $translation = \InvoiceDocTransModel::findAll()->fetchAll(); - foreach($translation as $value) { - self::$translation[$value['settingId']] = $value; + /** + * Fill Variable $translation if result exists + */ + $translation = \InvoiceDocTransModel::findAll(); + if($translation !== NULL){ + $translation = $translation->fetchAll(); + foreach($translation as $value) { + self::$translation[$value['settingId']] = $value; + } } - self::$business = \InvoiceBusinessModel::findAll()->last()->row(); + /** + * Fill Variable $business if result exists + */ + $business = \InvoiceBusinessModel::findAll(); + if($business !== NULL) + self::$business = $business->last()->row(); } } \ No newline at end of file diff --git a/src/Resources/contao/config/autoload.ini b/src/Resources/contao/config/autoload.ini deleted file mode 100755 index cc8452d..0000000 --- a/src/Resources/contao/config/autoload.ini +++ /dev/null @@ -1,19 +0,0 @@ -;; -; List modules which are required to be loaded beforehand -;; -requires[] = "core" - -;; -; Configure what you want the autoload creator to register -;; -register_namespaces = true -register_classes = true -register_templates = true - -;; -; Override the default configuration for certain sub directories -;; -[vendor/*] -register_namespaces = false -register_classes = false -register_templates = false diff --git a/src/Resources/contao/config/autoload.php b/src/Resources/contao/config/autoload.php deleted file mode 100644 index d8c8968..0000000 --- a/src/Resources/contao/config/autoload.php +++ /dev/null @@ -1,39 +0,0 @@ - 'src/CtEye/invoice-bundle/src/Resources/contao/classes/Invoice.php', - 'CtEye\\Invoice\\InvoiceErrorHandler' => 'src/CtEye/invoice-bundle/src/Resources/contao/classes/InvoiceErrorHandler.php', - 'CtEye\\Invoice\\FinancialDocument' => 'src/CtEye/invoice-bundle/src/Resources/contao/classes/FinancialDocument.php', - 'CtEye\\Invoice\\InvoiceData' => 'src/CtEye/invoice-bundle/src/Resources/contao/classes/InvoiceData.php', - 'CtEye\\Invoice\\InvoiceEmail' => 'src/CtEye/invoice-bundle/src/Resources/contao/classes/InvoiceEmail.php', - - // Models - 'InvoiceSettingsModel' => 'src/CtEye/invoice-bundle/src/Resources/contao/models/InvoiceSettingsModel.php', - 'InvoiceInvoicesModel' => 'src/CtEye/invoice-bundle/src/Resources/contao/models/InvoiceInvoicesModel.php', - 'InvoiceCustomersModel' => 'src/CtEye/invoice-bundle/src/Resources/contao/models/InvoiceCustomersModel.php', - 'InvoiceInvoicesElementModel' => 'src/CtEye/invoice-bundle/src/Resources/contao/models/InvoiceInvoicesElementModel.php', - 'InvoiceBusinessModel' => 'src/CtEye/invoice-bundle/src/Resources/contao/models/InvoiceBusinessModel.php', - 'InvoiceDocTransModel' => 'src/CtEye/invoice-bundle/src/Resources/contao/models/InvoiceDocTransModel.php', - 'InvoiceServicesModel' => 'src/CtEye/invoice-bundle/src/Resources/contao/models/InvoiceServicesModel.php', - 'InvoiceOutboxModel' => 'src/CtEye/invoice-bundle/src/Resources/contao/models/InvoiceOutboxModel.php' -)); - - -/** - * Register the templates - */ -TemplateLoader::addFiles(array -( - // Templates - 'be_invoiceHTML' => 'src/CtEye/invoice-bundle/src/Resources/contao/templates', - 'be_invoicePDF' => 'src/CtEye/invoice-bundle/src/Resources/contao/templates', - 'be_amountOverview' => 'src/CtEye/invoice-bundle/src/Resources/contao/templates', - 'be_showListofHostingUpdates' => 'src/CtEye/invoice-bundle/src/Resources/contao/templates', - 'be_financialDocument.html5' => 'src/CtEye/invoice-bundle/src/Resources/contao/templates', - 'be_invoiceFormSubmitted' => 'src/CtEye/invoice-bundle/src/Resources/contao/templates', -)); diff --git a/src/Resources/contao/config/config.php b/src/Resources/contao/config/config.php index 635765c..1b00095 100755 --- a/src/Resources/contao/config/config.php +++ b/src/Resources/contao/config/config.php @@ -6,10 +6,10 @@ 'tables' => array('tl_invoice_invoices','tl_invoice_invoicesElement'), 'invoiceHtml' => array('tl_invoice_invoices','invoiceHtml'), 'saveInvoiceAsPdf' => array('tl_invoice_invoices','saveInvoiceAsPdf'), - 'createHostingInvoices' => array('CtEye\\InvoiceBundle\\Invoice', 'createHostingInvoices'), - 'amountOverview' => array('CtEye\\InvoiceBundle\\Invoice','amountOverview'), - 'financialDocument' => array('CtEye\\InvoiceBundle\\FinancialDocument','financialDocument'), - 'sendEmail' => array('CtEye\\InvoiceBundle\\InvoiceEmail','prepareSendEmailAttachedInvoice') + 'createHostingInvoices' => array('CtEye\\Invoice\\Invoice', 'createHostingInvoices'), + 'amountOverview' => array('CtEye\\Invoice\\Invoice','amountOverview'), + 'financialDocument' => array('CtEye\\Invoice\\FinancialDocument','financialDocument'), + 'sendEmail' => array('CtEye\\Invoice\\InvoiceEmail','prepareSendEmailAttachedInvoice') ), 'InvoiceClients' => array ( @@ -39,7 +39,7 @@ // Top Level Domains -$GLOBALS['Invoice']['tld'] = array('.com', '.org', '.ch', '.de'); +$GLOBALS['Invoice']['tld'] = array('.com','.ch','.de','.org','.biz','.io','.info'); if (TL_MODE == 'BE') diff --git a/src/Resources/contao/dca/tl_invoice_business.php b/src/Resources/contao/dca/tl_invoice_business.php index 5098c2c..532e5f9 100755 --- a/src/Resources/contao/dca/tl_invoice_business.php +++ b/src/Resources/contao/dca/tl_invoice_business.php @@ -108,11 +108,8 @@ 'label' => &$GLOBALS['TL_LANG']['tl_invoice_business']['title'], 'exclude' => true, 'inputType' => 'select', - 'options' => array( - $GLOBALS['TL_LANG']['tl_invoice_business']['title']['value'][0], - $GLOBALS['TL_LANG']['tl_invoice_business']['title']['value'][1], - $GLOBALS['TL_LANG']['tl_invoice_business']['title']['value'][2], - ), + 'options' => array(0,1,2), + 'reference' => $GLOBALS['TL_LANG']['tl_invoice_business']['title']['value'], 'eval' => array( 'includeBlankOption' => true, 'tl_class' => 'w50' @@ -124,11 +121,8 @@ 'label' => &$GLOBALS['TL_LANG']['tl_invoice_business']['salutation'], 'exclude' => true, 'inputType' => 'select', - 'options' => array( - $GLOBALS['TL_LANG']['tl_invoice_business']['salutation']['value'][0], - $GLOBALS['TL_LANG']['tl_invoice_business']['salutation']['value'][1], - $GLOBALS['TL_LANG']['tl_invoice_business']['salutation']['value'][2], - ), + 'options' => array(0,1,2), + 'reference' => $GLOBALS['TL_LANG']['tl_invoice_business']['salutation']['value'], 'eval' => array( 'mandatory' => true, 'includeBlankOption' => true, diff --git a/src/Resources/contao/dca/tl_invoice_customers.php b/src/Resources/contao/dca/tl_invoice_customers.php index a13b1e1..ac56eb3 100755 --- a/src/Resources/contao/dca/tl_invoice_customers.php +++ b/src/Resources/contao/dca/tl_invoice_customers.php @@ -58,7 +58,7 @@ 'icon' => 'show.gif' ), 'delete' => array( - 'label' => &$GLOBALS['TL_LANG']['tl_invoice_customers']['show'], + 'label' => &$GLOBALS['TL_LANG']['tl_invoice_customers']['delete'], 'href' => 'act=delete', 'icon' => 'delete.gif' ) @@ -123,7 +123,7 @@ ), 'salutation' => array ( - 'label' => &$GLOBALS['TL_LANG']['tl_invoice_business']['salutation'], + 'label' => &$GLOBALS['TL_LANG']['tl_invoice_customers']['salutation'], 'exclude' => true, 'inputType' => 'select', 'options' => array( @@ -286,6 +286,11 @@ public function createCustomIdFolder($dc) // set destination path on SERVER $destinationPath = $_SERVER['DOCUMENT_ROOT']."/".$path."/".$dc->activeRecord->invoiceId; + + #var_dump($_SERVER); + #var_dump($_SERVER['DOCUMENT_ROOT']); + #var_dump($destinationPath); + // create custom folder by invoiceId as Primary Key if(!file_exists($destinationPath)) mkdir($destinationPath,0777); diff --git a/src/Resources/contao/dca/tl_invoice_invoices.php b/src/Resources/contao/dca/tl_invoice_invoices.php index 9acb762..1b6975a 100755 --- a/src/Resources/contao/dca/tl_invoice_invoices.php +++ b/src/Resources/contao/dca/tl_invoice_invoices.php @@ -1,5 +1,6 @@ array ( - 'createHostingInvoices' => array( + 'createHostingInvoices' => array + ( 'label' => $GLOBALS['TL_LANG']['tl_invoice_invoices']['createHostingInvoices'], 'href' => 'key=createHostingInvoices', 'icon' => 'bundles/cteyeinvoice/icon/hosting.svg' @@ -91,7 +93,7 @@ ), 'saveInvoiceAsPdf' => array ( - 'label' => 'savePdf', + 'label' => $GLOBALS['TL_LANG']['tl_invoice_invoices']['createPdf'], 'href' => 'key=saveInvoiceAsPdf', 'icon' => 'bundles/cteyeinvoice/icon/pdf.svg', 'attributes'=> 'onclick="if(!confirm(\'' . $GLOBALS['TL_LANG']['tl_invoice_invoices']['createPdf'] . '\'))return false;Backend.getScrollOffset()"', @@ -115,7 +117,7 @@ {service_legend:hide},serviceTable; {price_legend:hide},pricePerHour,totalHours; {miles_legend:hide},pricePerMiles,miles,milePrice; - {info_legend:hide},date,invoiceId,setInvoiceNr,totalPrice,taxprice,priceManuell; + {info_legend:hide},date,invoiceId,totalPrice,taxprice,priceManuell; {status_legend:hide},finished,isPaid,paidOn,isSaved,isPrinted,isSend' ), @@ -308,7 +310,7 @@ ) ); -class tl_invoice_invoices extends \CtEye\Invoice\Invoice +class tl_invoice_invoices extends Invoice { // calc TotalPrice @@ -366,7 +368,7 @@ public function loadTotalPrice($varValue,$objDca) */ public function loadInvoiceId($varValue,$objDca) { - if(!empty($varValue) && strpos("-",$varValue) !== false && $objDca->activeRecord->finished) + if(!empty($varValue) && $objDca->activeRecord->finished) return $varValue; @@ -531,6 +533,9 @@ public function serviceOptions() { $sql = InvoiceServicesModel::findAll(array('ORDER BY id')); + if(is_null($sql)) + return; + while ($sql->next()) { $service[$sql->serviceTable] = $sql->service; @@ -558,10 +563,10 @@ public function invoiceHtml() $customer = InvoiceCustomersModel::findBy('invoiceId',$invoice->customerId); // Load SIGN & LOGO image path - $objSignFile = \FilesModel::findByUuid($this->business->sign); + $objSignFile = \FilesModel::findByUuid(self::$business['sign']); $signImageUrl = ($objSignFile === null) ? null : $objSignFile->path; - $objLogoFile = \FilesModel::findByUuid($this->business->logo); + $objLogoFile = \FilesModel::findByUuid(self::$business['logo']); $logoImageUrl = ($objLogoFile === null) ? null : $objLogoFile->path; diff --git a/src/Resources/contao/dca/tl_invoice_invoicesElement.php b/src/Resources/contao/dca/tl_invoice_invoicesElement.php index 0cbcd55..4cf49a0 100755 --- a/src/Resources/contao/dca/tl_invoice_invoicesElement.php +++ b/src/Resources/contao/dca/tl_invoice_invoicesElement.php @@ -23,7 +23,7 @@ ( 'mode' => 4, 'fields' => array('sorting'), - 'headerFields' => array('invoiceId'), + 'headerFields' => array('customerId'), 'child_record_callback' => array('tl_invoice_invoicesElement','childRecord') ), 'global_operations' => array diff --git a/src/Resources/contao/dca/tl_invoice_settings.php b/src/Resources/contao/dca/tl_invoice_settings.php index a2e2dd8..27de931 100755 --- a/src/Resources/contao/dca/tl_invoice_settings.php +++ b/src/Resources/contao/dca/tl_invoice_settings.php @@ -69,11 +69,12 @@ 'default' =>' {language_legend:hide},language; {format_legend:hide},currency,centValue,dec_point,thousands_sep; - {invoiceDate_legend:hide},invoiceDate,invoicePayDate; {textblock_legend:hide},subject,html; {path_legend:hide},invoiceTree; {footer_legend},footerComment;' ), + # implement later if be sure to use it really + #{invoiceDate_legend:hide},invoiceDate,invoicePayDate; 'fields' => array ( @@ -98,7 +99,7 @@ ( 'label' => &$GLOBALS['TL_LANG']['tl_invoice_settings']['currency'], 'inputType' => 'select', - 'options' => array('-','€','$'), + 'options' => array('-','฿','B/.','₵','₡','圓','₫','Դ','ƒ','₴','₭','kr','₦','元','₪','S/.','₱','£','€','$','R','R$','៛','﷼','₽','৲','૱','௹','〒','₮','₩','¥','Zł'), 'search' => true, 'eval' => array('tl_class'=>'w50'), 'sql' => "varchar(19) NOT NULL default ''" @@ -215,6 +216,15 @@ public function __construct() public function label($label) { + /** + * No Translation exists + */ + if(is_null($this->translations)) + return sprintf('%s - %s %s', + $GLOBALS['TL_LANG']['Invoice']['settings'], + $this->getCountries()[$label['language']], + ' [ '.$GLOBALS['TL_LANG']['Invoice']['noTranslationExists'].' ]'); + return sprintf('%s - %s %s', $GLOBALS['TL_LANG']['Invoice']['settings'], $this->getCountries()[$label['language']], diff --git a/src/Resources/contao/languages/de/default.php b/src/Resources/contao/languages/de/default.php new file mode 100755 index 0000000..b2ab069 --- /dev/null +++ b/src/Resources/contao/languages/de/default.php @@ -0,0 +1,53 @@ +DOKUMENT FÜR FINANZAMT JAHR %s'; + +// Chart Description +$GLOBALS['TL_LANG']['Invoice']['yAxis'] = 'Betrag'; + +// Error Messages for Class InvoiceErrorHandler +$GLOBALS['TL_LANG']['InvoiceErrorHandler']['field_error'] = 'ACHTUNG: Das Feld %s muss ausgefüllt werden!'; + +// Info Messages for pdf Handler +$GLOBALS['TL_LANG']['InvoicePdf']['pdfExists'] = 'Die Rechnungsnummer: %s existiert bereits und kann nicht zweimal gespeichert werden. Löschen Sie erst die zuvor erstellte Rechnung und speichern Sie das Dokument anschließend neu!'; +$GLOBALS['TL_LANG']['InvoicePdf']['pdfcreated'] = "Die Rechnung ( %s ) wurde im PDF Format gespeichert unter folgendem Pfad %s."; + +// special Field Messages +$GLOBALS['TL_LANG']['Invoice']['automatically'] = 'automatisch ...'; +$GLOBALS['TL_LANG']['Invoice']['settings'] = 'Einstellungen'; +$GLOBALS['TL_LANG']['Invoice']['translation'] = 'Übersetzung'; +$GLOBALS['TL_LANG']['Invoice']['noTranslationExists'] = 'keine Übersetzung vorhanden'; +$GLOBALS['TL_LANG']['Invoice']['noDomains'] = 'Keine Domain gefunden!'; +$GLOBALS['TL_LANG']['Invoice']['noInvoicesToCreate'] = 'Keine Rechnung erstellt!'; +$GLOBALS['TL_LANG']['Invoice']['payment']['status']['paid'] = 'bezahlt'; +$GLOBALS['TL_LANG']['Invoice']['payment']['status']['in_process'] = 'in Bearbeitung ...'; +$GLOBALS['TL_LANG']['Invoice']['payment']['status']['pending'] = 'offen ...'; +$GLOBALS['TL_LANG']['Invoice']['payment']['status']['overdue'] = 'Zahlung überfällig'; + +// Create auto DB Messages +$GLOBALS['TL_LANG']['Invoice']['headline']['hosting'] = 'Hosting - Vertrag'; + +// Custom text for submitted email as successful response +$GLOBALS['TL_LANG']['Invoice']['emailSubmitted'] = 'Rechnung %s wurde erfolgreich an den Kunden %s versand.'; +$GLOBALS['TL_LANG']['Invoice']['emailSubmittedError'] = 'Ein Fehler ist aufgetreten.
Die Rechnungsnummer %s konnte nicht erfolgreich gesendet zum Kunden %s gesendet werden.'; + +// Template Buttons, Links +$GLOBALS['TL_LANG']['MSC']['nextBT'] = 'Weiter'; + +// Financial Dokument Messages +$GLOBALS['TL_LANG']['Invoice']['noData'] = 'Keine Daten gespeichert.'; \ No newline at end of file diff --git a/src/Resources/contao/languages/de/tl_invoice_business.php b/src/Resources/contao/languages/de/tl_invoice_business.php new file mode 100755 index 0000000..bcf4e59 --- /dev/null +++ b/src/Resources/contao/languages/de/tl_invoice_business.php @@ -0,0 +1,44 @@ +Die Rechnung hat keine Inhaltselemente. Bitte hinterlegen Sie Rechnungselemente und anschließend wird das System den Endpreis automatisch berechnen."; + +// Headline +$GLOBALS['TL_LANG']['tl_invoice_invoices']['headTitle'] = "Rechnung"; + +// Table Headline +$GLOBALS['TL_LANG']['tl_invoice_invoices']['dashboard']['thStatus'] = "Status"; +$GLOBALS['TL_LANG']['tl_invoice_invoices']['dashboard']['thInvoiceNr'] = "Nr"; +$GLOBALS['TL_LANG']['tl_invoice_invoices']['dashboard']['thCompany'] = "Firma"; +$GLOBALS['TL_LANG']['tl_invoice_invoices']['dashboard']['thPrice'] = "Kosten"; + +// Table Text +$GLOBALS['TL_LANG']['tl_invoice_invoices']['table']['tax'] = "MwSt"; + +// Amount +$GLOBALS['TL_LANG']['tl_invoice_invoices']['amountTitle'] = "monatliches Einkommen"; \ No newline at end of file diff --git a/src/Resources/contao/languages/de/tl_invoice_invoicesElement.php b/src/Resources/contao/languages/de/tl_invoice_invoicesElement.php new file mode 100755 index 0000000..ef0abcb --- /dev/null +++ b/src/Resources/contao/languages/de/tl_invoice_invoicesElement.php @@ -0,0 +1,15 @@ +An ERROR occurred.
Invoice number %s could not successfully submitted to the customer %s.'; // Template Buttons, Links -$GLOBALS['TL_LANG']['MSC']['nextBT'] = 'Next'; \ No newline at end of file +$GLOBALS['TL_LANG']['MSC']['nextBT'] = 'Next'; + +// Financial Dokument Messages +$GLOBALS['TL_LANG']['Invoice']['noData'] = 'No data saved.'; \ No newline at end of file diff --git a/src/Resources/contao/languages/en/tl_invoice_business.php b/src/Resources/contao/languages/en/tl_invoice_business.php index 0de1d26..ff5d36b 100755 --- a/src/Resources/contao/languages/en/tl_invoice_business.php +++ b/src/Resources/contao/languages/en/tl_invoice_business.php @@ -1,16 +1,16 @@ -
+
+
translation['_to'] ?>
customer->company)): ?> @@ -41,7 +42,7 @@
-
+
translation['_from'] ?>
business['company'] ?>
@@ -60,6 +61,8 @@
+
+

translation['invoiceTitle']?>

diff --git a/src/Resources/contao/templates/be_noData.html5 b/src/Resources/contao/templates/be_noData.html5 new file mode 100644 index 0000000..dee1f98 --- /dev/null +++ b/src/Resources/contao/templates/be_noData.html5 @@ -0,0 +1,5 @@ + +
+ noData?> +
+ \ No newline at end of file diff --git a/src/Resources/public/css/resetBackend.css b/src/Resources/public/css/resetBackend.css index 0c2a35e..b08aae3 100755 --- a/src/Resources/public/css/resetBackend.css +++ b/src/Resources/public/css/resetBackend.css @@ -8,6 +8,7 @@ #container { width: auto; + padding-top:0; } #main {