webERP Forum

Full Version: Database Error 1364 Field 'narrative'
You're currently viewing a stripped down version of our content. View the full version with proper formatting.
Well, I guess my host upgraded MySQL and now I'm popping up errors here and there.

If I go into an inventory item and click "Quantity Adjustments" and enter the usual things that need adjusting, after several seconds I get the following error:



Database Error 1364 : CRITICAL ERROR! NOTE DOWN THIS ERROR AND SEEK ASSISTANCE: The stock movement record cannot be inserted because
Field 'narrative' doesn't have a default value
Database SQL Failure : The following SQL to insert the stock movement record was used
INSERT INTO stockmoves (stockid, type, transno, loccode, trandate, userid, prd, reference, qty, newqoh, standardcost) VALUES ('SAMPLESTOCKCODE', 17, '4347', 'SAMPLELOCATION', '2017-07-19', 'USERNAME', '131', 'Counted and missing', '-1', '0', '1.105')
Database Rollback Due to Error Above : Rolling Back Transaction OK

Running 4.13.1
Problem fixed...

I had to log into phpMyAdmin (MySQL backend) and in table "stockmoves" I clicked on "narrative" and changed the default from "None" to "NULL". Seems to be working now.
Your fix works, but to fix the sql the query at Line 213 should be:

$SQL = "INSERT INTO stockmoves (stockid,
type,
transno,
loccode,
trandate,
userid,
prd,
reference,
qty,
newqoh,
standardcost,
narrative)
VALUES ('" . $_SESSION['Adjustment' . $identifier]->StockID . "',
17,
'" . $AdjustmentNumber . "',
'" . $_SESSION['Adjustment' . $identifier]->StockLocation . "',
'" . $SQLAdjustmentDate . "',
'" . $_SESSION['UserID'] . "',
'" . $PeriodNo . "',
'" . $_SESSION['Adjustment' . $identifier]->Narrative ."',
'" . $_SESSION['Adjustment' . $identifier]->Quantity . "',
'" . ($QtyOnHandPrior + $_SESSION['Adjustment' . $identifier]->Quantity) . "',
'" . $_SESSION['Adjustment' . $identifier]->StandardCost . "',
'')";

This is caused by the sql_mode issue I mentioned in answer to your other post.

Tim
This fix still hasn't been applied to SVN

Tim
Tim's change committed to SVN: revision 7813
Reference URL's