Plugin Directory

Changeset 3234240


Ignore:
Timestamp:
02/03/2025 08:11:12 PM (14 months ago)
Author:
sjcope
Message:

more messaging around amount owed

Location:
cwsl-lotto-1049
Files:
52 added
16 edited

Legend:

Unmodified
Added
Removed
  • cwsl-lotto-1049/trunk/README.txt

    r3218453 r3234240  
    33Tags: lotto 649, lotto 1049, lotto1049
    44Tested up to: 6.7.1
    5 Stable tag: 1.0.4
     5Stable tag: 1.1
    66License: GPLv2
    77License URI: https://www.gnu.org/licenses/gpl-2.0.html
     
    4343
    4444== Changelog ==
     45= 1.1 =
     46* Change the messaging on the confirmation page so that if a player has already paid, and they are just changing their numbers, it will show the amount owed as $0. Update when convenient.
     47
    4548= 1.0.4 =
    4649* Fix contributors, paths. Update when convenient.
     
    5659
    5760== Upgrade Notice ==
     61= 1.1 =
     62* Functionality enhancements. Update when convenient. 
     63
    5864= 1.0.4 =
    5965* Minor changes. Update when convenient.
  • cwsl-lotto-1049/trunk/admin/_notes/dwsync.xml

    r3218453 r3234240  
    11<?xml version="1.0" encoding="utf-8" ?>
    22<dwsync>
    3 <file name="index.php" server="35.183.237.133" local="133652174400000000" remote="133652174400000000" />
    4 <file name="index.php" server="ftp.charlenesweb.ca/charlenesweb.ca/" local="133652174400000000" remote="133803366000000000" />
    5 <file name="class-cwsl-lotto-1049-admin.php" server="ftp.charlenesweb.ca/charlenesweb.ca/" local="133805638682411460" remote="133807515000000000" />
     3<file name="class-cwsl-lotto-1049-admin.php" server="ftp.charlenesweb.ca/charlenesweb.ca/" local="133807515000000000" remote="133807515000000000" />
     4<file name="index.php" server="ftp.charlenesweb.ca/charlenesweb.ca/" local="133805171400000000" remote="133805171400000000" />
    65</dwsync>
  • cwsl-lotto-1049/trunk/admin/css/_notes/dwsync.xml

    r3218453 r3234240  
    11<?xml version="1.0" encoding="utf-8" ?>
    22<dwsync>
    3 <file name="cwsl-lotto-1049-admin.css" server="ftp.charlenesweb.ca/charlenesweb.ca/" local="133793599145432747" remote="133803366000000000" />
     3<file name="cwsl-lotto-1049-admin.css" server="ftp.charlenesweb.ca/charlenesweb.ca/" local="133805171400000000" remote="133805171400000000" />
    44</dwsync>
  • cwsl-lotto-1049/trunk/admin/js/_notes/dwsync.xml

    r3218453 r3234240  
    11<?xml version="1.0" encoding="utf-8" ?>
    22<dwsync>
    3 <file name="cwsl-lotto-1049-admin.js" server="ftp.charlenesweb.ca/charlenesweb.ca/" local="133793827553143544" remote="133803381600000000" />
     3<file name="cwsl-lotto-1049-admin.js" server="ftp.charlenesweb.ca/charlenesweb.ca/" local="133805171400000000" remote="133805171400000000" />
    44</dwsync>
  • cwsl-lotto-1049/trunk/admin/partials/_notes/dwsync.xml

    r3218453 r3234240  
    11<?xml version="1.0" encoding="utf-8" ?>
    22<dwsync>
    3 <file name="cwsl-lotto-1049-admin-display.php" server="ftp.charlenesweb.ca/charlenesweb.ca/" local="133793826842975136" remote="133803366000000000" />
     3<file name="cwsl-lotto-1049-admin-display.php" server="ftp.charlenesweb.ca/charlenesweb.ca/" local="133830898200000000" remote="133830898200000000" />
    44</dwsync>
  • cwsl-lotto-1049/trunk/admin/partials/cwsl-lotto-1049-admin-display.php

    r3218453 r3234240  
    13561356                    </tr>
    13571357                    <tr>
    1358                         <td valign="top">Email Body<br /><span class="cwsl_small">Use placeholders such as: <ul><li>[player_name] - full player name</li><li>[display_name] - the name they have requested be displayed on any results</li><li>[draws] - includes the total number of draws they have entered followed by a list of the draws</li><li>[numbers] - list of all of their entries</li> <li>[amount] - amount they owe for their entries</li></ul></td>
     1358                        <td valign="top">Email Body<br /><span class="cwsl_small">Use placeholders such as: <ul><li>[player_name] - full player name</li><li>[display_name] - the name they have requested be displayed on any results</li><li>[draws] - includes the total number of draws they have entered followed by a list of the draws</li><li>[numbers] - list of all of their entries</li> <li>[amount] - amount they owe for their entries. If they have already paid for the Lotto and are just changing their numbers, then it will display as paid. </li></ul></td>
    13591359                        <td>';
    13601360                            if (isset($settings->confirm_email_body) && $settings->confirm_email_body != "") {
  • cwsl-lotto-1049/trunk/cwsl-lotto-1049.php

    r3218453 r3234240  
    1616 * Plugin Name:       CWSL Lotto 1049
    1717 * Description:       Set up a Lotto 1049
    18  * Requires at least: 6.3
    19  * Requires PHP:      8.0
    20  * Version:           1.0.4
     18 * Version:           1.1
    2119 * Author:            Charlene's Web Services
    2220 * Author URI:        https://charlenesweb.ca
     
    3533 * First release 1.0.0 and then using SemVer - https://semver.org X.Y.Z (Major.Minor.Patch)
    3634 */
    37 define( 'CWSL_LOTTO_VERSION', '1.0.4' );
     35define( 'CWSL_LOTTO_VERSION', '1.1' );
    3836define('CWSL_LOTTO_SRC_DIR', dirname(__FILE__) );
    3937/**
  • cwsl-lotto-1049/trunk/includes/_notes/dwsync.xml

    r3218453 r3234240  
    11<?xml version="1.0" encoding="utf-8" ?>
    22<dwsync>
    3 <file name="index.php" server="35.183.237.133" local="133652174400000000" remote="133652174400000000" />
    4 <file name="index.php" server="ftp.charlenesweb.ca/charlenesweb.ca/" local="133652174400000000" remote="133803366000000000" />
    5 <file name="class-cwsl-lotto-1049-activator.php" server="ftp.charlenesweb.ca/charlenesweb.ca/" local="133794460618453678" remote="133803366000000000" />
    6 <file name="class-cwsl-lotto-1049-deactivator.php" server="ftp.charlenesweb.ca/charlenesweb.ca/" local="133794460125951823" remote="133803366000000000" />
    7 <file name="class-cwsl-lotto-1049-i18n.php" server="ftp.charlenesweb.ca/charlenesweb.ca/" local="133794457189577044" remote="133803366000000000" />
    8 <file name="class-cwsl-lotto-1049-loader.php" server="ftp.charlenesweb.ca/charlenesweb.ca/" local="133794456630971694" remote="133803366000000000" />
    9 <file name="class-cwsl-lotto-1049.php" server="ftp.charlenesweb.ca/charlenesweb.ca/" local="133805637898648339" remote="133807515000000000" />
     3<file name="class-cwsl-lotto-1049-activator.php" server="ftp.charlenesweb.ca/charlenesweb.ca/" local="133805171400000000" remote="133805171400000000" />
     4<file name="class-cwsl-lotto-1049-deactivator.php" server="ftp.charlenesweb.ca/charlenesweb.ca/" local="133805171400000000" remote="133805171400000000" />
     5<file name="class-cwsl-lotto-1049-i18n.php" server="ftp.charlenesweb.ca/charlenesweb.ca/" local="133805171400000000" remote="133805171400000000" />
     6<file name="class-cwsl-lotto-1049-loader.php" server="ftp.charlenesweb.ca/charlenesweb.ca/" local="133805171400000000" remote="133805171400000000" />
     7<file name="class-cwsl-lotto-1049.php" server="ftp.charlenesweb.ca/charlenesweb.ca/" local="133830756064099140" remote="133830900000000000" />
     8<file name="index.php" server="ftp.charlenesweb.ca/charlenesweb.ca/" local="133805171400000000" remote="133805171400000000" />
    109</dwsync>
  • cwsl-lotto-1049/trunk/includes/class-cwsl-lotto-1049.php

    r3218453 r3234240  
    7373            $this->version = PLUGIN_NAME_VERSION;
    7474        } else {
    75             $this->version = '1.0.4';
     75            $this->version = '1.1';
    7676        }
    7777        $this->plugin_name = 'cwsl-lotto-1049';
  • cwsl-lotto-1049/trunk/languages/_notes/dwsync.xml

    r3218453 r3234240  
    11<?xml version="1.0" encoding="utf-8" ?>
    22<dwsync>
    3 <file name="cwsl-lotto-1049.pot" server="ftp.charlenesweb.ca/charlenesweb.ca/" local="133652174400000000" remote="133803366000000000" />
     3<file name="cwsl-lotto-1049.pot" server="ftp.charlenesweb.ca/charlenesweb.ca/" local="133805171400000000" remote="133805171400000000" />
    44</dwsync>
  • cwsl-lotto-1049/trunk/public/_notes/dwsync.xml

    r3218453 r3234240  
    11<?xml version="1.0" encoding="utf-8" ?>
    22<dwsync>
    3 <file name="index.php" server="35.183.237.133" local="133652175000000000" remote="133652175000000000" />
    4 <file name="index.php" server="ftp.charlenesweb.ca/charlenesweb.ca/" local="133652175000000000" remote="133803366000000000" />
    5 <file name="class-cwsl-lotto-1049-public.php" server="ftp.charlenesweb.ca/charlenesweb.ca/" local="133805638849349298" remote="133807518600000000" />
     3<file name="class-cwsl-lotto-1049-public.php" server="ftp.charlenesweb.ca/charlenesweb.ca/" local="133830832668546932" remote="133830976200000000" />
     4<file name="index.php" server="ftp.charlenesweb.ca/charlenesweb.ca/" local="133805171400000000" remote="133805171400000000" />
    65</dwsync>
  • cwsl-lotto-1049/trunk/public/class-cwsl-lotto-1049-public.php

    r3218453 r3234240  
    129129            $results_lookup = cwslPubLookupEmail($_POST);
    130130            $results_lookup['email_lookup'] = sanitize_text_field(wp_unslash($_POST['email_lookup']));
     131
    131132            // any matches?
    132133            if (isset($results_lookup['status']) && $results_lookup['status'] == 1 && isset($results_lookup['data'])) {
     
    180181            }
    181182        }
    182 
    183         $results_draws = cwslPubGetCurrentLotto1049Draws();
     183        if (isset($results_add['formvalues']['player_id'])) {
     184            $results_draws = cwslPubGetCurrentLotto1049DrawsWithPmt($results_add['formvalues']['player_id']);
     185        } else {
     186            $results_draws = cwslPubGetCurrentLotto1049Draws();
     187        }
    184188        $results_draws['new_player'] = $new_player;
    185189        // Display functions
     
    250254}
    251255
     256// Retrieve all active current and future draws and include what if any pmts the player has made
     257function cwslPubGetCurrentLotto1049DrawsWithPmt($player_id) {
     258    global $wpdb;
     259    $wpdb->hide_errors();
     260    $now = current_datetime()->format('Y-m-d');
     261   
     262    $values = $wpdb->get_results($wpdb->prepare( 'SELECT a.*, b.player_id, b.amount_sales, b.paid, b.method_of_payment FROM `'.$wpdb->prefix.'cws_lotto1049draw` as a LEFT JOIN '.$wpdb->prefix.'cws_lotto_payment as b ON a.ID=b.lotto1049draw_id AND (b.player_id=%d OR b.player_id IS NULL) WHERE active=1 AND date_start>= %s ORDER BY date_start ASC', array($player_id, $now))); // phpcs:ignore WordPress.DB.DirectDatabaseQuery
     263    if (!is_object($values) && !is_array($values)) {
     264        $results = array("status"=>0, "message"=>'Failed to find lotto 1049 draws. Error is '.$wpdb->last_error.'. ');
     265    } else {
     266        $results = array("status"=>1, "message"=>"Success", "data"=>$values);
     267    }
     268   
     269    return $results;
     270}
     271
    252272// Retrieve all current and future draws by ID
    253273function cwslPubGetLotto1049DrawByID($lotto1049draw_id) {
     
    289309    if (!isset($values['lotto1049draw_id']) || $values['lotto1049draw_id'] == "") {
    290310        $msg .= "Select which lotto. ";
    291     }
    292     if (!isset($values['how_heard']) || $values['how_heard'] == "") {
    293         $msg .= "Select how you heard about us. ";
    294311    }
    295312    for ($i=1; $i<=$numEntries; $i++) {
     
    451468        $sent = wp_mail($to, $subject, esc_html($results['message']), $headers);
    452469    }
    453     // If all is still good then send an email
    454    
     470    // have they already paid anything?
     471    if (isset($results['amount_paid'])) {
     472        $values['amount_paid'] = $results['amount_paid'];
     473    }
    455474    $results = cwslPubSendEmail($values, $settings);
    456475   
     
    701720function cwslPubEnterPayment($player_id, $baseAmt, $draws) {
    702721    global $wpdb;
     722    $amount_paid = 0;
    703723    if (!isset($player_id) || $player_id < 0 || !isset($baseAmt) || $baseAmt <= 0 || !is_array($draws) || count($draws) <= 0) {
    704724        $results = array("status"=>0, "message"=>'Could not enter the sales amount because correct values were not passed. ');
     
    707727    foreach ($draws as $i => $draw) {       
    708728        $lotto1049draw_id = $draw->ID;
     729        $payments = $wpdb->get_results( $wpdb->prepare( 'SELECT * FROM '.$wpdb->prefix.'cws_lotto_payment WHERE player_id=%d AND lotto1049draw_id=%d AND paid=1 AND amount_sales>0 ', array($player_id,$lotto1049draw_id)));  // phpcs:ignore WordPress.DB.DirectDatabaseQuery
     730        if (is_object($payments) || is_array($payments)) {
     731            if (isset($payments[0]->amount_sales)) {
     732                $amount_paid += $payments[0]->amount_sales;
     733            }
     734        }
    709735        $query = $wpdb->query($wpdb->prepare("INSERT INTO {$wpdb->prefix}cws_lotto_payment (player_id, lotto1049draw_id, amount_sales) VALUES (%d,%d, %d) ON DUPLICATE KEY UPDATE amount_sales = %d",array($player_id,$lotto1049draw_id,$baseAmt, $baseAmt))); // phpcs:ignore WordPress.DB.DirectDatabaseQuery
    710736        // error handling
     
    716742            $results = array("status"=>1, "message"=>"Amount owed updated. ");
    717743        }
     744    }
     745    if ($amount_paid > 0) {
     746        $results['amount_paid'] = $amount_paid;
    718747    }
    719748    return $results;
     
    819848    $body = str_replace("[numbers]", $number_text, $body);
    820849    // amount owed
    821     $amt_text = "Amount Owed";
     850    $amt_text = "";
    822851    if (isset($values['amt_sales']) && $values['amt_sales'] > 0) {
    823         $amt_text = '$'.number_format($values['amt_sales'],0);
    824         $message .= "Amount owed: $".number_format($values['amt_sales'],0)."<br /><br />";
    825     }
     852        if (isset($values['amount_paid']) && $values['amount_paid'] > 0) {
     853            $amount_owed = $values['amt_sales'] - $values['amount_paid'];
     854        } else {
     855            $amount_owed = $values['amt_sales'];
     856        }
     857        $amt_text .= '$'.$amount_owed;
     858        $message .= 'Amount owed: $'.$amt_text;
     859    }
     860   
    826861    $body = str_replace("[amount]", $amt_text, $body);
    827862    $body = $start.$body.$end;
  • cwsl-lotto-1049/trunk/public/css/_notes/dwsync.xml

    r3218453 r3234240  
    11<?xml version="1.0" encoding="utf-8" ?>
    22<dwsync>
    3 <file name="cwsl-lotto-1049-public.css" server="ftp.charlenesweb.ca/charlenesweb.ca/" local="133793818261873098" remote="133803372600000000" />
     3<file name="cwsl-lotto-1049-public.css" server="ftp.charlenesweb.ca/charlenesweb.ca/" local="133805171400000000" remote="133805171400000000" />
    44</dwsync>
  • cwsl-lotto-1049/trunk/public/js/_notes/dwsync.xml

    r3218453 r3234240  
    11<?xml version="1.0" encoding="utf-8" ?>
    22<dwsync>
    3 <file name="cwsl-lotto-1049-public.js" server="ftp.charlenesweb.ca/charlenesweb.ca/" local="133793827637380897" remote="133803374400000000" />
     3<file name="cwsl-lotto-1049-public.js" server="ftp.charlenesweb.ca/charlenesweb.ca/" local="133805171400000000" remote="133805171400000000" />
    44</dwsync>
  • cwsl-lotto-1049/trunk/public/partials/_notes/dwsync.xml

    r3218453 r3234240  
    11<?xml version="1.0" encoding="utf-8" ?>
    22<dwsync>
    3 <file name="cwsl-lotto-1049-public-display.php" server="ftp.charlenesweb.ca/charlenesweb.ca/" local="133803232358647109" remote="133803376200000000" />
     3<file name="cwsl-lotto-1049-public-display.php" server="ftp.charlenesweb.ca/charlenesweb.ca/" local="133830792581935452" remote="133830937800000000" />
    44</dwsync>
  • cwsl-lotto-1049/trunk/public/partials/cwsl-lotto-1049-public-display.php

    r3218453 r3234240  
    143143        <p>
    144144            <label>How Did You Hear About Us?
    145             <select name="how_heard" required>
     145            <select name="how_heard">
    146146                <option value="">Choose ...</option>';
    147147                foreach ($how_heards as $val => $long) {
     
    212212                        $ct .= ' selected ';
    213213                    }
    214                     $ct .= '>'.esc_html($draw->title).'</option>';
     214                    $ct .= '>'.esc_html($draw->title);
     215                    if (isset($draw->paid) && $draw->paid == 1 && isset($draw->amount_sales) && $draw->amount_sales>0) {
     216                        $ct .= ' (You have paid $'.$draw->amount_sales.' for this lotto)';
     217                    }
     218                    $ct .= '</option>';
    215219                }
    216220            $fee20 = 20 * count($draws);
Note: See TracChangeset for help on using the changeset viewer.