Author Topic: Booking 2.x error in DB table  (Read 334 times)

Offline rumen

  • Posts: 408
Booking 2.x error in DB table
« on: November 21, 2019, 04:35:50 PM »
Hi there,
I try to run module Booking, but I got strange error

Code: [Select]
Incorrect integer value: '' for column `relax`.`wb_mod_bookings_groups`.`group_id` at row 1
And I really can't get what is wrong here:



Thanks in advance!

Regards,

Offline dbs

  • Betatester
  • **
  • Posts: 8144
  • Gender: Male
  • tioz4ever
    • WebsiteBaker - jQuery-Plugins - Module - Droplets - Tests
Re: Booking 2.x error in DB table
« Reply #1 on: November 21, 2019, 06:28:34 PM »
Hi, there is nothing with "relax" in the module, so far i see.What have you tried, how can i reproduce the error?

Offline rumen

  • Posts: 408
Re: Booking 2.x error in DB table
« Reply #2 on: November 21, 2019, 07:25:40 PM »
Hello,

When I try to make new entry (never mind a group or just a simple entry) I got same error:

Code: [Select]
Incorrect integer value: '' for column `relax`.`wb_mod_bookings_groups`.`group_id` at row 1
That's all. Front end - Nothing, Back End the error above.

Regards,

Offline dbs

  • Betatester
  • **
  • Posts: 8144
  • Gender: Male
  • tioz4ever
    • WebsiteBaker - jQuery-Plugins - Module - Droplets - Tests
Re: Booking 2.x error in DB table
« Reply #3 on: November 21, 2019, 08:08:37 PM »
New entry or new group is no problem here.
Except if i go into a entry, there is a red bordered box on the top, but without content.

Offline rumen

  • Posts: 408
Re: Booking 2.x error in DB table
« Reply #4 on: November 21, 2019, 10:00:52 PM »
Maybe there is any problem with the installation. Code2 also doesn't work. Whatever you put inside after save there is empty box. Registration 4 even give error too: Error!: could not find driver

This is what I get whatever I try to enter in Booking:



I put last WB 2.12.2 Stable. PHP 7.3

Offline dbs

  • Betatester
  • **
  • Posts: 8144
  • Gender: Male
  • tioz4ever
    • WebsiteBaker - jQuery-Plugins - Module - Droplets - Tests
Re: Booking 2.x error in DB table
« Reply #5 on: November 21, 2019, 10:45:22 PM »
Yes, sounds like install problems.
You could upload all files again and then make a "upgrade" via i-button in the top menu.
 

Offline DarkViper

  • Forum administrator
  • *****
  • Posts: 3034
  • Gender: Female
Re: Booking 2.x error in DB table
« Reply #6 on: November 21, 2019, 10:51:10 PM »
The error message looks like a mess of data types. This increasingly occurs in newer installations and strict database.
Let's see, maybe we can solve the problem on a 'short way'.

The error message states that the data field `group_id` should be assigned an invalid integer value.
That's completely right, because according to the code, a number is passed to the field as a string!
For example, null or an empty string are definitely not valid integers. Therefore, typecasts are needed for the values ​​to be sanitized.
Here are the instructions that fix this bug.

