[Koha-bugs] [Bug 21610] Koha::Object->store needs to handle incorrect values

2019-02-07 Thread bugzilla-daemon
https://bugs.koha-community.org/bugzilla3/show_bug.cgi?id=21610

Lucas Gass  changed:

   What|Removed |Added

 CC||lu...@bywatersolutions.com

--- Comment #55 from Lucas Gass  ---
cant cleanly apply this patch set. if needed in 18.05.x please rebase. thanks

-- 
You are receiving this mail because:
You are watching all bug changes.
___
Koha-bugs mailing list
Koha-bugs@lists.koha-community.org
http://lists.koha-community.org/cgi-bin/mailman/listinfo/koha-bugs
website : http://www.koha-community.org/
git : http://git.koha-community.org/
bugs : http://bugs.koha-community.org/


[Koha-bugs] [Bug 21610] Koha::Object->store needs to handle incorrect values

2019-02-04 Thread bugzilla-daemon
https://bugs.koha-community.org/bugzilla3/show_bug.cgi?id=21610

Martin Renvoize  changed:

   What|Removed |Added

 Status|Pushed to Master|Pushed to Stable

--- Comment #54 from Martin Renvoize  ---
Pushed to 18.11.x for 18.11.03

-- 
You are receiving this mail because:
You are watching all bug changes.
___
Koha-bugs mailing list
Koha-bugs@lists.koha-community.org
http://lists.koha-community.org/cgi-bin/mailman/listinfo/koha-bugs
website : http://www.koha-community.org/
git : http://git.koha-community.org/
bugs : http://bugs.koha-community.org/


[Koha-bugs] [Bug 21610] Koha::Object->store needs to handle incorrect values

2019-02-01 Thread bugzilla-daemon
https://bugs.koha-community.org/bugzilla3/show_bug.cgi?id=21610

Nick Clemens  changed:

   What|Removed |Added

 Status|Passed QA   |Pushed to Master

-- 
You are receiving this mail because:
You are watching all bug changes.
___
Koha-bugs mailing list
Koha-bugs@lists.koha-community.org
http://lists.koha-community.org/cgi-bin/mailman/listinfo/koha-bugs
website : http://www.koha-community.org/
git : http://git.koha-community.org/
bugs : http://bugs.koha-community.org/


[Koha-bugs] [Bug 21610] Koha::Object->store needs to handle incorrect values

2019-02-01 Thread bugzilla-daemon
https://bugs.koha-community.org/bugzilla3/show_bug.cgi?id=21610

--- Comment #53 from Nick Clemens  ---
Awesome work all!

Pushed to master for 19.05

-- 
You are receiving this mail because:
You are watching all bug changes.
___
Koha-bugs mailing list
Koha-bugs@lists.koha-community.org
http://lists.koha-community.org/cgi-bin/mailman/listinfo/koha-bugs
website : http://www.koha-community.org/
git : http://git.koha-community.org/
bugs : http://bugs.koha-community.org/


[Koha-bugs] [Bug 21610] Koha::Object->store needs to handle incorrect values

2019-02-01 Thread bugzilla-daemon
https://bugs.koha-community.org/bugzilla3/show_bug.cgi?id=21610

--- Comment #52 from Tomás Cohen Arazi  ---
Created attachment 84647
  -->
https://bugs.koha-community.org/bugzilla3/attachment.cgi?id=84647=edit
Bug 21610: Improve default values for dates

This patch fixes failures on t/db_dependent/Koha/Patrons/Import.t
and keep t/Auth_with_shibboleth.t and t/db_dependent/Koha/Object.t green

Signed-off-by: Kyle M Hall 
Signed-off-by: Tomas Cohen Arazi 

-- 
You are receiving this mail because:
You are watching all bug changes.
___
Koha-bugs mailing list
Koha-bugs@lists.koha-community.org
http://lists.koha-community.org/cgi-bin/mailman/listinfo/koha-bugs
website : http://www.koha-community.org/
git : http://git.koha-community.org/
bugs : http://bugs.koha-community.org/

[Koha-bugs] [Bug 21610] Koha::Object->store needs to handle incorrect values

2019-02-01 Thread bugzilla-daemon
https://bugs.koha-community.org/bugzilla3/show_bug.cgi?id=21610

--- Comment #48 from Tomás Cohen Arazi  ---
Created attachment 84643
  -->
https://bugs.koha-community.org/bugzilla3/attachment.cgi?id=84643=edit
Bug 21610: Remove specific changes we made previously

We handled integers and dates for Koha::Patron and Koha::ItemType, we
want now Koha::Object to deal with.

Signed-off-by: Kyle M Hall 
Signed-off-by: Tomas Cohen Arazi 

-- 
You are receiving this mail because:
You are watching all bug changes.
___
Koha-bugs mailing list
Koha-bugs@lists.koha-community.org
http://lists.koha-community.org/cgi-bin/mailman/listinfo/koha-bugs
website : http://www.koha-community.org/
git : http://git.koha-community.org/
bugs : http://bugs.koha-community.org/

[Koha-bugs] [Bug 21610] Koha::Object->store needs to handle incorrect values

2019-02-01 Thread bugzilla-daemon
https://bugs.koha-community.org/bugzilla3/show_bug.cgi?id=21610

--- Comment #51 from Tomás Cohen Arazi  ---
Created attachment 84646
  -->
https://bugs.koha-community.org/bugzilla3/attachment.cgi?id=84646=edit
Bug 21610: (follow-up) Default value for dates

We have some dates with DEFAULT CURRENT_TIMESTAMP and some dates with
default and UPDATE clause.

Test plan:
Run Object.t again.

Signed-off-by: Marcel de Rooy 

Signed-off-by: Kyle M Hall 
Signed-off-by: Tomas Cohen Arazi 

-- 
You are receiving this mail because:
You are watching all bug changes.
___
Koha-bugs mailing list
Koha-bugs@lists.koha-community.org
http://lists.koha-community.org/cgi-bin/mailman/listinfo/koha-bugs
website : http://www.koha-community.org/
git : http://git.koha-community.org/
bugs : http://bugs.koha-community.org/

[Koha-bugs] [Bug 21610] Koha::Object->store needs to handle incorrect values

2019-02-01 Thread bugzilla-daemon
https://bugs.koha-community.org/bugzilla3/show_bug.cgi?id=21610

--- Comment #50 from Tomás Cohen Arazi  ---
Created attachment 84645
  -->
https://bugs.koha-community.org/bugzilla3/attachment.cgi?id=84645=edit
Bug 21610: (QA follow-up) Better use columns_info from DBIx

We should better use the published method than a private hash key.
And shorter to go via _result than adding a new schema call.

Signed-off-by: Marcel de Rooy 

Signed-off-by: Kyle M Hall 
Signed-off-by: Tomas Cohen Arazi 

-- 
You are receiving this mail because:
You are watching all bug changes.
___
Koha-bugs mailing list
Koha-bugs@lists.koha-community.org
http://lists.koha-community.org/cgi-bin/mailman/listinfo/koha-bugs
website : http://www.koha-community.org/
git : http://git.koha-community.org/
bugs : http://bugs.koha-community.org/

[Koha-bugs] [Bug 21610] Koha::Object->store needs to handle incorrect values

2019-02-01 Thread bugzilla-daemon
https://bugs.koha-community.org/bugzilla3/show_bug.cgi?id=21610

Tomás Cohen Arazi  changed:

   What|Removed |Added

  Attachment #84601|0   |1
is obsolete||

-- 
You are receiving this mail because:
You are watching all bug changes.
___
Koha-bugs mailing list
Koha-bugs@lists.koha-community.org
http://lists.koha-community.org/cgi-bin/mailman/listinfo/koha-bugs
website : http://www.koha-community.org/
git : http://git.koha-community.org/
bugs : http://bugs.koha-community.org/

[Koha-bugs] [Bug 21610] Koha::Object->store needs to handle incorrect values

2019-02-01 Thread bugzilla-daemon
https://bugs.koha-community.org/bugzilla3/show_bug.cgi?id=21610

Tomás Cohen Arazi  changed:

   What|Removed |Added

  Attachment #84606|0   |1
is obsolete||

-- 
You are receiving this mail because:
You are watching all bug changes.
___
Koha-bugs mailing list
Koha-bugs@lists.koha-community.org
http://lists.koha-community.org/cgi-bin/mailman/listinfo/koha-bugs
website : http://www.koha-community.org/
git : http://git.koha-community.org/
bugs : http://bugs.koha-community.org/

[Koha-bugs] [Bug 21610] Koha::Object->store needs to handle incorrect values

2019-02-01 Thread bugzilla-daemon
https://bugs.koha-community.org/bugzilla3/show_bug.cgi?id=21610

--- Comment #49 from Tomás Cohen Arazi  ---
Created attachment 84644
  -->
https://bugs.koha-community.org/bugzilla3/attachment.cgi?id=84644=edit
Bug 21610: Fix integers and dates values at Koha::Object->store level

With strict SQL modes, we are facing several issues when objects are stored.

The following errors can be raised by DBIx::Class when an object does not have
a valid (as defined at DB level) value:
- Incorrect integer value: '' for column COLUMN
- Incorrect decimal value: '' for column COLUMN
- Column 'COLUMN' cannot be null
- Field 'COLUMN' doesn't have a default value
- Incorrect date value: '' for column 'COLUMN'

