Plugin Directory

Changeset 3422796


Ignore:
Timestamp:
12/18/2025 11:45:18 AM (3 months ago)
Author:
tharkun69
Message:

1.4.15

  • Fix: Block exceptions - Fix of occupancy_plan_get_state_value for op_blockid
  • Fix: Show correct edit forms, when changing block interval
  • Change default for block priority to 9
  • Fix: Don't hide blocks with lower priority by exception blocks
  • Fix: Consideration of block exceptions during the examination of block conflict
Location:
occupancy-plan/trunk
Files:
11 edited

Legend:

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

    r3398617 r3422796  
    2323     * 1.3.14 - Use schedule default color for new block in backend
    2424     * 1.4.13 - Add column priority
     25     * 1.4.15 - Change default for prioritry to 9
    2526     */
    2627    public function new_block($plan)
     
    5657        $block->customfield4 = '';
    5758        $block->provisional = 0;
    58         $block->priority = 1;
     59        $block->priority = 9;
    5960
    6061        return $block;
     
    784785     * @since    1.4.3
    785786     *
     787     * 1.4.15 - Consideration of block exceptions during the examination
     788     *
    786789     */
    787790    public function check_block()
     
    835838                 (('$endtime' > starttime) AND ('$endtime' <= endtime)))
    836839            AND ((`interval` <> 3) OR (intervalinfo = {$weekdayinmonth}))
    837             AND ((`interval` <> 5) OR (intervalinfo = {$calendarweek}))
     840            AND ((`interval` <> 5) OR (intervalinfo = {$calendarweek}))";
     841
     842        $results = $wpdb->get_results($sql, OBJECT);
     843
     844        $index = 0;
     845        while (($index < sizeof($results)) && ($this->check_block_exception($results[$index], $date) != 0))
     846        {
     847            $index++;
     848        }
     849
     850        return ($index < sizeof($results));
     851    }
     852
     853    /**
     854     * Check if block is hidden by a block exception
     855     *
     856     * @since    1.4.15
     857     *
     858     */
     859    private function check_block_exception($block, $currentdate)
     860    {
     861        global $wpdb;
     862        $table_block_exception = "{$wpdb->prefix}occupancy_plan_block_exception";
     863        $sql = "SELECT * FROM $table_block_exception WHERE blockid = {$block->id}
     864            AND ('{$currentdate->format('Y-m-d')}' BETWEEN startdate AND enddate)
    838865            LIMIT 1";
    839 
    840866        $results = $wpdb->get_results($sql, OBJECT);
    841867        return sizeof($results);
    842868    }
     869
    843870}
  • occupancy-plan/trunk/admin/js/occupancy-plan-admin.js

    r3398617 r3422796  
    213213                $('.op-singledate').hide();
    214214                $('.op-intervalinfo').hide();
    215                 $('v.op-multidate').show();
     215                $('.op-multidate').show();
    216216                $('.op-intervalinfoselect-3').hide();
    217217                $('.op-intervalinfoselect-5').hide();
  • occupancy-plan/trunk/admin/partials/occupancy-plan-blocks.php

    r3398617 r3422796  
    8181    $state['op_planid'] = $planID;
    8282    $state['op_blockid'] = null;
    83     $blocksTable = new Occupancy_Plan_Blocks(false, false);
    84     $blocksTable->prepare_items();
    8583
    8684    // Save current state
    8785    occupancy_plan_set_state($state);
     86
     87    $blocksTable = new Occupancy_Plan_Blocks(false, false);
     88    $blocksTable->prepare_items();
    8889?>
    8990
  • occupancy-plan/trunk/admin/partials/occupancy-plan-court-names.php

    r3398617 r3422796  
    6161    }
    6262    $state['op_planid'] = $planID;
    63     $courtNamesTable = new Occupancy_Plan_Court_Names(false);
    64     $courtNamesTable->prepare_items();
    6563
    6664    // Save current state
    6765    occupancy_plan_set_state($state);
     66
     67    $courtNamesTable = new Occupancy_Plan_Court_Names(false);
     68    $courtNamesTable->prepare_items();
    6869?>
    6970
  • occupancy-plan/trunk/admin/partials/occupancy-plan-prepared-blocks.php

    r3398617 r3422796  
    6161    }
    6262    $state['op_planid'] = $planID;
    63     $blocksTable = new Occupancy_Plan_Prepared_Blocks(false);
    64     $blocksTable->prepare_items();
    6563
    6664    // Save current state
    6765    occupancy_plan_set_state($state);
     66
     67    $blocksTable = new Occupancy_Plan_Prepared_Blocks(false);
     68    $blocksTable->prepare_items();
    6869?>
    6970
  • occupancy-plan/trunk/admin/partials/occupancy-plan-provisional-blocks.php

    r3398617 r3422796  
    6767    }
    6868    $state['op_planid'] = $planID;
    69     $blocksTable = new Occupancy_Plan_Blocks(true, false);
    70     $blocksTable->prepare_items();
    7169
    7270    // Save current state
    7371    occupancy_plan_set_state($state);
     72
     73    $blocksTable = new Occupancy_Plan_Blocks(true, false);
     74    $blocksTable->prepare_items();
    7475?>
    7576
  • occupancy-plan/trunk/admin/partials/occupancy-plan-time-slots.php

    r3398617 r3422796  
    6262    }
    6363    $state['op_planid'] = $planID;
    64     $timeSlotsTable = new Occupancy_Plan_Time_Slots(false);
    65     $timeSlotsTable->prepare_items();
    6664
    6765    // Save current state
    6866    occupancy_plan_set_state($state);
     67
     68    $timeSlotsTable = new Occupancy_Plan_Time_Slots(false);
     69    $timeSlotsTable->prepare_items();
    6970?>
    7071
  • occupancy-plan/trunk/admin/table/class-occupancy-plan-block-exceptions.php

    r3398617 r3422796  
    193193     * @since    1.4
    194194     * @access   public
     195     *
     196     * 1.4.15 - Fix of occupancy_plan_get_state_value for op_blockid
    195197     */
    196198    public function get_block_exceptions($current_page, $per_page)
     
    211213        else
    212214        {
    213             $blockid = occupancy_plan_get_state_value('blockID', 0);
     215            $blockid = occupancy_plan_get_state_value('op_blockid', 0);
    214216            if ($blockid > 0)
    215217            {
  • occupancy-plan/trunk/occupancy-plan.php

    r3414331 r3422796  
    1616 * Plugin URI:        https://www.software-kunze.de/plugins/occupancy-plan/
    1717 * Description:       Management of Occupancy Plans
    18  * Version:           1.4.14
     18 * Version:           1.4.15
    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.14');
     38define('Occupancy_Plan', '1.4.15');
    3939
    4040/**
  • occupancy-plan/trunk/public/class-occupancy-plan-public.php

    r3414331 r3422796  
    756756     * 1.3.22 -Check block exceptions
    757757     * 1.4.13 - Order by priority
     758     * 1.4.15 - Don't hide blocks with lower priority by exception blocks     
    758759     */
    759760    private function get_month_blocks($month, $week, $courtID, $plan, $court_names)
     
    819820                        AND ((`interval` <> 3) OR ((intervalinfo = {$weekdayinmonth}) AND (weekday = {$weekday})))
    820821                        AND ((`interval` <> 5) OR (intervalinfo = {$calendarweek}))
    821                         ORDER BY priority
    822                         LIMIT 1";
     822                        ORDER BY priority";
    823823
    824824                    $results = $wpdb->get_results($sql, OBJECT);
    825                     if ((sizeof($results) > 0) && ($this->check_block_exception($results[0], $currentdate) == 0))
     825                    $index = 0;
     826                    while (($index < sizeof($results)) && ($this->check_block_exception($results[$index], $currentdate) != 0))
     827                    {
     828                        $index++;
     829                    }
     830
     831                    if ($index < sizeof($results))
    826832                    {
    827833                        if (($plan->checkcapability == 0) ||
     
    829835                           (current_user_can('place_occupancy')))
    830836                        {
    831                             $blockdetails = $this->get_details_array($results[0], $court_name, $plan);
     837                            $blockdetails = $this->get_details_array($results[$index], $court_name, $plan);
    832838                            $showdetails = is_user_logged_in()? 1 : $plan->showdetails;
    833839
    834840                            $blocks[] = array('name' => $currentdate->format("d"),
    835                                 'id' => $results[0]->id,
     841                                'id' => $results[$index]->id,
    836842                                'weekday' => $weekday,
    837843                                'editable' => $this->check_editable($showdetails, $blockdetails),
     
    844850                        {
    845851                            $blocks[] = array('name' => $currentdate->format("d"),
    846                                 'id' => $results[0]->id,
     852                                'id' => $results[$index]->id,
    847853                                'weekday' => $weekday,
    848854                                'editable' => false,
     
    898904     *        - Check block exceptions
    899905     * 1.4.13 - Order by priority
     906     * 1.4.15 - Don't hide blocks with lower priority by exception blocks
    900907     */
    901908    private function get_week_blocks($week, $time, $plan, $court_names, $courtID)
     
    931938                            AND ((`interval` <> 3) OR (intervalinfo = {$weekdayinmonth}))
    932939                            AND ((`interval` <> 5) OR (intervalinfo = {$calendarweek}))
    933                             ORDER BY priority
    934                             LIMIT 1";
     940                            ORDER BY priority";
    935941
    936942                        $results = $wpdb->get_results($sql, OBJECT);
    937                         if ((sizeof($results) > 0) && ($this->check_block_exception($results[0], $date) == 0))
     943                        $index = 0;
     944                        while (($index < sizeof($results)) && ($this->check_block_exception($results[$index], $date) != 0))
     945                        {
     946                            $index++;
     947                        }
     948
     949                        if ($index < sizeof($results))
    938950                        {
    939951                            if (($plan->checkcapability == 0) ||
     
    941953                               (current_user_can('place_occupancy')))
    942954                            {
    943                                 $blockdetails = $this->get_details_array($results[0], $court_name, $plan);
     955                                $blockdetails = $this->get_details_array($results[$index], $court_name, $plan);
    944956                                $showdetails = is_user_logged_in()? 1 : $plan->showdetails;
    945957
    946                                 $blocks[] = array('name' => $results[0]->shortname,
    947                                     'id' => $results[0]->id,
     958                                $blocks[] = array('name' => $results[$index]->shortname,
     959                                    'id' => $results[$index]->id,
    948960                                    'weekday' => $weekday,
    949961                                    'editable' => $this->check_editable($showdetails, $blockdetails),
     
    957969                                // Anonymized block name in Frontend
    958970                                $blockname = ((isset($plan->anonymized)) && ($plan->anonymized == 1))?
    959                                     $plan->placeholder : $results[0]->shortname;
     971                                    $plan->placeholder : $results[$index]->shortname;
    960972                                $tooltip = '';
    961973                                if ((isset($plan->anonymized)) && ($plan->anonymized == 0))
    962974                                {
    963975                                    // If frontend is not anoymized then show detailed tooltip
    964                                     $blockdetails = $this->get_details_array($results[0], $court_name, $plan);
     976                                    $blockdetails = $this->get_details_array($results[$index], $court_name, $plan);
    965977                                    $tooltip = $this->replace_tooltip_tags($plan->frontendtooltip, $blockdetails);
    966978                                }
    967979
    968980                                $blocks[] = array('name' => $blockname,
    969                                     'id' => $results[0]->id,
     981                                    'id' => $results[$index]->id,
    970982                                    'weekday' => $weekday,
    971983                                    'editable' => false,
     
    10211033     *        - Check block exceptions
    10221034     * 1.4.13 - Order by priority
     1035     * 1.4.15 - Don't hide blocks with lower priority by exception blocks
    10231036     */
    10241037    private function get_day_blocks($singledate, $time, $plan, $court_names, $courtID)
     
    10711084                        AND ((`interval` <> 3) OR (intervalinfo = {$weekdayinmonth}))
    10721085                        AND ((`interval` <> 5) OR (intervalinfo = {$calendarweek}))
    1073                         ORDER BY priority
    1074                         LIMIT 1";
     1086                        ORDER BY priority";
    10751087
    10761088                    $results = $wpdb->get_results($sql, OBJECT);
    10771089
    1078                     if ((sizeof($results) > 0) && ($this->check_block_exception($results[0], $date) == 0))
     1090                    $index = 0;
     1091                    while (($index < sizeof($results)) && ($this->check_block_exception($results[$index], $date) != 0))
     1092                    {
     1093                        $index++;
     1094                    }
     1095
     1096                    if ($index < sizeof($results))
    10791097                    {
    10801098                        if (($plan->checkcapability == 0) ||
     
    10821100                           (current_user_can('place_occupancy')))
    10831101                        {
    1084                             $blockdetails = $this->get_details_array($results[0], $court_name, $plan);
     1102                            $blockdetails = $this->get_details_array($results[$index], $court_name, $plan);
    10851103                            $showdetails = is_user_logged_in()? 1: $plan->showdetails;
    10861104
    1087                             $blocks[] = array('name' => $results[0]->shortname,
    1088                                 'id' => $results[0]->id,
     1105                            $blocks[] = array('name' => $results[$index]->shortname,
     1106                                'id' => $results[$index]->id,
    10891107                                'weekday' => 0,
    10901108                                'editable' => $this->check_editable($showdetails, $blockdetails),
     
    10981116                            // Anonymized block name in Frontend
    10991117                            $blockname = ((isset($plan->anonymized)) && ($plan->anonymized == 1))?
    1100                                 $plan->placeholder : $results[0]->shortname;
     1118                                $plan->placeholder : $results[$index]->shortname;
    11011119                            $tooltip = '';
    11021120                            if ((isset($plan->anonymized)) && ($plan->anonymized == 0))
    11031121                            {
    11041122                                // If frontend is not anoymized then show detailed tooltip
    1105                                 $blockdetails = $this->get_details_array($results[0], $court_name, $plan);
     1123                                $blockdetails = $this->get_details_array($results[$index], $court_name, $plan);
    11061124                                $tooltip = $this->replace_tooltip_tags($plan->frontendtooltip, $blockdetails);
    11071125                            }
    11081126
    11091127                            $blocks[] = array('name' => $blockname,
    1110                                 'id' => $results[0]->id,
     1128                                'id' => $results[$index]->id,
    11111129                                'weekday' => 0,
    11121130                                'editable' => false,
  • occupancy-plan/trunk/readme.txt

    r3414331 r3422796  
    55Requires at least: 4.9
    66Tested up to: 6.9
    7 Stable tag: 1.4.14
     7Stable tag: 1.4.15
    88Requires PHP: 5.2.4
    99License: GPLv2 or later
     
    5050== Changelog ==
    5151
     52= 1.4.15 =
     53* Fix: Block exceptions - Fix of occupancy_plan_get_state_value for op_blockid
     54* Fix: Show correct edit forms, when changing block interval
     55* Change default for block priority to 9
     56* Fix: Don't hide blocks with lower priority by exception blocks
     57* Fix: Consideration of block exceptions during the examination of block conflict
     58
    5259= 1.4.14 =
    5360* Support for break times also in the weekly view
Note: See TracChangeset for help on using the changeset viewer.