open the file modules/bookings/functions.php
scroll down to function Bookings_edit_Groups$section '' ) (around line 1788)
In this function you will find 3 SQL statements,
which you change as follows:

  • /* --- old ------------------------------------------- */
    $sql   "DELETE FROM ".TABLE_PREFIX."mod_bookings_groups WHERE "
              
    "page_id = '$page_id' AND section_id = '$section' "
              
    "AND group_id = '$group_id'";
    /* --- new ------------------------------------------- */
    $sql 'DELETE FROM `'.TABLE_PREFIX.'mod_bookings_groups` '
            
    'WHERE `group_id`='.(int) $group_id

  • /* --- old ------------------------------------------- */
    $sql "UPDATE ".TABLE_PREFIX."mod_bookings_groups SET "
            
    "name = '$group_name', color = '$color' "
            
    "WHERE group_id = ".$modified_id;
    /* --- new ------------------------------------------- */
    $sql 'UPDATE `'.TABLE_PREFIX.'mod_bookings_groups` '
            
    'SET `name`=\''.$database->escapeString($group_name).'\', '
            
    .     '`color`= \''.$database->escapeString($color).'\', '
            
    'WHERE `group_id`='.(int) $modified_id;

  • /* --- old ------------------------------------------- */
    $sql "INSERT INTO ".TABLE_PREFIX."mod_bookings_groups VALUES( "
            
    "NULL, '$page_id', '$section', '$group_name', '$color'"
            
    ")";
    /* --- new ------------------------------------------- */
    $sql 'INSERT INTO `'.TABLE_PREFIX.'mod_bookings_groups` '
            
    'SET `page_id`='.(int) $page_id.', '
            
    .     '`section_id`='.(int) $section.', '
            
    .     '`name`=\''.$database->escapeString($group_name).'\', '
            
    .     '`color`= \''.$database->escapeString($color).'\'';

Theoretically, the above solution should work. If not, then probably the installation must be checked. (as dbs wrote)
Der blaue Planet - er ist nicht unser Eigentum - wir haben ihn nur von unseren Nachkommen geliehen

"You have to take the men as they are… but you can not leave them like that !" :-P
Das tägliche Stoßgebet: Oh Herr, wirf Hirn vom Himmel !

Offline dbs

  • Betatester
  • **
  • Posts: 8144
  • Gender: Male
  • tioz4ever
    • WebsiteBaker - jQuery-Plugins - Module - Droplets - Tests
Re: Booking 2.x error in DB table
« Reply #7 on: November 21, 2019, 11:03:35 PM »
Manu is right.
But i also on strict and my install of bookings was new today. No problems.
Ruman has also problems with code2 and i'm sure with other things too.
So i think the install of wb was not right. Missing files after FTP transfer maybe.

Offline rumen

  • Posts: 408
Re: Booking 2.x error in DB table
« Reply #8 on: November 21, 2019, 11:31:05 PM »
It is installed on the XAMPP - local server for now. I will transfer it to the host in 1-2 days when I finish to configure modules.

With Code 2 I have never had problem in the past. First time is today. Usually got problems with languages (Cyrillic) and many times with lightbox ... just like now again. Missing controls in Minigal 2. And this time I have only one jQuery.

I refreshed the data base. Changed the codes as per the instructions above and now I was able to create the groups, but again same error when save data input in the module.   

Offline rumen

  • Posts: 408
Re: Booking 2.x error in DB table
« Reply #9 on: November 22, 2019, 01:21:30 PM »
I have just upload the site to the host. Code2 works perfect now. All calendars were down. I spoke with the host and they fixed one. From all calendars only one ("My calendar") works but it is enough. Booking and Registration Manager couldn't run. My Calendar - the issue was in the host "Mod_security" was enabled. They added the rules for the site and My Calendar works now.

The issue with JQuiry unfortunately remains. Controls still missing in Mini Gallery 2.x   

Offline rumen

  • Posts: 408
Re: Booking 2.x error in DB table
« Reply #10 on: November 24, 2019, 10:14:09 PM »
Well. No error messages and again no any success with "booking"

Here is the module with entry:


Here is the entry:


And here is the result ... nothing

Offline dbs

  • Betatester
  • **
  • Posts: 8144
  • Gender: Male
  • tioz4ever
    • WebsiteBaker - jQuery-Plugins - Module - Droplets - Tests
Re: Booking 2.x error in DB table
« Reply #11 on: November 24, 2019, 10:49:19 PM »
Have tried the same entry like yours, also in front- and backend language BG. :-)It works.



PHP7.3.11, Firefox, Bootstrap3, jQuery 3.3.1

Offline dbs

  • Betatester
  • **
  • Posts: 8144
  • Gender: Male
  • tioz4ever
    • WebsiteBaker - jQuery-Plugins - Module - Droplets - Tests
Re: Booking 2.x error in DB table
« Reply #12 on: November 24, 2019, 10:58:09 PM »
If you have a errorlog message "each is deprecated". Try this in functions.php line 3039.

