Plugin Directory

Changeset 3351156


Ignore:
Timestamp:
08/27/2025 11:31:41 AM (6 months ago)
Author:
matrixaddons
Message:

Update to version 2.0.6 from GitHub

Location:
easy-invoice
Files:
10 edited
1 copied

Legend:

Unmodified
Added
Removed
  • easy-invoice/tags/2.0.6/easy-invoice.php

    r3349197 r3351156  
    44 * Plugin URI: https://matrixaddons.com/plugins/easy-invoice
    55 * Description: A beautiful, full-featured invoicing solution for WordPress. Create professional invoices, quotes, and manage payments with ease.
    6  * Version: 2.0.5
     6 * Version: 2.0.6
    77 * Author: MatrixAddons
    88 * Author URI: https://matrixaddons.com
     
    2525
    2626// Define plugin constants.
    27 define( 'EASY_INVOICE_VERSION', '2.0.5' );
     27define( 'EASY_INVOICE_VERSION', '2.0.6' );
    2828define( 'EASY_INVOICE_PLUGIN_FILE', __FILE__ );
    2929define( 'EASY_INVOICE_PLUGIN_DIR', plugin_dir_path( __FILE__ ) );
  • easy-invoice/tags/2.0.6/includes/Controllers/QuoteController.php

    r3345595 r3351156  
    883883        switch ($accept_action) {
    884884            case 'convert':
    885                 // Convert quote to invoice
    886                 $invoice_id = $this->convertQuoteToInvoice($quote);
     885                // Convert quote to invoice (Draft status)
     886                $invoice_id = $this->convertQuoteToInvoice($quote, 'draft');
     887                if ($invoice_id) {
     888                    $this->quote_log_service->logConversionToInvoice($quote_id, $invoice_id);
     889                }
     890                $action_message = __('Quote converted to invoice successfully.', 'easy-invoice');
     891                break;
     892               
     893            case 'convert_available':
     894                // Convert quote to invoice (Available status)
     895                $invoice_id = $this->convertQuoteToInvoice($quote, 'available');
    887896                if ($invoice_id) {
    888897                    $this->quote_log_service->logConversionToInvoice($quote_id, $invoice_id);
     
    892901               
    893902            case 'convert_send':
    894                 // Convert quote to invoice and send to client
    895                 $invoice_id = $this->convertQuoteToInvoice($quote);
     903                // Convert quote to invoice and send to client (Available status)
     904                $invoice_id = $this->convertQuoteToInvoice($quote, 'available');
    896905                if ($invoice_id) {
    897906                    $this->sendInvoiceToClient($invoice_id);
     
    901910               
    902911            case 'duplicate':
    903                 // Create new invoice, keep quote as-is
    904                 $invoice_id = $this->createInvoiceFromQuote($quote);
     912                // Create new invoice, keep quote as-is (Draft status)
     913                $invoice_id = $this->createInvoiceFromQuote($quote, 'draft');
    905914                if ($invoice_id) {
    906915                    $this->quote_log_service->logDuplicationToInvoice($quote_id, $invoice_id);
     
    910919               
    911920            case 'duplicate_send':
    912                 // Create new invoice and send to client, keep quote as-is
    913                 $invoice_id = $this->createInvoiceFromQuote($quote);
     921                // Create new invoice and send to client, keep quote as-is (Available status)
     922                $invoice_id = $this->createInvoiceFromQuote($quote, 'available');
    914923                if ($invoice_id) {
    915924                    $this->sendInvoiceToClient($invoice_id);
     
    930939        }
    931940       
     941        // Get URLs for the new invoice
     942        $invoice_url = null;
     943        $secure_url = null;
     944       
     945        if ($invoice_id) {
     946            // Get regular invoice URL
     947            $invoice_url = get_permalink($invoice_id);
     948           
     949            // If permalink is not available, construct a fallback URL
     950            if (!$invoice_url || $invoice_url === get_permalink(0)) {
     951                $invoice_url = home_url('/invoice/' . $invoice_id . '/');
     952            }
     953           
     954            // Get secure URL for the new invoice if it exists (Pro version)
     955            if (class_exists('\EasyInvoicePro\Controllers\PermalinkController')) {
     956                $secure_url = \EasyInvoicePro\Controllers\PermalinkController::getInvoiceSecureLinkUrl($invoice_id);
     957            }
     958        }
     959       
    932960        wp_send_json_success([
    933961            'message' => $action_message,
    934962            'invoice_id' => $invoice_id,
     963            'invoice_url' => $invoice_url,
     964            'secure_url' => $secure_url,
    935965            'toast' => [
    936966                'type' => 'success',
     
    944974     *
    945975     * @param \EasyInvoice\Models\Quote $quote The quote to convert
     976     * @param string $status The status for the new invoice ('draft' or 'available')
    946977     * @return int|null The invoice ID if successful, null otherwise
    947978     */
    948     private function convertQuoteToInvoice($quote): ?int {
     979    private function convertQuoteToInvoice($quote, $status = 'draft'): ?int {
    949980        try {
    950981            // Get invoice repository
     
    955986                'title' => $quote->getTitle() ?: 'Invoice from Quote ' . $quote->getNumber(),
    956987                'number' => $this->generateInvoiceNumber(),
    957                 'status' => 'draft',
     988                'status' => $status,
    958989                'issue_date' => date('Y-m-d'),
    959990                'due_date' => date('Y-m-d', strtotime('+30 days')),
     
    9951026                $quote->save();
    9961027               
     1028                // Ensure secure link is generated for the new invoice (Pro version)
     1029                if (class_exists('\EasyInvoicePro\Controllers\PermalinkController')) {
     1030                    // Trigger the save_post hook to generate secure link
     1031                    do_action('save_post_easy_invoice', $invoice->getId(), get_post($invoice->getId()));
     1032                }
     1033               
    9971034                return $invoice->getId();
    9981035            }
     
    10091046     *
    10101047     * @param \EasyInvoice\Models\Quote $quote The quote to duplicate
     1048     * @param string $status The status for the new invoice ('draft' or 'available')
    10111049     * @return int|null The invoice ID if successful, null otherwise
    10121050     */
    1013     private function createInvoiceFromQuote($quote): ?int {
     1051    private function createInvoiceFromQuote($quote, $status = 'draft'): ?int {
    10141052        try {
    10151053            // Get invoice repository
     
    10201058                'title' => 'Invoice from Quote ' . $quote->getNumber(),
    10211059                'number' => $this->generateInvoiceNumber(),
    1022                 'status' => 'draft',
     1060                'status' => $status,
    10231061                'issue_date' => date('Y-m-d'),
    10241062                'due_date' => date('Y-m-d', strtotime('+30 days')),
     
    10591097                $quote->setCustomField('related_invoice_id', $invoice->getId());
    10601098                $quote->save();
     1099               
     1100                // Ensure secure link is generated for the new invoice (Pro version)
     1101                if (class_exists('\EasyInvoicePro\Controllers\PermalinkController')) {
     1102                    // Trigger the save_post hook to generate secure link
     1103                    do_action('save_post_easy_invoice', $invoice->getId(), get_post($invoice->getId()));
     1104                }
    10611105               
    10621106                return $invoice->getId();
  • easy-invoice/tags/2.0.6/includes/Controllers/SettingsController.php

    r3349197 r3351156  
    261261                        'default' => 'convert',
    262262                        'options' => [
    263                             'convert' => __('Convert quote to invoice', 'easy-invoice'),
    264                             'convert_send' => __('Convert quote to invoice and send to client', 'easy-invoice'),
    265                             'duplicate' => __('Create new invoice, keep quote as-is', 'easy-invoice'),
    266                             'duplicate_send' => __('Create new invoice and send to client, keep quote as-is', 'easy-invoice'),
     263                            'convert' => __('Convert quote to invoice - Draft', 'easy-invoice'),
     264                            'convert_available' => __('Convert quote to invoice - Available', 'easy-invoice'),
     265                            'convert_send' => __('Convert quote to invoice and send to client - Available', 'easy-invoice'),
     266                            'duplicate' => __('Create new invoice, keep quote as-is - Draft', 'easy-invoice'),
     267                            'duplicate_send' => __('Create new invoice and send to client, keep quote as-is - Available', 'easy-invoice'),
    267268                            'do_nothing' => __('Do nothing', 'easy-invoice'),
    268269                        ],
  • easy-invoice/tags/2.0.6/readme.txt

    r3349197 r3351156  
    55Tested up to: 6.8
    66Requires PHP: 7.4
    7 Stable tag: 2.0.5
     7Stable tag: 2.0.6
    88License: GPLv2 or later
    99License URI: https://www.gnu.org/licenses/gpl-2.0.html
     
    134134
    135135== Changelog ==
     136= 2.0.6 - 2025-08-27 =
     137* Fixed - Accept quote issue fixed
     138
    136139
    137140= 2.0.5 - 2025-08-24 =
  • easy-invoice/tags/2.0.6/templates/quotes/single.php

    r3349197 r3351156  
    14541454                success: function(response) {
    14551455                    if (response.success) {
    1456                         showModalMessage('success', response.data && response.data.message ? response.data.message : '<?php _e('Quote accepted successfully', 'easy-invoice'); ?>', function() { location.reload(); });
     1456                        // Check if an invoice was created and redirect to it
     1457                        if (response.data && response.data.invoice_id) {
     1458                            // Use the PHP-generated URL (secure URL first, then regular URL)
     1459                            let invoiceUrl = response.data.secure_url || response.data.invoice_url;
     1460                           
     1461                            if (invoiceUrl) {
     1462                                showModalMessage('success', response.data.message || '<?php _e('Quote accepted successfully! Redirecting to invoice...', 'easy-invoice'); ?>', function() {
     1463                                    window.location.href = invoiceUrl;
     1464                                });
     1465                            } else {
     1466                                // Fallback to reload if no URL available
     1467                                showModalMessage('success', response.data.message || '<?php _e('Quote accepted successfully', 'easy-invoice'); ?>', function() { location.reload(); });
     1468                            }
     1469                        } else {
     1470                            // No invoice created, just show success message
     1471                            showModalMessage('success', response.data && response.data.message ? response.data.message : '<?php _e('Quote accepted successfully', 'easy-invoice'); ?>', function() { location.reload(); });
     1472                        }
    14571473                    } else {
    14581474                        resetButtonLoading(confirmBtn, originalText);
  • easy-invoice/trunk/easy-invoice.php

    r3349197 r3351156  
    44 * Plugin URI: https://matrixaddons.com/plugins/easy-invoice
    55 * Description: A beautiful, full-featured invoicing solution for WordPress. Create professional invoices, quotes, and manage payments with ease.
    6  * Version: 2.0.5
     6 * Version: 2.0.6
    77 * Author: MatrixAddons
    88 * Author URI: https://matrixaddons.com
     
    2525
    2626// Define plugin constants.
    27 define( 'EASY_INVOICE_VERSION', '2.0.5' );
     27define( 'EASY_INVOICE_VERSION', '2.0.6' );
    2828define( 'EASY_INVOICE_PLUGIN_FILE', __FILE__ );
    2929define( 'EASY_INVOICE_PLUGIN_DIR', plugin_dir_path( __FILE__ ) );
  • easy-invoice/trunk/includes/Controllers/QuoteController.php

    r3345595 r3351156  
    883883        switch ($accept_action) {
    884884            case 'convert':
    885                 // Convert quote to invoice
    886                 $invoice_id = $this->convertQuoteToInvoice($quote);
     885                // Convert quote to invoice (Draft status)
     886                $invoice_id = $this->convertQuoteToInvoice($quote, 'draft');
     887                if ($invoice_id) {
     888                    $this->quote_log_service->logConversionToInvoice($quote_id, $invoice_id);
     889                }
     890                $action_message = __('Quote converted to invoice successfully.', 'easy-invoice');
     891                break;
     892               
     893            case 'convert_available':
     894                // Convert quote to invoice (Available status)
     895                $invoice_id = $this->convertQuoteToInvoice($quote, 'available');
    887896                if ($invoice_id) {
    888897                    $this->quote_log_service->logConversionToInvoice($quote_id, $invoice_id);
     
    892901               
    893902            case 'convert_send':
    894                 // Convert quote to invoice and send to client
    895                 $invoice_id = $this->convertQuoteToInvoice($quote);
     903                // Convert quote to invoice and send to client (Available status)
     904                $invoice_id = $this->convertQuoteToInvoice($quote, 'available');
    896905                if ($invoice_id) {
    897906                    $this->sendInvoiceToClient($invoice_id);
     
    901910               
    902911            case 'duplicate':
    903                 // Create new invoice, keep quote as-is
    904                 $invoice_id = $this->createInvoiceFromQuote($quote);
     912                // Create new invoice, keep quote as-is (Draft status)
     913                $invoice_id = $this->createInvoiceFromQuote($quote, 'draft');
    905914                if ($invoice_id) {
    906915                    $this->quote_log_service->logDuplicationToInvoice($quote_id, $invoice_id);
     
    910919               
    911920            case 'duplicate_send':
    912                 // Create new invoice and send to client, keep quote as-is
    913                 $invoice_id = $this->createInvoiceFromQuote($quote);
     921                // Create new invoice and send to client, keep quote as-is (Available status)
     922                $invoice_id = $this->createInvoiceFromQuote($quote, 'available');
    914923                if ($invoice_id) {
    915924                    $this->sendInvoiceToClient($invoice_id);
     
    930939        }
    931940       
     941        // Get URLs for the new invoice
     942        $invoice_url = null;
     943        $secure_url = null;
     944       
     945        if ($invoice_id) {
     946            // Get regular invoice URL
     947            $invoice_url = get_permalink($invoice_id);
     948           
     949            // If permalink is not available, construct a fallback URL
     950            if (!$invoice_url || $invoice_url === get_permalink(0)) {
     951                $invoice_url = home_url('/invoice/' . $invoice_id . '/');
     952            }
     953           
     954            // Get secure URL for the new invoice if it exists (Pro version)
     955            if (class_exists('\EasyInvoicePro\Controllers\PermalinkController')) {
     956                $secure_url = \EasyInvoicePro\Controllers\PermalinkController::getInvoiceSecureLinkUrl($invoice_id);
     957            }
     958        }
     959       
    932960        wp_send_json_success([
    933961            'message' => $action_message,
    934962            'invoice_id' => $invoice_id,
     963            'invoice_url' => $invoice_url,
     964            'secure_url' => $secure_url,
    935965            'toast' => [
    936966                'type' => 'success',
     
    944974     *
    945975     * @param \EasyInvoice\Models\Quote $quote The quote to convert
     976     * @param string $status The status for the new invoice ('draft' or 'available')
    946977     * @return int|null The invoice ID if successful, null otherwise
    947978     */
    948     private function convertQuoteToInvoice($quote): ?int {
     979    private function convertQuoteToInvoice($quote, $status = 'draft'): ?int {
    949980        try {
    950981            // Get invoice repository
     
    955986                'title' => $quote->getTitle() ?: 'Invoice from Quote ' . $quote->getNumber(),
    956987                'number' => $this->generateInvoiceNumber(),
    957                 'status' => 'draft',
     988                'status' => $status,
    958989                'issue_date' => date('Y-m-d'),
    959990                'due_date' => date('Y-m-d', strtotime('+30 days')),
     
    9951026                $quote->save();
    9961027               
     1028                // Ensure secure link is generated for the new invoice (Pro version)
     1029                if (class_exists('\EasyInvoicePro\Controllers\PermalinkController')) {
     1030                    // Trigger the save_post hook to generate secure link
     1031                    do_action('save_post_easy_invoice', $invoice->getId(), get_post($invoice->getId()));
     1032                }
     1033               
    9971034                return $invoice->getId();
    9981035            }
     
    10091046     *
    10101047     * @param \EasyInvoice\Models\Quote $quote The quote to duplicate
     1048     * @param string $status The status for the new invoice ('draft' or 'available')
    10111049     * @return int|null The invoice ID if successful, null otherwise
    10121050     */
    1013     private function createInvoiceFromQuote($quote): ?int {
     1051    private function createInvoiceFromQuote($quote, $status = 'draft'): ?int {
    10141052        try {
    10151053            // Get invoice repository
     
    10201058                'title' => 'Invoice from Quote ' . $quote->getNumber(),
    10211059                'number' => $this->generateInvoiceNumber(),
    1022                 'status' => 'draft',
     1060                'status' => $status,
    10231061                'issue_date' => date('Y-m-d'),
    10241062                'due_date' => date('Y-m-d', strtotime('+30 days')),
     
    10591097                $quote->setCustomField('related_invoice_id', $invoice->getId());
    10601098                $quote->save();
     1099               
     1100                // Ensure secure link is generated for the new invoice (Pro version)
     1101                if (class_exists('\EasyInvoicePro\Controllers\PermalinkController')) {
     1102                    // Trigger the save_post hook to generate secure link
     1103                    do_action('save_post_easy_invoice', $invoice->getId(), get_post($invoice->getId()));
     1104                }
    10611105               
    10621106                return $invoice->getId();
  • easy-invoice/trunk/includes/Controllers/SettingsController.php

    r3349197 r3351156  
    261261                        'default' => 'convert',
    262262                        'options' => [
    263                             'convert' => __('Convert quote to invoice', 'easy-invoice'),
    264                             'convert_send' => __('Convert quote to invoice and send to client', 'easy-invoice'),
    265                             'duplicate' => __('Create new invoice, keep quote as-is', 'easy-invoice'),
    266                             'duplicate_send' => __('Create new invoice and send to client, keep quote as-is', 'easy-invoice'),
     263                            'convert' => __('Convert quote to invoice - Draft', 'easy-invoice'),
     264                            'convert_available' => __('Convert quote to invoice - Available', 'easy-invoice'),
     265                            'convert_send' => __('Convert quote to invoice and send to client - Available', 'easy-invoice'),
     266                            'duplicate' => __('Create new invoice, keep quote as-is - Draft', 'easy-invoice'),
     267                            'duplicate_send' => __('Create new invoice and send to client, keep quote as-is - Available', 'easy-invoice'),
    267268                            'do_nothing' => __('Do nothing', 'easy-invoice'),
    268269                        ],
  • easy-invoice/trunk/readme.txt

    r3349197 r3351156  
    55Tested up to: 6.8
    66Requires PHP: 7.4
    7 Stable tag: 2.0.5
     7Stable tag: 2.0.6
    88License: GPLv2 or later
    99License URI: https://www.gnu.org/licenses/gpl-2.0.html
     
    134134
    135135== Changelog ==
     136= 2.0.6 - 2025-08-27 =
     137* Fixed - Accept quote issue fixed
     138
    136139
    137140= 2.0.5 - 2025-08-24 =
  • easy-invoice/trunk/templates/quotes/single.php

    r3349197 r3351156  
    14541454                success: function(response) {
    14551455                    if (response.success) {
    1456                         showModalMessage('success', response.data && response.data.message ? response.data.message : '<?php _e('Quote accepted successfully', 'easy-invoice'); ?>', function() { location.reload(); });
     1456                        // Check if an invoice was created and redirect to it
     1457                        if (response.data && response.data.invoice_id) {
     1458                            // Use the PHP-generated URL (secure URL first, then regular URL)
     1459                            let invoiceUrl = response.data.secure_url || response.data.invoice_url;
     1460                           
     1461                            if (invoiceUrl) {
     1462                                showModalMessage('success', response.data.message || '<?php _e('Quote accepted successfully! Redirecting to invoice...', 'easy-invoice'); ?>', function() {
     1463                                    window.location.href = invoiceUrl;
     1464                                });
     1465                            } else {
     1466                                // Fallback to reload if no URL available
     1467                                showModalMessage('success', response.data.message || '<?php _e('Quote accepted successfully', 'easy-invoice'); ?>', function() { location.reload(); });
     1468                            }
     1469                        } else {
     1470                            // No invoice created, just show success message
     1471                            showModalMessage('success', response.data && response.data.message ? response.data.message : '<?php _e('Quote accepted successfully', 'easy-invoice'); ?>', function() { location.reload(); });
     1472                        }
    14571473                    } else {
    14581474                        resetButtonLoading(confirmBtn, originalText);
Note: See TracChangeset for help on using the changeset viewer.