ClinicCases icon indicating copy to clipboard operation
ClinicCases copied to clipboard

I cant create a new case

Open amanuelabate opened this issue 8 years ago • 5 comments

When i click on New Case i cant get the form to fill out the new case data. Here is below the Error. casesMessages.js:116 Uncaught TypeError: Cannot read property 'error' of null(anonymous function) @ casesMessages.js:116handleSuccess @ jquery-1.4.4.min.js:142w.onreadystatechange @ jquery-1.4.4.min.js:141 I installed ClinicCases in Centos httpd 2.4.6, in case you need these details.

Please help me with it ASAP.

amanuelabate avatar Sep 01 '16 14:09 amanuelabate

I don't think this error is caused by casesMessages.js. To debug, have a look in Developer Tools at the network requests when you press "New Case". See what the response is to the request to create_new_case.php and cases_case_data_load.php. That should give you a clue to the problem; usually it is a database configuration error.

judsonmitchell avatar Dec 27 '16 16:12 judsonmitchell

Also got this problem. Seems to be a problem with a missing default value. Got this in $error[2]

Field 'clinic_type' doesn't have a default value

jameskraus avatar Jul 27 '17 20:07 jameskraus

This is a result of mysql strict mode. Newer Ubuntu distributions are shipping with mysql strict mode enabled by default, and I'm sure that's now the case with other distros. I plan to review the db schema and queries to make it compliant with strict mode, but that may take a while. (Happy for anybody to help with that!). In the meantime, you can either disable strict mode in your mysql config or, alternatively, replace the db.php in the ClinicCases distribution with this:


<?php
require_once('_CONFIG.php');
try {
    $dbh = new PDO("mysql:host=" . CC_DBHOST . ";dbname=" . CC_DATABASE_NAME , CC_DBUSERNAME, CC_DBPASSWD, array(PDO::MYSQL_ATTR_INIT_COMMAND => 'SET sql_mode="IGNORE_SPACE,NO_ZERO_IN_DATE,NO_ZERO_DATE,ERROR_FOR_DIVISION_BY_ZERO,NO_AUTO_CREATE_USER,NO_ENGINE_SUBSTITUTION"') );
 }
catch(PDOException $e) {
    //400 is sent to trigger an error for ajax requests.
    header('HTTP/1.1 400 Bad Request');
    echo $e->getMessage();
 }

Let me know how that goes.

judsonmitchell avatar Jul 27 '17 21:07 judsonmitchell

I have just started to use ClinicCases with MariaDB 10. Three main reasons for errors:

  • no Default value in DB scheme fields
  • incorrect (empty, NULL) datetime
  • Incorrect string value (when UTF-8 characters used).

I will create a fork of the project to maintain all updates.

arnisjuraga avatar Jul 28 '20 05:07 arnisjuraga

This is a result of mysql strict mode. Newer Ubuntu distributions are shipping with mysql strict mode enabled by default, and I'm sure that's now the case with other distros. I plan to review the db schema and queries to make it compliant with strict mode, but that may take a while. (Happy for anybody to help with that!). In the meantime, you can either disable strict mode in your mysql config or, alternatively, replace the db.php in the ClinicCases distribution with this:


<?php
require_once('_CONFIG.php');
try {
    $dbh = new PDO("mysql:host=" . CC_DBHOST . ";dbname=" . CC_DATABASE_NAME , CC_DBUSERNAME, CC_DBPASSWD, array(PDO::MYSQL_ATTR_INIT_COMMAND => 'SET sql_mode="IGNORE_SPACE,NO_ZERO_IN_DATE,NO_ZERO_DATE,ERROR_FOR_DIVISION_BY_ZERO,NO_AUTO_CREATE_USER,NO_ENGINE_SUBSTITUTION"') );
 }
catch(PDOException $e) {
    //400 is sent to trigger an error for ajax requests.
    header('HTTP/1.1 400 Bad Request');
    echo $e->getMessage();
 }

Let me know how that goes.

This solved the issue for me. Thank you! 👍

fhadad avatar Sep 21 '20 15:09 fhadad