We already handled some of them for Koha::Patron. As we do not want to provide
such
changes for all Koha::* modules we are going to fix this at Koha::Object->store
level
in order to provide a global fix.

This is related to bug 21599 (for item types) and bug 21596 (for patrons)

Test plan:
- Apply first patch, run the tests
=> Patch fail because of the previous error in Koha::ItemType->store, to make
them pass
you can replace
  $self->notforloan(0) unless $self->notforloan;
with
  $self->notforloan(undef) unless $self->notforloan;
- Apply second patch, run the tests
=> They fail because of dates and/or integers values
- Apply third patch, run the tests
=> They now pass

Deep code review wanted!

Signed-off-by: Kyle M Hall 
Signed-off-by: Tomas Cohen Arazi 

-- 
You are receiving this mail because:
You are watching all bug changes.
___
Koha-bugs mailing list
Koha-bugs@lists.koha-community.org
http://lists.koha-community.org/cgi-bin/mailman/listinfo/koha-bugs
website : http://www.koha-community.org/
git : http://git.koha-community.org/
bugs : http://bugs.koha-community.org/

[Koha-bugs] [Bug 21610] Koha::Object->store needs to handle incorrect values

2019-02-01 Thread bugzilla-daemon
https://bugs.koha-community.org/bugzilla3/show_bug.cgi?id=21610

Tomás Cohen Arazi  changed:

   What|Removed |Added

  Attachment #84603|0   |1
is obsolete||

-- 
You are receiving this mail because:
You are watching all bug changes.
___
Koha-bugs mailing list
Koha-bugs@lists.koha-community.org
http://lists.koha-community.org/cgi-bin/mailman/listinfo/koha-bugs
website : http://www.koha-community.org/
git : http://git.koha-community.org/
bugs : http://bugs.koha-community.org/

[Koha-bugs] [Bug 21610] Koha::Object->store needs to handle incorrect values

2019-02-01 Thread bugzilla-daemon
https://bugs.koha-community.org/bugzilla3/show_bug.cgi?id=21610

Tomás Cohen Arazi  changed:

   What|Removed |Added

  Attachment #84602|0   |1
is obsolete||

-- 
You are receiving this mail because:
You are watching all bug changes.
___
Koha-bugs mailing list
Koha-bugs@lists.koha-community.org
http://lists.koha-community.org/cgi-bin/mailman/listinfo/koha-bugs
website : http://www.koha-community.org/
git : http://git.koha-community.org/
bugs : http://bugs.koha-community.org/

[Koha-bugs] [Bug 21610] Koha::Object->store needs to handle incorrect values

2019-02-01 Thread bugzilla-daemon
https://bugs.koha-community.org/bugzilla3/show_bug.cgi?id=21610

Tomás Cohen Arazi  changed:

   What|Removed |Added

  Attachment #84604|0   |1
is obsolete||

-- 
You are receiving this mail because:
You are watching all bug changes.
___
Koha-bugs mailing list
Koha-bugs@lists.koha-community.org
http://lists.koha-community.org/cgi-bin/mailman/listinfo/koha-bugs
website : http://www.koha-community.org/
git : http://git.koha-community.org/
bugs : http://bugs.koha-community.org/

[Koha-bugs] [Bug 21610] Koha::Object->store needs to handle incorrect values

2019-02-01 Thread bugzilla-daemon
https://bugs.koha-community.org/bugzilla3/show_bug.cgi?id=21610

Tomás Cohen Arazi  changed:

   What|Removed |Added

  Attachment #84605|0   |1
is obsolete||

-- 
You are receiving this mail because:
You are watching all bug changes.
___
Koha-bugs mailing list
Koha-bugs@lists.koha-community.org
http://lists.koha-community.org/cgi-bin/mailman/listinfo/koha-bugs
website : http://www.koha-community.org/
git : http://git.koha-community.org/
bugs : http://bugs.koha-community.org/

[Koha-bugs] [Bug 21610] Koha::Object->store needs to handle incorrect values

2019-02-01 Thread bugzilla-daemon
https://bugs.koha-community.org/bugzilla3/show_bug.cgi?id=21610

--- Comment #47 from Tomás Cohen Arazi  ---
Created attachment 84642
  -->
https://bugs.koha-community.org/bugzilla3/attachment.cgi?id=84642=edit
Bug 21610: Add tests

Adding few tests to Koha/Object.t in order to highlight what we are
trying to fix.

Note that Koha::ItemType->store was wrong for notforloan, the default
value should be null
`notforloan` smallint(6) DEFAULT NULL,
but the previous fix (bug 21599) made it default to '0'

Signed-off-by: Kyle M Hall 
Signed-off-by: Tomas Cohen Arazi 

-- 
You are receiving this mail because:
You are watching all bug changes.
___
Koha-bugs mailing list
Koha-bugs@lists.koha-community.org
http://lists.koha-community.org/cgi-bin/mailman/listinfo/koha-bugs
website : http://www.koha-community.org/
git : http://git.koha-community.org/
bugs : http://bugs.koha-community.org/

[Koha-bugs] [Bug 21610] Koha::Object->store needs to handle incorrect values

2019-02-01 Thread bugzilla-daemon
https://bugs.koha-community.org/bugzilla3/show_bug.cgi?id=21610

--- Comment #46 from Tomás Cohen Arazi  ---
Created attachment 84606
  -->
https://bugs.koha-community.org/bugzilla3/attachment.cgi?id=84606=edit
Bug 21610: Improve default values for dates

This patch fixes failures on t/db_dependent/Koha/Patrons/Import.t
and keep t/Auth_with_shibboleth.t and t/db_dependent/Koha/Object.t green

Signed-off-by: Kyle M Hall 

-- 
You are receiving this mail because:
You are watching all bug changes.
___
Koha-bugs mailing list
Koha-bugs@lists.koha-community.org
http://lists.koha-community.org/cgi-bin/mailman/listinfo/koha-bugs
website : http://www.koha-community.org/
git : http://git.koha-community.org/
bugs : http://bugs.koha-community.org/

[Koha-bugs] [Bug 21610] Koha::Object->store needs to handle incorrect values

2019-02-01 Thread bugzilla-daemon
https://bugs.koha-community.org/bugzilla3/show_bug.cgi?id=21610

--- Comment #45 from Tomás Cohen Arazi  ---
Created attachment 84605
  -->
https://bugs.koha-community.org/bugzilla3/attachment.cgi?id=84605=edit
Bug 21610: (follow-up) Default value for dates

We have some dates with DEFAULT CURRENT_TIMESTAMP and some dates with
default and UPDATE clause.

Test plan:
Run Object.t again.

Signed-off-by: Marcel de Rooy 

Signed-off-by: Kyle M Hall 

-- 
You are receiving this mail because:
You are watching all bug changes.
___
Koha-bugs mailing list
Koha-bugs@lists.koha-community.org
http://lists.koha-community.org/cgi-bin/mailman/listinfo/koha-bugs
website : http://www.koha-community.org/
git : http://git.koha-community.org/
bugs : http://bugs.koha-community.org/

[Koha-bugs] [Bug 21610] Koha::Object->store needs to handle incorrect values

2019-02-01 Thread bugzilla-daemon
https://bugs.koha-community.org/bugzilla3/show_bug.cgi?id=21610

--- Comment #44 from Tomás Cohen Arazi  ---
Created attachment 84604
  -->
https://bugs.koha-community.org/bugzilla3/attachment.cgi?id=84604=edit
Bug 21610: (QA follow-up) Better use columns_info from DBIx

We should better use the published method than a private hash key.
And shorter to go via _result than adding a new schema call.

Signed-off-by: Marcel de Rooy 

Signed-off-by: Kyle M Hall 

-- 
You are receiving this mail because:
You are watching all bug changes.
___
Koha-bugs mailing list
Koha-bugs@lists.koha-community.org
http://lists.koha-community.org/cgi-bin/mailman/listinfo/koha-bugs
website : http://www.koha-community.org/
git : http://git.koha-community.org/
bugs : http://bugs.koha-community.org/

[Koha-bugs] [Bug 21610] Koha::Object->store needs to handle incorrect values

2019-02-01 Thread bugzilla-daemon
https://bugs.koha-community.org/bugzilla3/show_bug.cgi?id=21610

--- Comment #43 from Tomás Cohen Arazi  ---
Created attachment 84603
  -->
https://bugs.koha-community.org/bugzilla3/attachment.cgi?id=84603=edit
Bug 21610: Fix integers and dates values at Koha::Object->store level

With strict SQL modes, we are facing several issues when objects are stored.

The following errors can be raised by DBIx::Class when an object does not have
a valid (as defined at DB level) value:
- Incorrect integer value: '' for column COLUMN
- Incorrect decimal value: '' for column COLUMN
- Column 'COLUMN' cannot be null
- Field 'COLUMN' doesn't have a default value
- Incorrect date value: '' for column 'COLUMN'

We already handled some of them for Koha::Patron. As we do not want to provide
such
changes for all Koha::* modules we are going to fix this at Koha::Object->store
level
in order to provide a global fix.

This is related to bug 21599 (for item types) and bug 21596 (for patrons)

