Changeset 3422796
- Timestamp:
- 12/18/2025 11:45:18 AM (3 months ago)
- Location:
- occupancy-plan/trunk
- Files:
-
- 11 edited
-
admin/controller/class-occupancy-plan-blocks.php (modified) (4 diffs)
-
admin/js/occupancy-plan-admin.js (modified) (1 diff)
-
admin/partials/occupancy-plan-blocks.php (modified) (1 diff)
-
admin/partials/occupancy-plan-court-names.php (modified) (1 diff)
-
admin/partials/occupancy-plan-prepared-blocks.php (modified) (1 diff)
-
admin/partials/occupancy-plan-provisional-blocks.php (modified) (1 diff)
-
admin/partials/occupancy-plan-time-slots.php (modified) (1 diff)
-
admin/table/class-occupancy-plan-block-exceptions.php (modified) (2 diffs)
-
occupancy-plan.php (modified) (2 diffs)
-
public/class-occupancy-plan-public.php (modified) (12 diffs)
-
readme.txt (modified) (2 diffs)
Legend:
- Unmodified
- Added
- Removed
-
occupancy-plan/trunk/admin/controller/class-occupancy-plan-blocks.php
r3398617 r3422796 23 23 * 1.3.14 - Use schedule default color for new block in backend 24 24 * 1.4.13 - Add column priority 25 * 1.4.15 - Change default for prioritry to 9 25 26 */ 26 27 public function new_block($plan) … … 56 57 $block->customfield4 = ''; 57 58 $block->provisional = 0; 58 $block->priority = 1;59 $block->priority = 9; 59 60 60 61 return $block; … … 784 785 * @since 1.4.3 785 786 * 787 * 1.4.15 - Consideration of block exceptions during the examination 788 * 786 789 */ 787 790 public function check_block() … … 835 838 (('$endtime' > starttime) AND ('$endtime' <= endtime))) 836 839 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) 838 865 LIMIT 1"; 839 840 866 $results = $wpdb->get_results($sql, OBJECT); 841 867 return sizeof($results); 842 868 } 869 843 870 } -
occupancy-plan/trunk/admin/js/occupancy-plan-admin.js
r3398617 r3422796 213 213 $('.op-singledate').hide(); 214 214 $('.op-intervalinfo').hide(); 215 $(' v.op-multidate').show();215 $('.op-multidate').show(); 216 216 $('.op-intervalinfoselect-3').hide(); 217 217 $('.op-intervalinfoselect-5').hide(); -
occupancy-plan/trunk/admin/partials/occupancy-plan-blocks.php
r3398617 r3422796 81 81 $state['op_planid'] = $planID; 82 82 $state['op_blockid'] = null; 83 $blocksTable = new Occupancy_Plan_Blocks(false, false);84 $blocksTable->prepare_items();85 83 86 84 // Save current state 87 85 occupancy_plan_set_state($state); 86 87 $blocksTable = new Occupancy_Plan_Blocks(false, false); 88 $blocksTable->prepare_items(); 88 89 ?> 89 90 -
occupancy-plan/trunk/admin/partials/occupancy-plan-court-names.php
r3398617 r3422796 61 61 } 62 62 $state['op_planid'] = $planID; 63 $courtNamesTable = new Occupancy_Plan_Court_Names(false);64 $courtNamesTable->prepare_items();65 63 66 64 // Save current state 67 65 occupancy_plan_set_state($state); 66 67 $courtNamesTable = new Occupancy_Plan_Court_Names(false); 68 $courtNamesTable->prepare_items(); 68 69 ?> 69 70 -
occupancy-plan/trunk/admin/partials/occupancy-plan-prepared-blocks.php
r3398617 r3422796 61 61 } 62 62 $state['op_planid'] = $planID; 63 $blocksTable = new Occupancy_Plan_Prepared_Blocks(false);64 $blocksTable->prepare_items();65 63 66 64 // Save current state 67 65 occupancy_plan_set_state($state); 66 67 $blocksTable = new Occupancy_Plan_Prepared_Blocks(false); 68 $blocksTable->prepare_items(); 68 69 ?> 69 70 -
occupancy-plan/trunk/admin/partials/occupancy-plan-provisional-blocks.php
r3398617 r3422796 67 67 } 68 68 $state['op_planid'] = $planID; 69 $blocksTable = new Occupancy_Plan_Blocks(true, false);70 $blocksTable->prepare_items();71 69 72 70 // Save current state 73 71 occupancy_plan_set_state($state); 72 73 $blocksTable = new Occupancy_Plan_Blocks(true, false); 74 $blocksTable->prepare_items(); 74 75 ?> 75 76 -
occupancy-plan/trunk/admin/partials/occupancy-plan-time-slots.php
r3398617 r3422796 62 62 } 63 63 $state['op_planid'] = $planID; 64 $timeSlotsTable = new Occupancy_Plan_Time_Slots(false);65 $timeSlotsTable->prepare_items();66 64 67 65 // Save current state 68 66 occupancy_plan_set_state($state); 67 68 $timeSlotsTable = new Occupancy_Plan_Time_Slots(false); 69 $timeSlotsTable->prepare_items(); 69 70 ?> 70 71 -
occupancy-plan/trunk/admin/table/class-occupancy-plan-block-exceptions.php
r3398617 r3422796 193 193 * @since 1.4 194 194 * @access public 195 * 196 * 1.4.15 - Fix of occupancy_plan_get_state_value for op_blockid 195 197 */ 196 198 public function get_block_exceptions($current_page, $per_page) … … 211 213 else 212 214 { 213 $blockid = occupancy_plan_get_state_value(' blockID', 0);215 $blockid = occupancy_plan_get_state_value('op_blockid', 0); 214 216 if ($blockid > 0) 215 217 { -
occupancy-plan/trunk/occupancy-plan.php
r3414331 r3422796 16 16 * Plugin URI: https://www.software-kunze.de/plugins/occupancy-plan/ 17 17 * Description: Management of Occupancy Plans 18 * Version: 1.4.1 418 * Version: 1.4.15 19 19 * Author: Alexander Kunze Software Consulting 20 20 * Author URI: https://www.software-kunze.de … … 36 36 * Rename this for your plugin and update it as you release new versions. 37 37 */ 38 define('Occupancy_Plan', '1.4.1 4');38 define('Occupancy_Plan', '1.4.15'); 39 39 40 40 /** -
occupancy-plan/trunk/public/class-occupancy-plan-public.php
r3414331 r3422796 756 756 * 1.3.22 -Check block exceptions 757 757 * 1.4.13 - Order by priority 758 * 1.4.15 - Don't hide blocks with lower priority by exception blocks 758 759 */ 759 760 private function get_month_blocks($month, $week, $courtID, $plan, $court_names) … … 819 820 AND ((`interval` <> 3) OR ((intervalinfo = {$weekdayinmonth}) AND (weekday = {$weekday}))) 820 821 AND ((`interval` <> 5) OR (intervalinfo = {$calendarweek})) 821 ORDER BY priority 822 LIMIT 1"; 822 ORDER BY priority"; 823 823 824 824 $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)) 826 832 { 827 833 if (($plan->checkcapability == 0) || … … 829 835 (current_user_can('place_occupancy'))) 830 836 { 831 $blockdetails = $this->get_details_array($results[ 0], $court_name, $plan);837 $blockdetails = $this->get_details_array($results[$index], $court_name, $plan); 832 838 $showdetails = is_user_logged_in()? 1 : $plan->showdetails; 833 839 834 840 $blocks[] = array('name' => $currentdate->format("d"), 835 'id' => $results[ 0]->id,841 'id' => $results[$index]->id, 836 842 'weekday' => $weekday, 837 843 'editable' => $this->check_editable($showdetails, $blockdetails), … … 844 850 { 845 851 $blocks[] = array('name' => $currentdate->format("d"), 846 'id' => $results[ 0]->id,852 'id' => $results[$index]->id, 847 853 'weekday' => $weekday, 848 854 'editable' => false, … … 898 904 * - Check block exceptions 899 905 * 1.4.13 - Order by priority 906 * 1.4.15 - Don't hide blocks with lower priority by exception blocks 900 907 */ 901 908 private function get_week_blocks($week, $time, $plan, $court_names, $courtID) … … 931 938 AND ((`interval` <> 3) OR (intervalinfo = {$weekdayinmonth})) 932 939 AND ((`interval` <> 5) OR (intervalinfo = {$calendarweek})) 933 ORDER BY priority 934 LIMIT 1"; 940 ORDER BY priority"; 935 941 936 942 $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)) 938 950 { 939 951 if (($plan->checkcapability == 0) || … … 941 953 (current_user_can('place_occupancy'))) 942 954 { 943 $blockdetails = $this->get_details_array($results[ 0], $court_name, $plan);955 $blockdetails = $this->get_details_array($results[$index], $court_name, $plan); 944 956 $showdetails = is_user_logged_in()? 1 : $plan->showdetails; 945 957 946 $blocks[] = array('name' => $results[ 0]->shortname,947 'id' => $results[ 0]->id,958 $blocks[] = array('name' => $results[$index]->shortname, 959 'id' => $results[$index]->id, 948 960 'weekday' => $weekday, 949 961 'editable' => $this->check_editable($showdetails, $blockdetails), … … 957 969 // Anonymized block name in Frontend 958 970 $blockname = ((isset($plan->anonymized)) && ($plan->anonymized == 1))? 959 $plan->placeholder : $results[ 0]->shortname;971 $plan->placeholder : $results[$index]->shortname; 960 972 $tooltip = ''; 961 973 if ((isset($plan->anonymized)) && ($plan->anonymized == 0)) 962 974 { 963 975 // 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); 965 977 $tooltip = $this->replace_tooltip_tags($plan->frontendtooltip, $blockdetails); 966 978 } 967 979 968 980 $blocks[] = array('name' => $blockname, 969 'id' => $results[ 0]->id,981 'id' => $results[$index]->id, 970 982 'weekday' => $weekday, 971 983 'editable' => false, … … 1021 1033 * - Check block exceptions 1022 1034 * 1.4.13 - Order by priority 1035 * 1.4.15 - Don't hide blocks with lower priority by exception blocks 1023 1036 */ 1024 1037 private function get_day_blocks($singledate, $time, $plan, $court_names, $courtID) … … 1071 1084 AND ((`interval` <> 3) OR (intervalinfo = {$weekdayinmonth})) 1072 1085 AND ((`interval` <> 5) OR (intervalinfo = {$calendarweek})) 1073 ORDER BY priority 1074 LIMIT 1"; 1086 ORDER BY priority"; 1075 1087 1076 1088 $results = $wpdb->get_results($sql, OBJECT); 1077 1089 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)) 1079 1097 { 1080 1098 if (($plan->checkcapability == 0) || … … 1082 1100 (current_user_can('place_occupancy'))) 1083 1101 { 1084 $blockdetails = $this->get_details_array($results[ 0], $court_name, $plan);1102 $blockdetails = $this->get_details_array($results[$index], $court_name, $plan); 1085 1103 $showdetails = is_user_logged_in()? 1: $plan->showdetails; 1086 1104 1087 $blocks[] = array('name' => $results[ 0]->shortname,1088 'id' => $results[ 0]->id,1105 $blocks[] = array('name' => $results[$index]->shortname, 1106 'id' => $results[$index]->id, 1089 1107 'weekday' => 0, 1090 1108 'editable' => $this->check_editable($showdetails, $blockdetails), … … 1098 1116 // Anonymized block name in Frontend 1099 1117 $blockname = ((isset($plan->anonymized)) && ($plan->anonymized == 1))? 1100 $plan->placeholder : $results[ 0]->shortname;1118 $plan->placeholder : $results[$index]->shortname; 1101 1119 $tooltip = ''; 1102 1120 if ((isset($plan->anonymized)) && ($plan->anonymized == 0)) 1103 1121 { 1104 1122 // 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); 1106 1124 $tooltip = $this->replace_tooltip_tags($plan->frontendtooltip, $blockdetails); 1107 1125 } 1108 1126 1109 1127 $blocks[] = array('name' => $blockname, 1110 'id' => $results[ 0]->id,1128 'id' => $results[$index]->id, 1111 1129 'weekday' => 0, 1112 1130 'editable' => false, -
occupancy-plan/trunk/readme.txt
r3414331 r3422796 5 5 Requires at least: 4.9 6 6 Tested up to: 6.9 7 Stable tag: 1.4.1 47 Stable tag: 1.4.15 8 8 Requires PHP: 5.2.4 9 9 License: GPLv2 or later … … 50 50 == Changelog == 51 51 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 52 59 = 1.4.14 = 53 60 * Support for break times also in the weekly view
Note: See TracChangeset
for help on using the changeset viewer.