post by lolo57 on Jul 13, 2023

I use an ultra simple code to test, in codeigniter4

public function test()
{
$crud = $this->_getGroceryCrudEnterprise();
$crud->setSubject(‘Test’,‘test’);
$crud->setTable(‘test’);
$output = $crud->render();
return $this->_superadmin_output($output);
}

There is only 2 field in my table
id and thedate in format datetime.

The Add form see the date label, but there is no date field.
If I put my function in the Example.php, I hace the same result, impossible to Edit or add date. Other field type work like a charm.

Last version of groceryCrudEnterprise and CI4.

PLease Help, I’m a little bit desesparate.

post by bgeneto on Jul 13, 2023

Which DBMS are you using (MySQL, MariaDB, Postgres…)? Datetime fields should appear like this (in your language/format, of course):


I’m using GCE v3.0.9.

post by lolo57 on Jul 14, 2023

Version Apache 2.4.57
Version de MySQL 5.7.42

I think it’s a problem on a config file maybe in Codeigniter or GC ?

post by johnny on Jul 14, 2023

Hello @lolo57 ,

Can you maybe try the native date or datetime to see if that works for you?

For example:

$crud->fieldType('your_field_name', 'native_date');

or:

$crud->fieldType('your_field_name', 'native_datetime');

Regards
Johnny

post by lolo57 on Jul 14, 2023

Hello John,

with native_datetime it seem that work, even it’s not the result hopped with a date picker.

Laurent.

I hope this response give you a way to find the problem.

Thank you for your help.

post by lolo57 on Jul 15, 2023

Hello, yes it’s working, as there only one field I don’t see the date picker, but when integrated in my full controller I can see the date picker. But how I can limit the date picker date as I can do it with the normal date picker ?

post by johnny on Jul 15, 2023

For the normal datepicker try:

$crud->fieldType('your_field_name', 'date');

Let me know if that worked for you.

Regards
Johnny

post by lolo57 on Jul 15, 2023

Yes, it’s working with date. It’s strange I was sure to have already tried this.
I verified with no field type it’s not working, it’s a bug, or it’s normal. It seem me that before the type of field was automatically recognized.

Thank you.

post by johnny on Jul 16, 2023

Hello @lolo57 , yes indeed it should recognise it automatically. Can you share with us the type of the field into the database? Is that DATE? If you can share your structure of the table even better. For example something like this:

CREATE TABLE `customers` (
  `customerNumber` int NOT NULL,
  `customerName` varchar(50) NOT NULL,
  `contactLastName` varchar(50) NOT NULL,
  `contactFirstName` varchar(50) NOT NULL,
  `phone` varchar(50) NOT NULL,
  `addressLine1` varchar(50) NOT NULL,
  `addressLine2` varchar(50) DEFAULT NULL,
  `city` varchar(50) NOT NULL,
  `state` varchar(50) DEFAULT NULL,
  `postalCode` varchar(15) DEFAULT NULL,
  `country` varchar(50) NOT NULL,
  `salesRepEmployeeNumber` int DEFAULT NULL,
  `creditLimit` double DEFAULT NULL,
  `deleted` smallint DEFAULT '0'
) ENGINE=MyISAM DEFAULT CHARSET=latin1;

post by lolo57 on Jul 17, 2023

Hello John,

Now it’s working normally, I had a lack of space on my server, this lack of space created a very slow response, and some problems on Apache. After I resolve my space problem I need to reboot my server to get this virtual server work again. After this all seem to work normally. It’s very strange.

Sorry for the time passed, and thank you for your help.

28 days later

post by lolo57 on Aug 15, 2023

Hello, the bug reappear, there is no problem of space on my server, even if I rebboot the server, the problem is the same. I create a little news system :
public function news()
{
$crud = $this->_getGroceryCrudEnterprise();

    // Configurer Grocery CRUD
    $crud->setTable('news');
    $crud->setSubject('News');
    $crud->displayAs('video', 'Vidéo');
   
    $crud->setTexteditor(['texte']);
    $crud->setTheme('bootstrap-v4');
    $crud->fieldType('la_date', 'date');
    
    $crud->requiredFields(['titre']);
    $uploadValidations = [
        'maxUploadSize' => '20M', // 20 Mega Bytes
        'minUploadSize' => '1K', // 1 Kilo Byte
        'allowedFileTypes' => [
            'gif', 'jpeg', 'jpg', 'png'
        ]
    ];
    $crud->setFieldUpload('photo','assets/news/photos/', base_url() . '/assets/news/photos/', $uploadValidations);
    $crud->callbackAfterUpload(function ($result) {
        $fileName = $result->uploadResult;
     
        $fullPath = $result->uploadPath . $fileName;   
        $fullPath2=base_url() . '/assets/news/miniatures/';
     
        $image = new ImageResize($fullPath);
        $image->resizeToBestFit(1200, 800);
        $image->save($fullPath);
        $image2 = new ImageResize($fullPath);
        $image2->resizeToBestFit(400, 300);
        $image2->save($fullPath2);
        return $result;
     });
     // Afficher la liste des enregistrements
    $output = $crud->render();
    return $this->_superadmin_output($output);
   
}

my table :slight_smile: CREATE TABLE news (
id int(11) NOT NULL,
la_date date NOT NULL DEFAULT ‘2023-08-15’,
titre varchar(255) NOT NULL,
texte mediumtext NOT NULL,
photo varchar(255) NOT NULL,
video mediumtext NOT NULL,
afficher enum(‘oui’,‘non’) NOT NULL DEFAULT ‘oui’
) ENGINE=InnoDB DEFAULT CHARSET=latin1;

All work fine exept the field date, the field not appear in edit or add form. It’s strange the field appear correctly in columns, with the correct previous entered date. Note I know that delete miniature file not yet implemented.

And the other table where appear the problem initially, have the problem too again, even I do no modification in the controller.

I’m a little desesparate.

post by lolo57 on Aug 15, 2023

It’s very curious, the bug is inconsitant, now it’s desapear again.
I don’t understand !

1 / 12
Jul 2023