jaredcowing / wmsNewBooks

Small program to view list of new books by fund & date acquired using WorldShare Acquisitions API.
MIT License
2 stars 1 forks source link

SQLite3 warnings #2

Closed gjerdery closed 4 years ago

gjerdery commented 4 years ago

I receive the following stream of warnings when attempting to add items that haven't been received:

A PHP Error was encountered Severity: Warning

Message: SQLite3::exec(): NOT NULL constraint failed: item.receiptDate

Filename: sqlite3/sqlite3_driver.php

Line Number: 128

Backtrace:

File: /var/www/html/wmsNewBooks/application/models/Newbooks_model.php Line: 61 Function: insert

File: /var/www/html/wmsNewBooks/application/controllers/Bookfeed.php Line: 234 Function: saveOrderItem

File: /var/www/html/wmsNewBooks/application/controllers/Bookfeed.php Line: 85 Function: autoLoadItems

File: /var/www/html/wmsNewBooks/index.php Line: 315 Function: require_once


A PHP Error was encountered Severity: Warning

Message: Cannot modify header information - headers already sent by (output started at /var/www/html/wmsNewBooks/application/controllers/Bookfeed.php:93)

Filename: core/Common.php

Line Number: 570

Backtrace:

File: /var/www/html/wmsNewBooks/application/models/Newbooks_model.php Line: 61 Function: insert

File: /var/www/html/wmsNewBooks/application/controllers/Bookfeed.php Line: 234 Function: saveOrderItem

File: /var/www/html/wmsNewBooks/application/controllers/Bookfeed.php Line: 85 Function: autoLoadItems

File: /var/www/html/wmsNewBooks/index.php Line: 315 Function: require_once


A Database Error Occurred Error Number: 0

not an error

INSERT INTO "item" ("orderItemNum", "orderNum", "title", "matType", "person1", "ocn", "isbn", "fund", "orderStat", "receiptStat", "orderDate", "coverURL") VALUES ('PO-2020-411-1', 'PO-2020-411', 'The cmdty yearbook ...', 'JRNL', 'Barchart (Firm)', '1108655034', '', '52156econ', 'ORDERED', 'NOT_RECEIVED', '2020:08:19', 'http://books.google.com/books/content?id=t5rgAAAAMAAJ&printsec=frontcover&img=1&zoom=1&source=gbs_api')

Filename: models/Newbooks_model.php

Line Number: 61

jaredcowing commented 4 years ago

Thanks for reporting it. When loading new items, if there is not yet a received date, it should be set to an empty value like "0000-00-00". I believe MySQL was setting that for me when it saw no dateReceived value being passed to it; I will add a line of code to explicitly set a value for this when the item has not yet been received (should remove that error).

gjerdery commented 4 years ago

Confirming setting a value for dateReceived works for me.