Skip to content
Draft
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion admin/class-bread-admin.php
Original file line number Diff line number Diff line change
Expand Up @@ -511,7 +511,7 @@ function pwsix_process_wizard()
while (0 === strpos(bin2hex($encode_options), 'efbbbf')) {
$encode_options = substr($encode_options, 3);
}
$settings = json_decode($encode_options, true);
$settings = $this->bread->upgrade_settings(json_decode($encode_options, true));
$ncols = substr_count($settings['meeting_template_content'], '<td');
$id = $this->bread->loadAllSettings([]);
$id = $this->bread->isInitialSetting() ? 1 : ((is_numeric($_POST['wizard_setting_id'])) ? intval($_POST['wizard_setting_id']) : $this->bread->getMaxSetting() + 1);
Expand Down
4 changes: 2 additions & 2 deletions admin/css/admin.css
Original file line number Diff line number Diff line change
Expand Up @@ -404,7 +404,7 @@ input.bmlt-input {width: 60% !important;}input.borough-by-suffix, input.county-b
width: 80% !important;
}
input.bmlt-input-field {
width: 4em !important;
width: 6em !important;
}
.mce-listbox button {
text-align: left;
Expand Down Expand Up @@ -559,4 +559,4 @@ select.bread_service_body_select {
.select2-search--inline { display: contents; }
#custom-fonts .bulkactions {
display: none;
}
}
3 changes: 1 addition & 2 deletions admin/js/bmlt_meeting_list.js
Original file line number Diff line number Diff line change
Expand Up @@ -380,10 +380,9 @@
) {
let prefix = "";
for (i = 0; i < level; i++) prefix += "-";
const sbVal = [sb.name, sb.id, sb.parent_id, my_parent].join(",");
const option =
'<option value="' +
sbVal +
sb.id +
'" ' +
(bread_admin.service_bodies_selected.includes(sb.id)
? "selected"
Expand Down
5 changes: 2 additions & 3 deletions admin/js/bread-wizard.js
Original file line number Diff line number Diff line change
Expand Up @@ -91,8 +91,7 @@ jQuery(document).ready(function($){
BreadWizard.write_service_body_with_childern = function(options, sb, parents, my_parent, level) {
let prefix = '';
for (i=0; i<level; i++) prefix += '-';
const sbVal = [sb.name,sb.id,sb.parent_id, my_parent].join(',');
options.push('<option value="'+sbVal+'">'+prefix+sb.name+'</option>');
options.push('<option value="'+sb.id+'">'+prefix+sb.name+'</option>');
found = parents.find((p) => p.id == sb.id);
if (typeof found !== 'undefined')
found.children.forEach((child) =>
Expand Down Expand Up @@ -178,7 +177,7 @@ jQuery(document).ready(function($){
break;
case 2:
const services = $('#wizard_service_bodies').val().reduce((carry,item) => {
carry += '&services[]='+item.split(',')[1];
carry += '&services[]='+item;
return carry;
}, '&recursive=1');
const formats = (Number($('#wizard_format_filter').val()) > 0) ? '&formats='+$('#wizard_format_filter').val() : '';
Expand Down
2 changes: 1 addition & 1 deletion admin/partials/_bmlt_server_setup.php
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@ function Bread_bmlt_server_setup_page_render(Bread_AdminDisplay $breadAdmin)
<script type="text/javascript">
window.bread_admin = {};
window.bread_admin.root_server = '<?php echo esc_js($bread->getOption('root_server')); ?>';
window.bread_admin.service_bodies_selected = <?php echo json_encode($bread->getOption('service_bodies')); ?>.map(x => x.split(',')[1]);
window.bread_admin.service_bodies_selected = <?php echo json_encode($bread->getOption('service_bodies')); ?>;
window.bread_admin.extra_meetings = <?php echo json_encode($bread->getOption('extra_meetings')); ?>;
window.bread_admin.used_format = '<?php echo esc_js($bread->getOption('used_format_1')); ?>';
window.bread_admin.additional_list_format_key = '<?php echo esc_js($bread->getOption('additional_list_format_key')); ?>';
Expand Down
4 changes: 2 additions & 2 deletions bmlt-meeting-list.php
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@
* Plugin Name: Bread
* Plugin URI: https://bmlt.app
* Description: Maintains and generates PDF Meeting Lists from BMLT.
* Version: 2.10.9
* Version: 2.11.0
* Author: bmlt-enabled
* Author URI: https://bmlt.app/
* License: GPL-2.0+
Expand All @@ -30,7 +30,7 @@
* Start at version 2.8.0 and use SemVer - https://semver.org
* Rename this for your plugin and update it as you release new versions.
*/
define('BREAD_VERSION', '2.10.5');
define('BREAD_VERSION', '2.11.0');

/**
* The code that runs during plugin activation.
Expand Down
2 changes: 1 addition & 1 deletion composer.json
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@
"mpdf/mpdf": "8.3.1",
"monolog/monolog": "3.8.1",
"mpdf/qrcode": "^1.0",
"myclabs/deep-copy": "1.11.1"
"myclabs/deep-copy": "^1.14"
},
"require-dev": {
"squizlabs/php_codesniffer": "3.*",
Expand Down
23 changes: 12 additions & 11 deletions composer.lock

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

45 changes: 13 additions & 32 deletions includes/class-bread-bmlt.php
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,6 @@ class Bread_Bmlt
{
public $connection_error;
private $bmlt_server_lang = '';
private array $unique_areas;
private array $service_bodies_by_id = [];
private Bread $bread;
private ?array $preloaded = null;
Expand Down Expand Up @@ -58,42 +57,28 @@ private function get(string $url): WP_Error | array
}
return wp_remote_get($url, $args);
}
/**
* Generates a list of service bodies to be used in the admin UI's drop downs.
*
* @return array the service bodies.
*/
public function get_areas()
private function load_service_bodies()
{
if (!empty($this->unique_areas)) {
return $this->unique_areas;
}
$result = ($this->preloaded !== null) ? $this->preloaded['serviceBodies']
: $this->get_configured_root_server_request("client_interface/json/?switcher=GetServiceBodies");
$this->unique_areas = array();
if (empty($this->service_bodies_by_id)) {
$result = ($this->preloaded !== null) ? $this->preloaded['serviceBodies']
: $this->get_configured_root_server_request("client_interface/json/?switcher=GetServiceBodies");

foreach ($result as $value) {
$this->service_bodies_by_id[$value['id']] = $value;
$parent_name = 'Parent ID';
foreach ($result as $parent) {
if ($value['parent_id'] == $parent['id']) {
$parent_name = $parent['name'];
}
}
if ($value['parent_id'] == '') {
$value['parent_id'] = '0';
foreach ($result as $value) {
$this->service_bodies_by_id[$value['id']] = $value;
}
$this->unique_areas[] = $value['name'] . ',' . $value['id'] . ',' . $value['parent_id'] . ',' . $parent_name;
}

return $this->unique_areas;
}
public function get_service_bodies(): array
{
$this->load_service_bodies();
return $this->service_bodies_by_id ?? [];
}
/**
* Returns the GetServiceBodies entry for $id, or null.
*/
public function get_service_body(string $id): ?array
{
$this->get_areas();
$this->load_service_bodies();
return $this->service_bodies_by_id[$id] ?? null;
}
public function generateMainQuery($json = 'json')
Expand Down Expand Up @@ -249,11 +234,7 @@ public function generateDefaultQuery(): string
// needs to be called once.
if (!$this->default_query) {
$this->default_query = ($this->bread->getOption('recurse_service_bodies')) ? '&recursive=1' : '';
for ($i=0; $i<count($this->bread->getOption('service_bodies')); $i++) {
$area_data = explode(',', $this->bread->getOption('service_bodies')[$i]);
$service_body_id = $this->bread->arraySafeGet($area_data, 1);
$this->default_query .= '&services[]=' . $service_body_id;
}
$this->default_query .= '&services[]=' . implode('&services[]=', $this->bread->getOption('service_bodies'));
}
return $this->default_query;
}
Expand Down
Loading
Loading