Announcement

Collapse
No announcement yet.

SC Making Default Value Assumptions

Collapse
X
  • Filter
  • Time
  • Show
Clear All
new posts

  • SC Making Default Value Assumptions

    While it was my mistake in setting a field value and accidentally mis-spelling it in one of the events to set it to a value, I found generated code within scriptcase that will automatically set a default value based on the field type. This is wrong!

    I figured this out because I had set a default value in the table column in MySQL. The default value was never set on insert to the value I assigned to the column (and yes I expected it to use the default because I wasn't passing a value by accident). I do not expect an application to set a default value behind the scenes. While I understand there are ways to do it in the SC field definition, SC should not assume that it should default a value based on data type.

    Here is the code I found:
    4485| if ($this->payment_complete == "")
    4486| {
    4487|
    $this->payment_complete = 0;
    4488|
    $this->sc_force_zero[] = 'payment_complete';

    Here is other code I found that sets a field to a default value:


    4466| if ($this->idregsitry == "")
    4467| {
    4468|
    $this->idregsitry = 0;
    4469| }
    4470| if (
    $this->vessel_loa == "")
    4471| {
    4472|
    $this->vessel_loa = 0;
    4473|
    $this->sc_force_zero[] = 'vessel_loa';
    4474| }
    4475| if (
    $this->vessel_beam == "")
    4476| {
    4477|
    $this->vessel_beam = 0;
    4478|
    $this->sc_force_zero[] = 'vessel_beam';
    4479| }
    4480| if (
    $this->vessel_draft == "")
    4481| {
    4482|
    $this->vessel_draft = 0;
    4483|
    $this->sc_force_zero[] = 'vessel_draft';
    4484| }

    No application should set a default if none is coded in the field definition within the application. This is a bad assumption on SC's part. This needs to be changed.

Working...
X