Plugin Directory

Changeset 3462665


Ignore:
Timestamp:
02/16/2026 03:57:16 PM (6 weeks ago)
Author:
tharkun69
Message:

1.4.17

  • Fix: CSV Import of schedules and blocks
  • Tested with WordPress version 6.9.1
Location:
occupancy-plan/trunk
Files:
6 edited

Legend:

Unmodified
Added
Removed
  • occupancy-plan/trunk/admin/class-occupancy-plan-admin.php

    r3398617 r3462665  
    928928     * 1.4.3 - Add 'checkblockconflict' column
    929929     * 1.4.13 - Add 'priority' column
     930     * 1.4.17 - CSV Import of schedules and blocks
    930931     */
    931932    public function csv_import($planID, $importblocks)
     
    947948        if (isset($planID))
    948949        {
    949             $message = __('Competition', 'occupancy-plan') . ' ' . $this->plans->get_plan($planID)->name. '<br/>';
     950            $message = __('Competition', 'occupancy-plan') . ': ' . $this->plans->get_plan($planID)->name. '<br/>';
    950951        }
    951952        else
     
    956957        if (empty($filename) == true)
    957958        {
    958             return $message . __('Missing file name', 'occupancy-plan');
     959            return $message . __('Missing file name', 'occupancy-plan') . '<br/>' . __('Import cancelled', 'occupancy-plan');
    959960        }
    960961        else
     
    11071108                        if (($courtname != "0") && ($courtname != ""))
    11081109                        {
    1109                             $court = $wpdb->get_row("SELECT * FROM $table_court_name WHERE planid = $planID AND name = $courtname");
     1110                            $court = $wpdb->get_row("SELECT * FROM $table_court_name WHERE planid = $planID AND name = '$courtname'");
    11101111                        }
    11111112
     
    11791180                    }
    11801181
     1182                    $preparedblock = $wpdb->get_row("SELECT * FROM $table_prepared_block WHERE planid = $planID AND name = '$csvdata[2]'");
     1183                    if (isset($preparedblock))
     1184                    {
     1185                        $message .= __('Row', 'occupancy-plan') . $row . ': '
     1186                            . __('Prepared block skipped.', 'occupancy-plan') . '<br/>';
     1187                        break;
     1188                    }
     1189
    11811190                    $blockdata = array(
    11821191                        'planid' => $planID,
     
    12191228                    }
    12201229
     1230                    $court = $wpdb->get_row("SELECT * FROM $table_court_name WHERE planid = $planID AND name = '$csvdata[2]'");
     1231                    if (isset($court))
     1232                    {
     1233                        $message .= __('Row', 'occupancy-plan') . $row . ': '
     1234                            . __('Existimg court skipped.', 'occupancy-plan') . '<br/>';
     1235                        break;
     1236                    }
     1237
    12211238                    $blockdata = array(
    12221239                        'planid' => $planID,
     
    12561273                        $message .= __('Row', 'occupancy-plan') . $row . ': '
    12571274                            . __('Time slot contains not enough elements.', 'occupancy-plan') . '<br/>';
     1275                        break;
     1276                    }
     1277
     1278                    $timeslot = $wpdb->get_row("SELECT * FROM $table_time_slot WHERE planid = $planID AND starttime = '$csvdata[1]'");
     1279                    if (isset($timeslot))
     1280                    {
     1281                        $message .= __('Row', 'occupancy-plan') . $row . ': '
     1282                            . __('Existimg time slot skipped.', 'occupancy-plan') . '<br/>';
    12581283                        break;
    12591284                    }
  • occupancy-plan/trunk/admin/controller/class-occupancy-plan-blocks.php

    r3422796 r3462665  
    2424     * 1.4.13 - Add column priority
    2525     * 1.4.15 - Change default for prioritry to 9
     26     * 1.4.17 - Set court if only one court is available
    2627     */
    2728    public function new_block($plan)
     
    3334        $block->name = '';
    3435        $block->description = '';
    35         $block->court = 0;
     36        $block->court = ($plan->courts > 1)? 0:1;
    3637        $block->childcourt = 1;
    3738        $block->weekday = date("w");
  • occupancy-plan/trunk/admin/partials/occupancy-plan-block.php

    r3398617 r3462665  
    182182                            <div class="op-admin-form-col-8">
    183183                                <?php if (isset($mode)) { ?>
    184                                     <select class="op-admin-input-100 op-courtselect" name="court" width="150" style="width: 150px">
    185                                         <option value="0" <?php echo ($block->court == 0) ? 'selected' : ''?>><?php echo __('Complete', 'occupancy-plan') ?></option>
    186                                         <?php foreach($courts as $court) {  ?>
    187                                           <option value="<?php echo $court->id ?>" <?php echo ($court->id == $block->court) ? 'selected' : ''?>><?php echo $court->name ?></option>
    188                                         <?php } ?>
    189                                     </select>
     184                                    <?php if (count($courts) > 2) { ?>
     185                                            <select class="op-admin-input-100 op-courtselect" name="court" width="150" style="width: 150px">
     186                                                    <option value="0" <?php echo ($block->court == 0) ? 'selected' : ''?>><?php echo __('Complete', 'occupancy-plan') ?></option>
     187                                                    <?php foreach($courts as $court) {  ?>
     188                                                        <option value="<?php echo $court->id ?>" <?php echo ($court->id == $block->court) ? 'selected' : ''?>><?php echo $court->name ?></option>
     189                                                    <?php } ?>
     190                                            </select>
     191                                    <?php } else { ?>
     192                                            <input class="op-admin-input-100" type="text" name="court" value="<?php echo esc_attr($this->blocks->get_court_label($plan, $block->court))?>" readonly />
     193                                    <?php } ?>
    190194                                <?php } else { ?>
    191195                                    <input class="op-admin-input-100" type="text" name="court" value="<?php echo esc_attr($this->blocks->get_court_label($plan, $block->court))?>" readonly />
  • occupancy-plan/trunk/admin/partials/occupancy-plan-plan.php

    r3414331 r3462665  
    7777        $message = (isset($state["op_msgid"]))? $this->plans->get_message(intval($state["op_msgid"])) : NULL;
    7878        $errormessage = (isset($state["op_msgid"]))? $this->plans->get_error_message(intval($state["op_msgid"])) : NULL;
    79         $tab = (isset($state['op_tabid']))? intval($state['op_tabid']) : 1;
     79        $tab = (isset($state['op_plan_tabid']))? intval($state['op_plan_tabid']) : 1;
    8080    }
    8181    else
     
    8383        $errormessage = __('Schedule not found!', 'occupancy-plan');
    8484        $state["op_planid"] = 0;
    85     }
    86 
    87     $state["op_tabid"] = 0;
     85        $tab = 1;
     86    }
     87
     88    if (isset($_POST['csvimport']))
     89    {
     90        $message = $this->csv_import($planID, 1);
     91    }
     92
     93    $state["op_plan_tabid"] = $tab;
    8894    $state["op_msgid"] = 0;
    8995    $lastpage = (isset($state["op_lastpage"]))? $state["op_lastpage"] : 'plan';
     
    107113        <div id="message" class="updated notice is-dismissible">
    108114            <p>
    109                 <?php echo esc_html($message) ?>
     115                <?php echo $message ?>
    110116            </p>
    111117        </div>
     
    661667                        </div>
    662668                    </div>
     669                    <div class="op-admin-action-panel-bottom-1">
     670                        <div class="op-admin-form-group">
     671                            <div class="op-admin-form-col-4">
     672                            </div>
     673                            <div class="op-admin-form-col-8">
     674                                <form method="post" enctype="multipart/form-data">
     675                                    <label for="import_file"><?php echo __('CSV Import', 'occupancy-plan');?></label>&nbsp;
     676                                    <input type="file" accept=".csv" name="import_file" >
     677                                    <?php submit_button(__('CSV Import', 'occupancy-plan'), 'secondary', 'csvimport', false); ?>
     678                                </form>
     679                            </div>
     680                        </div>
     681                    </div>
    663682                </div>
    664683                <div class="op-provisional-bookings-tab">
  • occupancy-plan/trunk/occupancy-plan.php

    r3429196 r3462665  
    1616 * Plugin URI:        https://www.software-kunze.de/plugins/occupancy-plan/
    1717 * Description:       Management of Occupancy Plans
    18  * Version:           1.4.16
     18 * Version:           1.4.17
    1919 * Author:            Alexander Kunze Software Consulting
    2020 * Author URI:        https://www.software-kunze.de
     
    3636 * Rename this for your plugin and update it as you release new versions.
    3737 */
    38 define('Occupancy_Plan', '1.4.16');
     38define('Occupancy_Plan', '1.4.17');
    3939
    4040/**
  • occupancy-plan/trunk/readme.txt

    r3429196 r3462665  
    22Contributors: tharkun69
    33Donate link: https://www.software-kunze.de/
    4 Tags: Occupancy Plan, Belegungsplan, Booking, Buchungen, Hallenbelegung, Reservierung
     4Tags: Occupancy Plan, Belegungsplan, Booking, Buchungen, Hallenbelegung
    55Requires at least: 4.9
    6 Tested up to: 6.9
    7 Stable tag: 1.4.16
     6Tested up to: 6.9.1
     7Stable tag: 1.4.17
    88Requires PHP: 5.2.4
    99License: GPLv2 or later
     
    5252== Changelog ==
    5353
     54= 1.4.17 =
     55* Fix: CSV Import of schedules and blocks
     56* Tested with WordPress version 6.9.1
     57           
    5458= 1.4.16 =
    5559* Fix: Display of the correct week when the first week begins in the previous year
Note: See TracChangeset for help on using the changeset viewer.