Replace
Code: [Select]
while ( list ( $index, $item ) = each ( $booked ) )
with
Code: [Select]
foreach ( $booked as $index => $item )

Offline rumen

  • Posts: 408
Re: Booking 2.x error in DB table
« Reply #13 on: November 25, 2019, 12:17:47 PM »
Now gave the error (after changes of the function line 3032):

The error:
Code: [Select]
There was an uncatched exception
syntax error, unexpected 'day' (T_STRING)
in line (47) of (/modules/bookings_v2/functions.php):


The line 47:
Code: [Select]
$date_array['day']    = $date_array['mday'];


Offline dbs

  • Betatester
  • **
  • Posts: 8144
  • Gender: Male
  • tioz4ever
    • WebsiteBaker - jQuery-Plugins - Module - Droplets - Tests
Re: Booking 2.x error in DB table
« Reply #14 on: November 25, 2019, 12:36:24 PM »
Strange. My line 47 looks so:
Code: [Select]
        $date_array[\'day\']    = $date_array[\'mday\'];

Offline rumen

  • Posts: 408
Re: Booking 2.x error in DB table
« Reply #15 on: November 25, 2019, 10:03:33 PM »
Does the other lines for "date" have also backslash?

My 42 to 52 lines looks like:

Code: [Select]
if ( ! function_exists('date_parse') ) {

    $eval_func =
    'function date_parse ( $date ) {
        $date_array = getdate(strtotime($date));
        $date_array['day']    = $date_array['mday'];
        $date_array['month']  = $date_array['mon'];
        $date_array['hour']   = $date_array['hours'];
        $date_array['minute'] = $date_array['minutes'];
        $date_array['second'] = $date_array['seconds'];
        return $date_array;

Offline dbs

  • Betatester
  • **
  • Posts: 8144
  • Gender: Male
  • tioz4ever
    • WebsiteBaker - jQuery-Plugins - Module - Droplets - Tests
Re: Booking 2.x error in DB table
« Reply #16 on: November 25, 2019, 10:34:42 PM »
This is the reason for your message with T_STRING.
I attache my module.

Offline dbs

  • Betatester
  • **
  • Posts: 8144
  • Gender: Male
  • tioz4ever
    • WebsiteBaker - jQuery-Plugins - Module - Droplets - Tests
Re: Booking 2.x error in DB table
« Reply #17 on: December 04, 2019, 06:04:27 PM »
Seems also not work for you, because no answer.

Offline DarkViper

  • Forum administrator
  • *****
  • Posts: 3034
  • Gender: Female
Re: Booking 2.x error in DB table
« Reply #18 on: December 05, 2019, 08:06:36 AM »
too much complicated at all... ;)

simply delete the whoole part:
---------
// workaround for PHP4 --- known to work with 4.4.9
if ( ! function_exists('date_parse') ) {

[…]
    );
}

---------
This section is definitely not needed anymore since WB no longer works with PHP-4.
« Last Edit: December 05, 2019, 08:11:39 AM by DarkViper »
Der blaue Planet - er ist nicht unser Eigentum - wir haben ihn nur von unseren Nachkommen geliehen

"You have to take the men as they are… but you can not leave them like that !" :-P
Das tägliche Stoßgebet: Oh Herr, wirf Hirn vom Himmel !

Offline rumen

  • Posts: 408
Re: Booking 2.x error in DB table
« Reply #19 on: December 05, 2019, 01:05:54 PM »
Lines commented



But got "Invalid parameter" when saving new entry.



I think something can there be a difference between the settings of the server hour:min   and the module?

And this one:


Offline dbs

  • Betatester
  • **
  • Posts: 8144
  • Gender: Male
  • tioz4ever
    • WebsiteBaker - jQuery-Plugins - Module - Droplets - Tests
Re: Booking 2.x error in DB table
« Reply #20 on: December 05, 2019, 03:25:44 PM »
The box with red border is for messages. I think it's a mistake in design, should not be visibale all the time.

There is a file save.php which i can't understand. It will update a table mod_bookings. But this table is not created by install.php. So i don't know what here will be saved and where.

But the module works for me.