WebsiteBaker Community Forum

WebsiteBaker Support (2.12.x) => General Help & Support => Topic started by: rumen on November 21, 2019, 04:35:50 PM

Title: Booking 2.x error in DB table
Post by: rumen 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:

(https://i.imgur.com/yXwXZkT.png)

Thanks in advance!

Regards,
Title: Re: Booking 2.x error in DB table
Post by: dbs 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?
Title: Re: Booking 2.x error in DB table
Post by: rumen 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,
Title: Re: Booking 2.x error in DB table
Post by: dbs 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.
Title: Re: Booking 2.x error in DB table
Post by: rumen 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:

(https://i.imgur.com/nHePgT8.png)

I put last WB 2.12.2 Stable. PHP 7.3
Title: Re: Booking 2.x error in DB table
Post by: dbs 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.
 
Title: Re: Booking 2.x error in DB table
Post by: DarkViper 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:
Theoretically, the above solution should work. If not, then probably the installation must be checked. (as dbs wrote)
Title: Re: Booking 2.x error in DB table
Post by: dbs 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.
Title: Re: Booking 2.x error in DB table
Post by: rumen 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.   
Title: Re: Booking 2.x error in DB table
Post by: rumen 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   
Title: Re: Booking 2.x error in DB table
Post by: rumen 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:
(https://i.imgur.com/ZauB1yd.png)

Here is the entry:
(https://i.imgur.com/0wxFr8U.png)

And here is the result ... nothing (https://greecerelax.com/pages/bg/test.php)
Title: Re: Booking 2.x error in DB table
Post by: dbs on November 24, 2019, 10:49:19 PM
Have tried the same entry like yours, also in front- and backend language BG. :-)It works.

(https://i.imgur.com/ZV3ah7n.jpg)

PHP7.3.11, Firefox, Bootstrap3, jQuery 3.3.1
Title: Re: Booking 2.x error in DB table
Post by: dbs 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 )
Title: Re: Booking 2.x error in DB table
Post by: rumen 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'];

Title: Re: Booking 2.x error in DB table
Post by: dbs on November 25, 2019, 12:36:24 PM
Strange. My line 47 looks so:
Code: [Select]
        $date_array[\'day\']    = $date_array[\'mday\'];
Title: Re: Booking 2.x error in DB table
Post by: rumen 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;
Title: Re: Booking 2.x error in DB table
Post by: dbs on November 25, 2019, 10:34:42 PM
This is the reason for your message with T_STRING.
I attache my module.
Title: Re: Booking 2.x error in DB table
Post by: dbs on December 04, 2019, 06:04:27 PM
Seems also not work for you, because no answer.
Title: Re: Booking 2.x error in DB table
Post by: DarkViper 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.
Title: Re: Booking 2.x error in DB table
Post by: rumen on December 05, 2019, 01:05:54 PM
Lines commented

(https://i.imgur.com/XHJ3uAo.png)

But got "Invalid parameter" when saving new entry.

(https://i.imgur.com/cZOk4qy.png)

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

And this one:

(https://i.imgur.com/giPsVjZ.png)
Title: Re: Booking 2.x error in DB table
Post by: dbs 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.