Test plan:
- Apply first patch, run the tests
=> Patch fail because of the previous error in Koha::ItemType->store, to make
them pass
you can replace
  $self->notforloan(0) unless $self->notforloan;
with
  $self->notforloan(undef) unless $self->notforloan;
- Apply second patch, run the tests
=> They fail because of dates and/or integers values
- Apply third patch, run the tests
=> They now pass

Deep code review wanted!

Signed-off-by: Kyle M Hall 

-- 
You are receiving this mail because:
You are watching all bug changes.
___
Koha-bugs mailing list
Koha-bugs@lists.koha-community.org
http://lists.koha-community.org/cgi-bin/mailman/listinfo/koha-bugs
website : http://www.koha-community.org/
git : http://git.koha-community.org/
bugs : http://bugs.koha-community.org/

[Koha-bugs] [Bug 21610] Koha::Object->store needs to handle incorrect values

2019-02-01 Thread bugzilla-daemon
https://bugs.koha-community.org/bugzilla3/show_bug.cgi?id=21610

--- Comment #41 from Tomás Cohen Arazi  ---
Created attachment 84601
  -->
https://bugs.koha-community.org/bugzilla3/attachment.cgi?id=84601=edit
Bug 21610: Add tests

Adding few tests to Koha/Object.t in order to highlight what we are
trying to fix.

Note that Koha::ItemType->store was wrong for notforloan, the default
value should be null
`notforloan` smallint(6) DEFAULT NULL,
but the previous fix (bug 21599) made it default to '0'

Signed-off-by: Kyle M Hall 
Signed-off-by: Tomas Cohen Arazi 

-- 
You are receiving this mail because:
You are watching all bug changes.
___
Koha-bugs mailing list
Koha-bugs@lists.koha-community.org
http://lists.koha-community.org/cgi-bin/mailman/listinfo/koha-bugs
website : http://www.koha-community.org/
git : http://git.koha-community.org/
bugs : http://bugs.koha-community.org/

[Koha-bugs] [Bug 21610] Koha::Object->store needs to handle incorrect values

2019-02-01 Thread bugzilla-daemon
https://bugs.koha-community.org/bugzilla3/show_bug.cgi?id=21610

Tomás Cohen Arazi  changed:

   What|Removed |Added

  Attachment #81019|0   |1
is obsolete||

-- 
You are receiving this mail because:
You are watching all bug changes.
___
Koha-bugs mailing list
Koha-bugs@lists.koha-community.org
http://lists.koha-community.org/cgi-bin/mailman/listinfo/koha-bugs
website : http://www.koha-community.org/
git : http://git.koha-community.org/
bugs : http://bugs.koha-community.org/

[Koha-bugs] [Bug 21610] Koha::Object->store needs to handle incorrect values

2019-02-01 Thread bugzilla-daemon
https://bugs.koha-community.org/bugzilla3/show_bug.cgi?id=21610

--- Comment #42 from Tomás Cohen Arazi  ---
Created attachment 84602
  -->
https://bugs.koha-community.org/bugzilla3/attachment.cgi?id=84602=edit
Bug 21610: Remove specific changes we made previously

We handled integers and dates for Koha::Patron and Koha::ItemType, we
want now Koha::Object to deal with.

Signed-off-by: Kyle M Hall 

-- 
You are receiving this mail because:
You are watching all bug changes.
___
Koha-bugs mailing list
Koha-bugs@lists.koha-community.org
http://lists.koha-community.org/cgi-bin/mailman/listinfo/koha-bugs
website : http://www.koha-community.org/
git : http://git.koha-community.org/
bugs : http://bugs.koha-community.org/

[Koha-bugs] [Bug 21610] Koha::Object->store needs to handle incorrect values

2019-02-01 Thread bugzilla-daemon
https://bugs.koha-community.org/bugzilla3/show_bug.cgi?id=21610

Tomás Cohen Arazi  changed:

   What|Removed |Added

  Attachment #81021|0   |1
is obsolete||

-- 
You are receiving this mail because:
You are watching all bug changes.
___
Koha-bugs mailing list
Koha-bugs@lists.koha-community.org
http://lists.koha-community.org/cgi-bin/mailman/listinfo/koha-bugs
website : http://www.koha-community.org/
git : http://git.koha-community.org/
bugs : http://bugs.koha-community.org/

[Koha-bugs] [Bug 21610] Koha::Object->store needs to handle incorrect values

2019-02-01 Thread bugzilla-daemon
https://bugs.koha-community.org/bugzilla3/show_bug.cgi?id=21610

Tomás Cohen Arazi  changed:

   What|Removed |Added

  Attachment #81018|0   |1
is obsolete||

-- 
You are receiving this mail because:
You are watching all bug changes.
___
Koha-bugs mailing list
Koha-bugs@lists.koha-community.org
http://lists.koha-community.org/cgi-bin/mailman/listinfo/koha-bugs
website : http://www.koha-community.org/
git : http://git.koha-community.org/
bugs : http://bugs.koha-community.org/

[Koha-bugs] [Bug 21610] Koha::Object->store needs to handle incorrect values

2019-02-01 Thread bugzilla-daemon
https://bugs.koha-community.org/bugzilla3/show_bug.cgi?id=21610

Tomás Cohen Arazi  changed:

   What|Removed |Added

  Attachment #81020|0   |1
is obsolete||

-- 
You are receiving this mail because:
You are watching all bug changes.
___
Koha-bugs mailing list
Koha-bugs@lists.koha-community.org
http://lists.koha-community.org/cgi-bin/mailman/listinfo/koha-bugs
website : http://www.koha-community.org/
git : http://git.koha-community.org/
bugs : http://bugs.koha-community.org/

[Koha-bugs] [Bug 21610] Koha::Object->store needs to handle incorrect values

2019-02-01 Thread bugzilla-daemon
https://bugs.koha-community.org/bugzilla3/show_bug.cgi?id=21610

Tomás Cohen Arazi  changed:

   What|Removed |Added

  Attachment #81017|0   |1
is obsolete||

-- 
You are receiving this mail because:
You are watching all bug changes.
___
Koha-bugs mailing list
Koha-bugs@lists.koha-community.org
http://lists.koha-community.org/cgi-bin/mailman/listinfo/koha-bugs
website : http://www.koha-community.org/
git : http://git.koha-community.org/
bugs : http://bugs.koha-community.org/

[Koha-bugs] [Bug 21610] Koha::Object->store needs to handle incorrect values

2019-02-01 Thread bugzilla-daemon
https://bugs.koha-community.org/bugzilla3/show_bug.cgi?id=21610

Tomás Cohen Arazi  changed:

   What|Removed |Added

  Attachment #81016|0   |1
is obsolete||

-- 
You are receiving this mail because:
You are watching all bug changes.
___
Koha-bugs mailing list
Koha-bugs@lists.koha-community.org
http://lists.koha-community.org/cgi-bin/mailman/listinfo/koha-bugs
website : http://www.koha-community.org/
git : http://git.koha-community.org/
bugs : http://bugs.koha-community.org/

[Koha-bugs] [Bug 21610] Koha::Object->store needs to handle incorrect values

2019-02-01 Thread bugzilla-daemon
https://bugs.koha-community.org/bugzilla3/show_bug.cgi?id=21610

Tomás Cohen Arazi  changed:

   What|Removed |Added

 Status|Signed Off  |Passed QA

-- 
You are receiving this mail because:
You are watching all bug changes.
___
Koha-bugs mailing list
Koha-bugs@lists.koha-community.org
http://lists.koha-community.org/cgi-bin/mailman/listinfo/koha-bugs
website : http://www.koha-community.org/
git : http://git.koha-community.org/
bugs : http://bugs.koha-community.org/

[Koha-bugs] [Bug 21610] Koha::Object->store needs to handle incorrect values

2019-01-25 Thread bugzilla-daemon
https://bugs.koha-community.org/bugzilla3/show_bug.cgi?id=21610

Tomás Cohen Arazi  changed:

   What|Removed |Added

 Status|Passed QA   |Signed Off

-- 
You are receiving this mail because:
You are watching all bug changes.
___
Koha-bugs mailing list
Koha-bugs@lists.koha-community.org
http://lists.koha-community.org/cgi-bin/mailman/listinfo/koha-bugs
website : http://www.koha-community.org/
git : http://git.koha-community.org/
bugs : http://bugs.koha-community.org/

[Koha-bugs] [Bug 21610] Koha::Object->store needs to handle incorrect values

2019-01-25 Thread bugzilla-daemon
https://bugs.koha-community.org/bugzilla3/show_bug.cgi?id=21610

Tomás Cohen Arazi  changed:

   What|Removed |Added

Version|unspecified |master
 QA Contact|testo...@bugs.koha-communit |tomasco...@gmail.com
   |y.org   |

-- 
You are receiving this mail because:
You are watching all bug changes.
___
Koha-bugs mailing list
Koha-bugs@lists.koha-community.org
http://lists.koha-community.org/cgi-bin/mailman/listinfo/koha-bugs
website : http://www.koha-community.org/
git : http://git.koha-community.org/
bugs : http://bugs.koha-community.org/

[Koha-bugs] [Bug 21610] Koha::Object->store needs to handle incorrect values

2019-01-25 Thread bugzilla-daemon
https://bugs.koha-community.org/bugzilla3/show_bug.cgi?id=21610

Tomás Cohen Arazi  changed:

   What|Removed |Added

 Status|In Discussion   |Passed QA

-- 
You are receiving this mail because:
You are watching all bug changes.
___
Koha-bugs mailing list
Koha-bugs@lists.koha-community.org
http://lists.koha-community.org/cgi-bin/mailman/listinfo/koha-bugs
website : http://www.koha-community.org/
git : http://git.koha-community.org/
bugs : http://bugs.koha-community.org/

[Koha-bugs] [Bug 21610] Koha::Object->store needs to handle incorrect values

2018-12-24 Thread bugzilla-daemon
https://bugs.koha-community.org/bugzilla3/show_bug.cgi?id=21610

--- Comment #40 from Tomás Cohen Arazi  ---
(In reply to Jonathan Druart from comment #35)
> We could imagine a { strict => 1 } param that would skip these checks (?)

I agree with this middle ground approach. And with Marcel saying the chosen
word is strange, but probably correct, we are asking it to raise exceptions
instead of fixing the passed data.

I would also love a 'warn' line when we fix something. I like the idea of users
complaining about their logs, because it will make removing this problem
faster. <-- this wouldn't be a blocker from my end if there's no consensus.

-- 
You are receiving this mail because:
You are watching all bug changes.
___
Koha-bugs mailing list
Koha-bugs@lists.koha-community.org
http://lists.koha-community.org/cgi-bin/mailman/listinfo/koha-bugs
website : http://www.koha-community.org/
git : http://git.koha-community.org/
bugs : http://bugs.koha-community.org/

[Koha-bugs] [Bug 21610] Koha::Object->store needs to handle incorrect values

2018-12-13 Thread bugzilla-daemon
https://bugs.koha-community.org/bugzilla3/show_bug.cgi?id=21610

--- Comment #39 from Tomás Cohen Arazi  ---
(In reply to Marcel de Rooy from comment #38)
> Tomas, 
> It seems that we still need your answer on the strict parameter question of
> Joubu now?

I don't like it, generally. But I see no reason not to move forward and see how
things go. At this stage I expected to have an API-driven UI which wouldn't
require this sort of things as the data validation is done by the OpenAPI
plugin itself.

My opinion is that we should move forward and eventually drop this if something
better shows up.

-- 
You are receiving this mail because:
You are watching all bug changes.
___
Koha-bugs mailing list
Koha-bugs@lists.koha-community.org
http://lists.koha-community.org/cgi-bin/mailman/listinfo/koha-bugs
website : http://www.koha-community.org/
git : http://git.koha-community.org/
bugs : http://bugs.koha-community.org/

[Koha-bugs] [Bug 21610] Koha::Object->store needs to handle incorrect values

2018-12-13 Thread bugzilla-daemon
https://bugs.koha-community.org/bugzilla3/show_bug.cgi?id=21610

--- Comment #38 from Marcel de Rooy  ---
Tomas, 
It seems that we still need your answer on the strict parameter question of
Joubu now?

-- 
You are receiving this mail because:
You are watching all bug changes.
___
Koha-bugs mailing list
Koha-bugs@lists.koha-community.org
http://lists.koha-community.org/cgi-bin/mailman/listinfo/koha-bugs
website : http://www.koha-community.org/
git : http://git.koha-community.org/
bugs : http://bugs.koha-community.org/


[Koha-bugs] [Bug 21610] Koha::Object->store needs to handle incorrect values

2018-11-06 Thread bugzilla-daemon
https://bugs.koha-community.org/bugzilla3/show_bug.cgi?id=21610

Jonathan Druart  changed:

   What|Removed |Added

   See Also||https://bugs.koha-community
   ||.org/bugzilla3/show_bug.cgi
   ||?id=21761

-- 
You are receiving this mail because:
You are watching all bug changes.
___
Koha-bugs mailing list
Koha-bugs@lists.koha-community.org
http://lists.koha-community.org/cgi-bin/mailman/listinfo/koha-bugs
website : http://www.koha-community.org/
git : http://git.koha-community.org/
bugs : http://bugs.koha-community.org/


[Koha-bugs] [Bug 21610] Koha::Object->store needs to handle incorrect values

2018-10-25 Thread bugzilla-daemon
https://bugs.koha-community.org/bugzilla3/show_bug.cgi?id=21610

David Cook  changed:

   What|Removed |Added

 CC||dc...@prosentient.com.au

-- 
You are receiving this mail because:
You are watching all bug changes.
___
Koha-bugs mailing list
Koha-bugs@lists.koha-community.org
http://lists.koha-community.org/cgi-bin/mailman/listinfo/koha-bugs
website : http://www.koha-community.org/
git : http://git.koha-community.org/
bugs : http://bugs.koha-community.org/


[Koha-bugs] [Bug 21610] Koha::Object->store needs to handle incorrect values

2018-10-25 Thread bugzilla-daemon
https://bugs.koha-community.org/bugzilla3/show_bug.cgi?id=21610

Jonathan Druart  changed:

   What|Removed |Added

   See Also||https://bugs.koha-community
   ||.org/bugzilla3/show_bug.cgi
   ||?id=21605

-- 
You are receiving this mail because:
You are watching all bug changes.
___
Koha-bugs mailing list
Koha-bugs@lists.koha-community.org
http://lists.koha-community.org/cgi-bin/mailman/listinfo/koha-bugs
website : http://www.koha-community.org/
git : http://git.koha-community.org/
bugs : http://bugs.koha-community.org/


[Koha-bugs] [Bug 21610] Koha::Object->store needs to handle incorrect values

2018-10-25 Thread bugzilla-daemon
https://bugs.koha-community.org/bugzilla3/show_bug.cgi?id=21610

--- Comment #36 from Marcel de Rooy  ---
(In reply to Jonathan Druart from comment #35)
> We could imagine a { strict => 1 } param that would skip these checks (?)

Sounds strange strict skipping checks, but yes could imagine that REST API
would like to skip these 'fixes'.

-- 
You are receiving this mail because:
You are watching all bug changes.
___
Koha-bugs mailing list
Koha-bugs@lists.koha-community.org
http://lists.koha-community.org/cgi-bin/mailman/listinfo/koha-bugs
website : http://www.koha-community.org/
git : http://git.koha-community.org/
bugs : http://bugs.koha-community.org/


[Koha-bugs] [Bug 21610] Koha::Object->store needs to handle incorrect values

2018-10-23 Thread bugzilla-daemon
https://bugs.koha-community.org/bugzilla3/show_bug.cgi?id=21610

Jonathan Druart  changed:

   What|Removed |Added

 Status|Failed QA   |In Discussion

-- 
You are receiving this mail because:
You are watching all bug changes.
___
Koha-bugs mailing list
Koha-bugs@lists.koha-community.org
http://lists.koha-community.org/cgi-bin/mailman/listinfo/koha-bugs
website : http://www.koha-community.org/
git : http://git.koha-community.org/
bugs : http://bugs.koha-community.org/


[Koha-bugs] [Bug 21610] Koha::Object->store needs to handle incorrect values

2018-10-23 Thread bugzilla-daemon
https://bugs.koha-community.org/bugzilla3/show_bug.cgi?id=21610

--- Comment #34 from Jonathan Druart  
---
(In reply to Martin Renvoize from comment #31)
> This approach scares me I'm afraid.. it feels like we're hiding errors that
> really ought to be getting thrown up to the callers and for developers to
> make informed decisions.

So maybe you are both missing the point of this approach: we do not want the
callers (controllers) to validate the data, it will be horrible to write and
maintain.

I am waiting for your suggestions, I do not have another one.

-- 
You are receiving this mail because:
You are watching all bug changes.
___
Koha-bugs mailing list
Koha-bugs@lists.koha-community.org
http://lists.koha-community.org/cgi-bin/mailman/listinfo/koha-bugs
website : http://www.koha-community.org/
git : http://git.koha-community.org/
bugs : http://bugs.koha-community.org/


[Koha-bugs] [Bug 21610] Koha::Object->store needs to handle incorrect values

2018-10-23 Thread bugzilla-daemon
https://bugs.koha-community.org/bugzilla3/show_bug.cgi?id=21610

--- Comment #33 from Marcel de Rooy  ---
Isn't the problem that we ignored too many warnings in the past that we cannot
let it explode on such things now ?

-- 
You are receiving this mail because:
You are watching all bug changes.
___
Koha-bugs mailing list
Koha-bugs@lists.koha-community.org
http://lists.koha-community.org/cgi-bin/mailman/listinfo/koha-bugs
website : http://www.koha-community.org/
git : http://git.koha-community.org/
bugs : http://bugs.koha-community.org/


[Koha-bugs] [Bug 21610] Koha::Object->store needs to handle incorrect values

2018-10-23 Thread bugzilla-daemon
https://bugs.koha-community.org/bugzilla3/show_bug.cgi?id=21610

--- Comment #32 from Martin Renvoize  ---
Seems Tomas just expressed the same concern as me there really.

-- 
You are receiving this mail because:
You are watching all bug changes.
___
Koha-bugs mailing list
Koha-bugs@lists.koha-community.org
http://lists.koha-community.org/cgi-bin/mailman/listinfo/koha-bugs
website : http://www.koha-community.org/
git : http://git.koha-community.org/
bugs : http://bugs.koha-community.org/


[Koha-bugs] [Bug 21610] Koha::Object->store needs to handle incorrect values

2018-10-23 Thread bugzilla-daemon
https://bugs.koha-community.org/bugzilla3/show_bug.cgi?id=21610

--- Comment #31 from Martin Renvoize  ---
This approach scares me I'm afraid.. it feels like we're hiding errors that
really ought to be getting thrown up to the callers and for developers to make
informed decisions.

Falling back to a 'create time' default feels bad.. if a field should be
getting passed from a caller then we should be validating that it is and
passing back an error to the caller if it is not to give the developer a chance
of making an informed decision and passing the right data in the caller.

Just my two pence.

-- 
You are receiving this mail because:
You are watching all bug changes.
___
Koha-bugs mailing list
Koha-bugs@lists.koha-community.org
http://lists.koha-community.org/cgi-bin/mailman/listinfo/koha-bugs
website : http://www.koha-community.org/
git : http://git.koha-community.org/
bugs : http://bugs.koha-community.org/


[Koha-bugs] [Bug 21610] Koha::Object->store needs to handle incorrect values

2018-10-23 Thread bugzilla-daemon
https://bugs.koha-community.org/bugzilla3/show_bug.cgi?id=21610

--- Comment #30 from Tomás Cohen Arazi  ---
(In reply to Tomás Cohen Arazi from comment #29)
> (In reply to Jonathan Druart from comment #28)
> > (In reply to Tomás Cohen Arazi from comment #26)
> > > I feel like (overall) I don't agree with the approach (the general one, or
> > > the various fixes on the Koha:: namespace that have been pushed to 
> > > master).
> > > DBIC should explode, we should catch the explosion and handle that
> > > correctly. Or maybe I'm missing something else.
> > 
> > No, you do not want to deal with "" in .pl scripts, really.
> 
> Maybe, but I would love the API to return 400 bad request if someone sends
> "" when it shouldn't. And this should come from the object class.

Mm, the OpenAPI validator would take care if our specs are correct...

-- 
You are receiving this mail because:
You are watching all bug changes.
___
Koha-bugs mailing list
Koha-bugs@lists.koha-community.org
http://lists.koha-community.org/cgi-bin/mailman/listinfo/koha-bugs
website : http://www.koha-community.org/
git : http://git.koha-community.org/
bugs : http://bugs.koha-community.org/

[Koha-bugs] [Bug 21610] Koha::Object->store needs to handle incorrect values

2018-10-23 Thread bugzilla-daemon
https://bugs.koha-community.org/bugzilla3/show_bug.cgi?id=21610

--- Comment #29 from Tomás Cohen Arazi  ---
(In reply to Jonathan Druart from comment #28)
> (In reply to Tomás Cohen Arazi from comment #26)
> > I feel like (overall) I don't agree with the approach (the general one, or
> > the various fixes on the Koha:: namespace that have been pushed to master).
> > DBIC should explode, we should catch the explosion and handle that
> > correctly. Or maybe I'm missing something else.
> 
> No, you do not want to deal with "" in .pl scripts, really.

Maybe, but I would love the API to return 400 bad request if someone sends ""
when it shouldn't. And this should come from the object class.

-- 
You are receiving this mail because:
You are watching all bug changes.
___
Koha-bugs mailing list
Koha-bugs@lists.koha-community.org
http://lists.koha-community.org/cgi-bin/mailman/listinfo/koha-bugs
website : http://www.koha-community.org/
git : http://git.koha-community.org/
bugs : http://bugs.koha-community.org/

[Koha-bugs] [Bug 21610] Koha::Object->store needs to handle incorrect values

2018-10-23 Thread bugzilla-daemon
https://bugs.koha-community.org/bugzilla3/show_bug.cgi?id=21610

--- Comment #28 from Jonathan Druart  
---
(In reply to Tomás Cohen Arazi from comment #26)
> I feel like (overall) I don't agree with the approach (the general one, or
> the various fixes on the Koha:: namespace that have been pushed to master).
> DBIC should explode, we should catch the explosion and handle that
> correctly. Or maybe I'm missing something else.

No, you do not want to deal with "" in .pl scripts, really.

-- 
You are receiving this mail because:
You are watching all bug changes.
___
Koha-bugs mailing list
Koha-bugs@lists.koha-community.org
http://lists.koha-community.org/cgi-bin/mailman/listinfo/koha-bugs
website : http://www.koha-community.org/
git : http://git.koha-community.org/
bugs : http://bugs.koha-community.org/

[Koha-bugs] [Bug 21610] Koha::Object->store needs to handle incorrect values

2018-10-23 Thread bugzilla-daemon
https://bugs.koha-community.org/bugzilla3/show_bug.cgi?id=21610

--- Comment #27 from Jonathan Druart  
---
(In reply to Kyle M Hall from comment #16)
> Comment on attachment 80882 [details] [review]
> Bug 21610: Fix integers and dates values at Koha::Object->store level
> 
> Review of attachment 80882 [details] [review]:
> -
> 
> ::: Koha/Object.pm
> @@ +308,5 @@
> > +'date',
> > +'datetime'
> > +);
> > +
> > +return ( grep { $column_type eq $_ } @dt_types) ? 1 : 0;
> 
> I think this may be quite inefficient as it uses grep. Perhaps we could use
> https://perldoc.perl.org/List/Util.html#any instead? Or just a set of
> ternary operators or elsifs if we really want to keep it fast and simple.

Hi Kyle, thanks for your feedback!

I would consider this as out of the scope for now, I reused what
_datetime_column_type and other methods already did:

Koha/Object.pm:unless ( grep {/^$p$/} @columns ) {
Koha/Object.pm:return ( grep { $column_type eq $_ } @dt_types) ? 1 : 0;
Koha/Object.pm:return ( grep { $column_type eq $_ } @numeric_types) ? 1 :
0;
Koha/Object.pm:if ( grep {/^$method$/} @columns ) {
Koha/Object.pm:) unless grep { /^$method$/ } @known_methods;

However I agree we should replace them but, then, all of them at the same time
:)
I am going to open a separate bug report to talk about that.

-- 
You are receiving this mail because:
You are watching all bug changes.
___
Koha-bugs mailing list
Koha-bugs@lists.koha-community.org
http://lists.koha-community.org/cgi-bin/mailman/listinfo/koha-bugs
website : http://www.koha-community.org/
git : http://git.koha-community.org/
bugs : http://bugs.koha-community.org/


[Koha-bugs] [Bug 21610] Koha::Object->store needs to handle incorrect values

2018-10-23 Thread bugzilla-daemon
https://bugs.koha-community.org/bugzilla3/show_bug.cgi?id=21610

--- Comment #26 from Tomás Cohen Arazi  ---
I feel like (overall) I don't agree with the approach (the general one, or the
various fixes on the Koha:: namespace that have been pushed to master). DBIC
should explode, we should catch the explosion and handle that correctly. Or
maybe I'm missing something else.

-- 
You are receiving this mail because:
You are watching all bug changes.
___
Koha-bugs mailing list
Koha-bugs@lists.koha-community.org
http://lists.koha-community.org/cgi-bin/mailman/listinfo/koha-bugs
website : http://www.koha-community.org/
git : http://git.koha-community.org/
bugs : http://bugs.koha-community.org/

[Koha-bugs] [Bug 21610] Koha::Object->store needs to handle incorrect values

2018-10-23 Thread bugzilla-daemon
https://bugs.koha-community.org/bugzilla3/show_bug.cgi?id=21610

--- Comment #25 from Jonathan Druart  
---
(In reply to Tomás Cohen Arazi from comment #24)
> What about things like this:
> 
> https://metacpan.org/release/DBIx-Class-Validation

If I understand the goal of this module correctly it's exactly what I am trying
to avoid: 1 validation per field. The idea is to provide a generic way to
validate data. I am sure we will have exceptions, but we will handle them
separately.

> Also, it feels DBIX::Class should have some way to tell 'use the default
> when undef is passed'. I'm searching.

Think "0" vs undef vs "", and also update (not only insert)
How do you undef an existing value?

It is why DBIx::Class takes the default value if the parameter is not passed,
and it is what this patch is trying to achieve. It is already what we did for
Koha::Patron, nothing new here :)

-- 
You are receiving this mail because:
You are watching all bug changes.
___
Koha-bugs mailing list
Koha-bugs@lists.koha-community.org
http://lists.koha-community.org/cgi-bin/mailman/listinfo/koha-bugs
website : http://www.koha-community.org/
git : http://git.koha-community.org/
bugs : http://bugs.koha-community.org/

[Koha-bugs] [Bug 21610] Koha::Object->store needs to handle incorrect values

2018-10-23 Thread bugzilla-daemon
https://bugs.koha-community.org/bugzilla3/show_bug.cgi?id=21610

--- Comment #24 from Tomás Cohen Arazi  ---
What about things like this:

https://metacpan.org/release/DBIx-Class-Validation

Also, it feels DBIX::Class should have some way to tell 'use the default when
undef is passed'. I'm searching.

-- 
You are receiving this mail because:
You are watching all bug changes.
___
Koha-bugs mailing list
Koha-bugs@lists.koha-community.org
http://lists.koha-community.org/cgi-bin/mailman/listinfo/koha-bugs
website : http://www.koha-community.org/
git : http://git.koha-community.org/
bugs : http://bugs.koha-community.org/

[Koha-bugs] [Bug 21610] Koha::Object->store needs to handle incorrect values

2018-10-23 Thread bugzilla-daemon
https://bugs.koha-community.org/bugzilla3/show_bug.cgi?id=21610

Kyle M Hall  changed:

   What|Removed |Added

 Status|Signed Off  |Failed QA

--- Comment #23 from Kyle M Hall  ---
Please address or rebut by critique of the use of grep in comment 16 and then
set to back to Signed Off!

-- 
You are receiving this mail because:
You are watching all bug changes.
___
Koha-bugs mailing list
Koha-bugs@lists.koha-community.org
http://lists.koha-community.org/cgi-bin/mailman/listinfo/koha-bugs
website : http://www.koha-community.org/
git : http://git.koha-community.org/
bugs : http://bugs.koha-community.org/


[Koha-bugs] [Bug 21610] Koha::Object->store needs to handle incorrect values

2018-10-23 Thread bugzilla-daemon
https://bugs.koha-community.org/bugzilla3/show_bug.cgi?id=21610

--- Comment #22 from Kyle M Hall  ---
Created attachment 81021
  -->
https://bugs.koha-community.org/bugzilla3/attachment.cgi?id=81021=edit
Bug 21610: Improve default values for dates

This patch fixes failures on t/db_dependent/Koha/Patrons/Import.t
and keep t/Auth_with_shibboleth.t and t/db_dependent/Koha/Object.t green

Signed-off-by: Kyle M Hall 

-- 
You are receiving this mail because:
You are watching all bug changes.
___
Koha-bugs mailing list
Koha-bugs@lists.koha-community.org
http://lists.koha-community.org/cgi-bin/mailman/listinfo/koha-bugs
website : http://www.koha-community.org/
git : http://git.koha-community.org/
bugs : http://bugs.koha-community.org/


[Koha-bugs] [Bug 21610] Koha::Object->store needs to handle incorrect values

2018-10-23 Thread bugzilla-daemon
https://bugs.koha-community.org/bugzilla3/show_bug.cgi?id=21610

Kyle M Hall  changed:

   What|Removed |Added

  Attachment #80880|0   |1
is obsolete||
  Attachment #80881|0   |1
is obsolete||
  Attachment #80882|0   |1
is obsolete||
  Attachment #80906|0   |1
is obsolete||
  Attachment #80926|0   |1
is obsolete||
  Attachment #80927|0   |1
is obsolete||

--- Comment #17 from Kyle M Hall  ---
Created attachment 81016
  -->
https://bugs.koha-community.org/bugzilla3/attachment.cgi?id=81016=edit
Bug 21610: Add tests

Adding few tests to Koha/Object.t in order to highlight what we are
trying to fix.

Note that Koha::ItemType->store was wrong for notforloan, the default
value should be null
`notforloan` smallint(6) DEFAULT NULL,
but the previous fix (bug 21599) made it default to '0'

Signed-off-by: Kyle M Hall 

-- 
You are receiving this mail because:
You are watching all bug changes.
___
Koha-bugs mailing list
Koha-bugs@lists.koha-community.org
http://lists.koha-community.org/cgi-bin/mailman/listinfo/koha-bugs
website : http://www.koha-community.org/
git : http://git.koha-community.org/
bugs : http://bugs.koha-community.org/


[Koha-bugs] [Bug 21610] Koha::Object->store needs to handle incorrect values

2018-10-23 Thread bugzilla-daemon
https://bugs.koha-community.org/bugzilla3/show_bug.cgi?id=21610

--- Comment #21 from Kyle M Hall  ---
Created attachment 81020
  -->
https://bugs.koha-community.org/bugzilla3/attachment.cgi?id=81020=edit
Bug 21610: (follow-up) Default value for dates

We have some dates with DEFAULT CURRENT_TIMESTAMP and some dates with
default and UPDATE clause.

Test plan:
Run Object.t again.

Signed-off-by: Marcel de Rooy 

Signed-off-by: Kyle M Hall 

-- 
You are receiving this mail because:
You are watching all bug changes.
___
Koha-bugs mailing list
Koha-bugs@lists.koha-community.org
http://lists.koha-community.org/cgi-bin/mailman/listinfo/koha-bugs
website : http://www.koha-community.org/
git : http://git.koha-community.org/
bugs : http://bugs.koha-community.org/


[Koha-bugs] [Bug 21610] Koha::Object->store needs to handle incorrect values

2018-10-23 Thread bugzilla-daemon
https://bugs.koha-community.org/bugzilla3/show_bug.cgi?id=21610

--- Comment #20 from Kyle M Hall  ---
Created attachment 81019
  -->
https://bugs.koha-community.org/bugzilla3/attachment.cgi?id=81019=edit
Bug 21610: (QA follow-up) Better use columns_info from DBIx

We should better use the published method than a private hash key.
And shorter to go via _result than adding a new schema call.

Signed-off-by: Marcel de Rooy 

Signed-off-by: Kyle M Hall 

-- 
You are receiving this mail because:
You are watching all bug changes.
___
Koha-bugs mailing list
Koha-bugs@lists.koha-community.org
http://lists.koha-community.org/cgi-bin/mailman/listinfo/koha-bugs
website : http://www.koha-community.org/
git : http://git.koha-community.org/
bugs : http://bugs.koha-community.org/


[Koha-bugs] [Bug 21610] Koha::Object->store needs to handle incorrect values

2018-10-23 Thread bugzilla-daemon
https://bugs.koha-community.org/bugzilla3/show_bug.cgi?id=21610

--- Comment #19 from Kyle M Hall  ---
Created attachment 81018
  -->
https://bugs.koha-community.org/bugzilla3/attachment.cgi?id=81018=edit
Bug 21610: Fix integers and dates values at Koha::Object->store level

With strict SQL modes, we are facing several issues when objects are stored.

The following errors can be raised by DBIx::Class when an object does not have
a valid (as defined at DB level) value:
- Incorrect integer value: '' for column COLUMN
- Incorrect decimal value: '' for column COLUMN
- Column 'COLUMN' cannot be null
- Field 'COLUMN' doesn't have a default value
- Incorrect date value: '' for column 'COLUMN'

We already handled some of them for Koha::Patron. As we do not want to provide
such
changes for all Koha::* modules we are going to fix this at Koha::Object->store
level
in order to provide a global fix.

This is related to bug 21599 (for item types) and bug 21596 (for patrons)

Test plan:
- Apply first patch, run the tests
=> Patch fail because of the previous error in Koha::ItemType->store, to make
them pass
you can replace
  $self->notforloan(0) unless $self->notforloan;
with
  $self->notforloan(undef) unless $self->notforloan;
- Apply second patch, run the tests
=> They fail because of dates and/or integers values
- Apply third patch, run the tests
=> They now pass

Deep code review wanted!

Signed-off-by: Kyle M Hall 

-- 
You are receiving this mail because:
You are watching all bug changes.
___
Koha-bugs mailing list
Koha-bugs@lists.koha-community.org
http://lists.koha-community.org/cgi-bin/mailman/listinfo/koha-bugs
website : http://www.koha-community.org/
git : http://git.koha-community.org/
bugs : http://bugs.koha-community.org/


[Koha-bugs] [Bug 21610] Koha::Object->store needs to handle incorrect values

2018-10-23 Thread bugzilla-daemon
https://bugs.koha-community.org/bugzilla3/show_bug.cgi?id=21610

--- Comment #18 from Kyle M Hall  ---
Created attachment 81017
  -->
https://bugs.koha-community.org/bugzilla3/attachment.cgi?id=81017=edit
Bug 21610: Remove specific changes we made previously

We handled integers and dates for Koha::Patron and Koha::ItemType, we
want now Koha::Object to deal with.

Signed-off-by: Kyle M Hall 

-- 
You are receiving this mail because:
You are watching all bug changes.
___
Koha-bugs mailing list
Koha-bugs@lists.koha-community.org
http://lists.koha-community.org/cgi-bin/mailman/listinfo/koha-bugs
website : http://www.koha-community.org/
git : http://git.koha-community.org/
bugs : http://bugs.koha-community.org/


[Koha-bugs] [Bug 21610] Koha::Object->store needs to handle incorrect values

2018-10-23 Thread bugzilla-daemon
https://bugs.koha-community.org/bugzilla3/show_bug.cgi?id=21610

Kyle M Hall  changed:

   What|Removed |Added

 Status|Needs Signoff   |Signed Off

-- 
You are receiving this mail because:
You are watching all bug changes.
___
Koha-bugs mailing list
Koha-bugs@lists.koha-community.org
http://lists.koha-community.org/cgi-bin/mailman/listinfo/koha-bugs
website : http://www.koha-community.org/
git : http://git.koha-community.org/
bugs : http://bugs.koha-community.org/


[Koha-bugs] [Bug 21610] Koha::Object->store needs to handle incorrect values

2018-10-23 Thread bugzilla-daemon
https://bugs.koha-community.org/bugzilla3/show_bug.cgi?id=21610

--- Comment #16 from Kyle M Hall  ---
Comment on attachment 80882
  --> https://bugs.koha-community.org/bugzilla3/attachment.cgi?id=80882
Bug 21610: Fix integers and dates values at Koha::Object->store level

Review of attachment 80882:
 --> 
(https://bugs.koha-community.org/bugzilla3/page.cgi?id=splinter.html=21610=80882)
-

::: Koha/Object.pm
@@ +308,5 @@
> +'date',
> +'datetime'
> +);
> +
> +return ( grep { $column_type eq $_ } @dt_types) ? 1 : 0;

I think this may be quite inefficient as it uses grep. Perhaps we could use
https://perldoc.perl.org/List/Util.html#any instead? Or just a set of ternary
operators or elsifs if we really want to keep it fast and simple.

-- 
You are receiving this mail because:
You are watching all bug changes.
___
Koha-bugs mailing list
Koha-bugs@lists.koha-community.org
http://lists.koha-community.org/cgi-bin/mailman/listinfo/koha-bugs
website : http://www.koha-community.org/
git : http://git.koha-community.org/
bugs : http://bugs.koha-community.org/


[Koha-bugs] [Bug 21610] Koha::Object->store needs to handle incorrect values

2018-10-23 Thread bugzilla-daemon
https://bugs.koha-community.org/bugzilla3/show_bug.cgi?id=21610

Jonathan Druart  changed:

   What|Removed |Added

   Keywords||rel_18_11_candidate

-- 
You are receiving this mail because:
You are watching all bug changes.
___
Koha-bugs mailing list
Koha-bugs@lists.koha-community.org
http://lists.koha-community.org/cgi-bin/mailman/listinfo/koha-bugs
website : http://www.koha-community.org/
git : http://git.koha-community.org/
bugs : http://bugs.koha-community.org/


[Koha-bugs] [Bug 21610] Koha::Object->store needs to handle incorrect values

2018-10-19 Thread bugzilla-daemon
https://bugs.koha-community.org/bugzilla3/show_bug.cgi?id=21610

--- Comment #15 from Jonathan Druart  
---
Created attachment 80927
  -->
https://bugs.koha-community.org/bugzilla3/attachment.cgi?id=80927=edit
Bug 21610: Improve default values for dates

This patch fixes failures on t/db_dependent/Koha/Patrons/Import.t
and keep t/Auth_with_shibboleth.t and t/db_dependent/Koha/Object.t green

-- 
You are receiving this mail because:
You are watching all bug changes.
___
Koha-bugs mailing list
Koha-bugs@lists.koha-community.org
http://lists.koha-community.org/cgi-bin/mailman/listinfo/koha-bugs
website : http://www.koha-community.org/
git : http://git.koha-community.org/
bugs : http://bugs.koha-community.org/


[Koha-bugs] [Bug 21610] Koha::Object->store needs to handle incorrect values

2018-10-19 Thread bugzilla-daemon
https://bugs.koha-community.org/bugzilla3/show_bug.cgi?id=21610

--- Comment #14 from Jonathan Druart  
---
(In reply to Marcel de Rooy from comment #10)
> Created attachment 80926 [details] [review]
> Bug 21610: (follow-up) Default value for dates

This patch fixes t/Auth_with_shibboleth.t but breaks
t/db_dependent/Koha/Patrons/Import.t

-- 
You are receiving this mail because:
You are watching all bug changes.
___
Koha-bugs mailing list
Koha-bugs@lists.koha-community.org
http://lists.koha-community.org/cgi-bin/mailman/listinfo/koha-bugs
website : http://www.koha-community.org/
git : http://git.koha-community.org/
bugs : http://bugs.koha-community.org/


[Koha-bugs] [Bug 21610] Koha::Object->store needs to handle incorrect values

2018-10-19 Thread bugzilla-daemon
https://bugs.koha-community.org/bugzilla3/show_bug.cgi?id=21610

--- Comment #13 from Jonathan Druart  
---
*** Bug 21618 has been marked as a duplicate of this bug. ***

-- 
You are receiving this mail because:
You are watching all bug changes.
___
Koha-bugs mailing list
Koha-bugs@lists.koha-community.org
http://lists.koha-community.org/cgi-bin/mailman/listinfo/koha-bugs
website : http://www.koha-community.org/
git : http://git.koha-community.org/
bugs : http://bugs.koha-community.org/


[Koha-bugs] [Bug 21610] Koha::Object->store needs to handle incorrect values

2018-10-19 Thread bugzilla-daemon
https://bugs.koha-community.org/bugzilla3/show_bug.cgi?id=21610

--- Comment #12 from Marcel de Rooy  ---
So some additional feedback is still welcome !

-- 
You are receiving this mail because:
You are watching all bug changes.
___
Koha-bugs mailing list
Koha-bugs@lists.koha-community.org
http://lists.koha-community.org/cgi-bin/mailman/listinfo/koha-bugs
website : http://www.koha-community.org/
git : http://git.koha-community.org/
bugs : http://bugs.koha-community.org/


[Koha-bugs] [Bug 21610] Koha::Object->store needs to handle incorrect values

2018-10-19 Thread bugzilla-daemon
https://bugs.koha-community.org/bugzilla3/show_bug.cgi?id=21610

--- Comment #11 from Marcel de Rooy  ---
Couldn't finish this in time. Last patch might still need a little bit of
thought. Shouldnt we use the exact same logic for int and date? And sql uses
the default value only for a new record. Should we use it at all when updating
or bail out when NULL is not allowed ?

-- 
You are receiving this mail because:
You are watching all bug changes.
___
Koha-bugs mailing list
Koha-bugs@lists.koha-community.org
http://lists.koha-community.org/cgi-bin/mailman/listinfo/koha-bugs
website : http://www.koha-community.org/
git : http://git.koha-community.org/
bugs : http://bugs.koha-community.org/


[Koha-bugs] [Bug 21610] Koha::Object->store needs to handle incorrect values

2018-10-19 Thread bugzilla-daemon
https://bugs.koha-community.org/bugzilla3/show_bug.cgi?id=21610

--- Comment #10 from Marcel de Rooy  ---
Created attachment 80926
  -->
https://bugs.koha-community.org/bugzilla3/attachment.cgi?id=80926=edit
Bug 21610: (follow-up) Default value for dates

We have some dates with DEFAULT CURRENT_TIMESTAMP and some dates with
default and UPDATE clause.

Test plan:
Run Object.t again.

Signed-off-by: Marcel de Rooy 

-- 
You are receiving this mail because:
You are watching all bug changes.
___
Koha-bugs mailing list
Koha-bugs@lists.koha-community.org
http://lists.koha-community.org/cgi-bin/mailman/listinfo/koha-bugs
website : http://www.koha-community.org/
git : http://git.koha-community.org/
bugs : http://bugs.koha-community.org/


[Koha-bugs] [Bug 21610] Koha::Object->store needs to handle incorrect values

2018-10-19 Thread bugzilla-daemon
https://bugs.koha-community.org/bugzilla3/show_bug.cgi?id=21610

Marcel de Rooy  changed:

   What|Removed |Added

 Status|BLOCKED |Needs Signoff
   Patch complexity|--- |Small patch

-- 
You are receiving this mail because:
You are watching all bug changes.
___
Koha-bugs mailing list
Koha-bugs@lists.koha-community.org
http://lists.koha-community.org/cgi-bin/mailman/listinfo/koha-bugs
website : http://www.koha-community.org/
git : http://git.koha-community.org/
bugs : http://bugs.koha-community.org/


[Koha-bugs] [Bug 21610] Koha::Object->store needs to handle incorrect values

2018-10-19 Thread bugzilla-daemon
https://bugs.koha-community.org/bugzilla3/show_bug.cgi?id=21610

--- Comment #9 from Marcel de Rooy  ---
About this code:
if ( $columns_info->{$col}->{is_nullable} ) {
# If nullable, default to null
$self->$col(undef);
} else {
# If cannot be null, get the default value
# What if cannot be null and does not have a default value?
Possible?
$self->$col($columns_info->{$col}->{default_value});

TRY:
alter table borrowers add column notpossible int NOT NULL;
So yes, it is possible.
For now, I would recommend to change the last statement to:
$self->$col( $columns_info->{$col}->{default_value} // 0 );

-- 
You are receiving this mail because:
You are watching all bug changes.
___
Koha-bugs mailing list
Koha-bugs@lists.koha-community.org
http://lists.koha-community.org/cgi-bin/mailman/listinfo/koha-bugs
website : http://www.koha-community.org/
git : http://git.koha-community.org/
bugs : http://bugs.koha-community.org/


[Koha-bugs] [Bug 21610] Koha::Object->store needs to handle incorrect values

2018-10-19 Thread bugzilla-daemon
https://bugs.koha-community.org/bugzilla3/show_bug.cgi?id=21610

Marcel de Rooy  changed:

   What|Removed |Added

 Status|Needs Signoff   |BLOCKED

--- Comment #8 from Marcel de Rooy  ---
Still working here

-- 
You are receiving this mail because:
You are watching all bug changes.
___
Koha-bugs mailing list
Koha-bugs@lists.koha-community.org
http://lists.koha-community.org/cgi-bin/mailman/listinfo/koha-bugs
website : http://www.koha-community.org/
git : http://git.koha-community.org/
bugs : http://bugs.koha-community.org/


[Koha-bugs] [Bug 21610] Koha::Object->store needs to handle incorrect values

2018-10-19 Thread bugzilla-daemon
https://bugs.koha-community.org/bugzilla3/show_bug.cgi?id=21610

--- Comment #7 from Marcel de Rooy  ---
Created attachment 80906
  -->
https://bugs.koha-community.org/bugzilla3/attachment.cgi?id=80906=edit
Bug 21610: (QA follow-up) Better use columns_info from DBIx

We should better use the published method than a private hash key.
And shorter to go via _result than adding a new schema call.

Signed-off-by: Marcel de Rooy 

-- 
You are receiving this mail because:
You are watching all bug changes.
___
Koha-bugs mailing list
Koha-bugs@lists.koha-community.org
http://lists.koha-community.org/cgi-bin/mailman/listinfo/koha-bugs
website : http://www.koha-community.org/
git : http://git.koha-community.org/
bugs : http://bugs.koha-community.org/


[Koha-bugs] [Bug 21610] Koha::Object->store needs to handle incorrect values

2018-10-19 Thread bugzilla-daemon
https://bugs.koha-community.org/bugzilla3/show_bug.cgi?id=21610

Marcel de Rooy  changed:

   What|Removed |Added

   See Also||https://bugs.koha-community
   ||.org/bugzilla3/show_bug.cgi
   ||?id=21617

--- Comment #6 from Marcel de Rooy  ---
This test triggers the warn resolved in bug 21617

-- 
You are receiving this mail because:
You are watching all bug changes.
___
Koha-bugs mailing list
Koha-bugs@lists.koha-community.org
http://lists.koha-community.org/cgi-bin/mailman/listinfo/koha-bugs
website : http://www.koha-community.org/
git : http://git.koha-community.org/
bugs : http://bugs.koha-community.org/


[Koha-bugs] [Bug 21610] Koha::Object->store needs to handle incorrect values

2018-10-19 Thread bugzilla-daemon
https://bugs.koha-community.org/bugzilla3/show_bug.cgi?id=21610

--- Comment #5 from Marcel de Rooy  ---
Testing here now

-- 
You are receiving this mail because:
You are watching all bug changes.
___
Koha-bugs mailing list
Koha-bugs@lists.koha-community.org
http://lists.koha-community.org/cgi-bin/mailman/listinfo/koha-bugs
website : http://www.koha-community.org/
git : http://git.koha-community.org/
bugs : http://bugs.koha-community.org/


[Koha-bugs] [Bug 21610] Koha::Object->store needs to handle incorrect values

2018-10-18 Thread bugzilla-daemon
https://bugs.koha-community.org/bugzilla3/show_bug.cgi?id=21610

Jonathan Druart  changed:

   What|Removed |Added

 Blocks||17258


Referenced Bugs:

https://bugs.koha-community.org/bugzilla3/show_bug.cgi?id=17258
[Bug 17258] [OMNIBUS] MySQL 5.7
-- 
You are receiving this mail because:
You are watching all bug changes.
___
Koha-bugs mailing list
Koha-bugs@lists.koha-community.org
http://lists.koha-community.org/cgi-bin/mailman/listinfo/koha-bugs
website : http://www.koha-community.org/
git : http://git.koha-community.org/
bugs : http://bugs.koha-community.org/


[Koha-bugs] [Bug 21610] Koha::Object->store needs to handle incorrect values

2018-10-18 Thread bugzilla-daemon
https://bugs.koha-community.org/bugzilla3/show_bug.cgi?id=21610

Jonathan Druart  changed:

   What|Removed |Added

 CC||julian.maur...@biblibre.com
   ||,
   ||k...@bywatersolutions.com,
   ||m.de.r...@rijksmuseum.nl,
   ||martin.renvoize@ptfs-europe
   ||.com, tomasco...@gmail.com

-- 
You are receiving this mail because:
You are watching all bug changes.
___
Koha-bugs mailing list
Koha-bugs@lists.koha-community.org
http://lists.koha-community.org/cgi-bin/mailman/listinfo/koha-bugs
website : http://www.koha-community.org/
git : http://git.koha-community.org/
bugs : http://bugs.koha-community.org/


[Koha-bugs] [Bug 21610] Koha::Object->store needs to handle incorrect values

2018-10-18 Thread bugzilla-daemon
https://bugs.koha-community.org/bugzilla3/show_bug.cgi?id=21610

--- Comment #4 from Jonathan Druart  
---
Created attachment 80882
  -->
https://bugs.koha-community.org/bugzilla3/attachment.cgi?id=80882=edit
Bug 21610: Fix integers and dates values at Koha::Object->store level

With strict SQL modes, we are facing several issues when objects are stored.

The following errors can be raised by DBIx::Class when an object does not have
a valid (as defined at DB level) value:
- Incorrect integer value: '' for column COLUMN
- Incorrect decimal value: '' for column COLUMN
- Column 'COLUMN' cannot be null
- Field 'COLUMN' doesn't have a default value
- Incorrect date value: '' for column 'COLUMN'

We already handled some of them for Koha::Patron. As we do not want to provide
such
changes for all Koha::* modules we are going to fix this at Koha::Object->store
level
in order to provide a global fix.

This is related to bug 21599 (for item types) and bug 21596 (for patrons)

Test plan:
- Apply first patch, run the tests
=> Patch fail because of the previous error in Koha::ItemType->store, to make
them pass
you can replace
  $self->notforloan(0) unless $self->notforloan;
with
  $self->notforloan(undef) unless $self->notforloan;
- Apply second patch, run the tests
=> They fail because of dates and/or integers values
- Apply third patch, run the tests
=> They now pass

Deep code review wanted!

-- 
You are receiving this mail because:
You are watching all bug changes.
___
Koha-bugs mailing list
Koha-bugs@lists.koha-community.org
http://lists.koha-community.org/cgi-bin/mailman/listinfo/koha-bugs
website : http://www.koha-community.org/
git : http://git.koha-community.org/
bugs : http://bugs.koha-community.org/


[Koha-bugs] [Bug 21610] Koha::Object->store needs to handle incorrect values

2018-10-18 Thread bugzilla-daemon
https://bugs.koha-community.org/bugzilla3/show_bug.cgi?id=21610

--- Comment #3 from Jonathan Druart  
---
Created attachment 80881
  -->
https://bugs.koha-community.org/bugzilla3/attachment.cgi?id=80881=edit
Bug 21610: Remove specific changes we made previously

We handled integers and dates for Koha::Patron and Koha::ItemType, we
want now Koha::Object to deal with.

-- 
You are receiving this mail because:
You are watching all bug changes.
___
Koha-bugs mailing list
Koha-bugs@lists.koha-community.org
http://lists.koha-community.org/cgi-bin/mailman/listinfo/koha-bugs
website : http://www.koha-community.org/
git : http://git.koha-community.org/
bugs : http://bugs.koha-community.org/


[Koha-bugs] [Bug 21610] Koha::Object->store needs to handle incorrect values

2018-10-18 Thread bugzilla-daemon
https://bugs.koha-community.org/bugzilla3/show_bug.cgi?id=21610

--- Comment #2 from Jonathan Druart  
---
Created attachment 80880
  -->
https://bugs.koha-community.org/bugzilla3/attachment.cgi?id=80880=edit
Bug 21610: Add tests

Adding few tests to Koha/Object.t in order to highlight what we are
trying to fix.

Note that Koha::ItemType->store was wrong for notforloan, the default
value should be null
`notforloan` smallint(6) DEFAULT NULL,
but the previous fix (bug 21599) made it default to '0'

-- 
You are receiving this mail because:
You are watching all bug changes.
___
Koha-bugs mailing list
Koha-bugs@lists.koha-community.org
http://lists.koha-community.org/cgi-bin/mailman/listinfo/koha-bugs
website : http://www.koha-community.org/
git : http://git.koha-community.org/
bugs : http://bugs.koha-community.org/


[Koha-bugs] [Bug 21610] Koha::Object->store needs to handle incorrect values

2018-10-18 Thread bugzilla-daemon
https://bugs.koha-community.org/bugzilla3/show_bug.cgi?id=21610

Jonathan Druart  changed:

   What|Removed |Added

 Status|ASSIGNED|Needs Signoff

-- 
You are receiving this mail because:
You are watching all bug changes.
___
Koha-bugs mailing list
Koha-bugs@lists.koha-community.org
http://lists.koha-community.org/cgi-bin/mailman/listinfo/koha-bugs
website : http://www.koha-community.org/
git : http://git.koha-community.org/
bugs : http://bugs.koha-community.org/


[Koha-bugs] [Bug 21610] Koha::Object->store needs to handle incorrect values

2018-10-18 Thread bugzilla-daemon
https://bugs.koha-community.org/bugzilla3/show_bug.cgi?id=21610

Jonathan Druart  changed:

   What|Removed |Added

Summary|Koha::Object->store need to |Koha::Object->store needs
   |handle incorrect values |to handle incorrect values

-- 
You are receiving this mail because:
You are watching all bug changes.
___
Koha-bugs mailing list
Koha-bugs@lists.koha-community.org
http://lists.koha-community.org/cgi-bin/mailman/listinfo/koha-bugs
website : http://www.koha-community.org/
git : http://git.koha-community.org/
bugs : http://bugs.koha-community.org/