Bug 3790

Summary: DB Error: Incorrect integer value: '' for column 'review_form_id' at row 1
Product: OJS Reporter: Fanrien <fanrien>
Component: Journal ManagementAssignee: Alec Smecher <alec>
Status: RESOLVED FIXED    
Severity: major CC: dkaloper, fanrien, magonzalez, mikey.willis, pkp-support
Priority: P1    
Version: 2.2.3   
Hardware: PC   
OS: Linux   
Version Reported In: Also Affects:
Attachments: Patch against OJS 2.2.1
Patch against OJS 2.2.2
Additional patch against OJS 2.2.2
Patch

Description Fanrien 2008-09-26 03:26:17 PDT
When I create a new section, the system reports this: "DB Error: Incorrect integer value: '' for column 'review_form_id' at row 1".

And I have set a section editor, but it did not show on "Available Section Editors".

How can I do?
Comment 1 Alec Smecher 2008-09-26 09:09:37 PDT
Created attachment 987 [details]
Patch against OJS 2.2.1
Comment 2 Alec Smecher 2008-09-26 09:13:19 PDT
Created attachment 988 [details]
Patch against OJS 2.2.2
Comment 3 Alec Smecher 2008-09-26 09:13:57 PDT
Attached patch a) ensures that blank review form IDs are cast to null, and b) the section editor list is removed from the "create section" form (but available on "edit section").
Comment 4 Alec Smecher 2008-09-28 19:43:25 PDT
*** Bug 3793 has been marked as a duplicate of this bug. ***
Comment 5 Fanrien 2008-09-28 19:52:44 PDT
WebServer2 htdocs # ls
Bug3790patch  classes         config.TEMPLATE.inc.php  docs  includes   js   locale    pages    public    rt      templates
cache         config.inc.php  dbscripts                help  index.php  lib  logo.jpg  plugins  registry  styles  tools
WebServer2 htdocs # cat Bug3790patch
diff -u -r1.37 SectionForm.inc.php
--- classes/manager/form/SectionForm.inc.php    1 Jul 2008 01:16:10 -0000       1.37
+++ classes/manager/form/SectionForm.inc.php    26 Sep 2008 16:09:00 -0000
@@ -206,7 +206,9 @@

                $section->setTitle($this->getData('title'), null); // Localized
                $section->setAbbrev($this->getData('abbrev'), null); // Localized
-               $section->setReviewFormId($this->getData('reviewFormId'));
+               $reviewFormId = $this->getData('reviewFormId');
+               if ($reviewFormId === '') $reviewFormId = null;
+               $section->setReviewFormId($reviewFormId);
                $section->setMetaIndexed($this->getData('metaIndexed') ? 0 : 1); // #2066: Inverted
                $section->setMetaReviewed($this->getData('metaReviewed') ? 0 : 1); // #2066: Inverted
                $section->setAbstractsNotRequired($this->getData('abstractsNotRequired') ? 1 : 0);
diff -u -r1.44 sectionForm.tpl
--- templates/manager/sections/sectionForm.tpl  9 Jul 2008 02:45:40 -0000       1.44
+++ templates/manager/sections/sectionForm.tpl  26 Sep 2008 16:12:37 -0000
@@ -154,6 +154,8 @@
 </tr>
 {/if}
 </table>
+
+{if $sectionId}{* Disable section editor selection if this is a new section *}
 <div class="separator"></div>

 <h3>{translate key="user.role.sectionEditors"}</h3>
@@ -229,6 +231,8 @@
        </tr>
 </table>

+{/if}{* $sectionId *}
+
 <p><input type="submit" value="{translate key="common.save"}" class="button defaultButton" /> <input type="button" value="{translate key="common.cancel"}" class="button" onclick="document.location.href='{url op="sections" escape=false}'" /></p>

 </form>
WebServer2 htdocs # patch -p1 < Bug3790patch
can't find file to patch at input line 4
Perhaps you used the wrong -p or --strip option?
The text leading up to this was:
--------------------------
|diff -u -r1.37 SectionForm.inc.php
|--- classes/manager/form/SectionForm.inc.php   1 Jul 2008 01:16:10 -0000       1.37
|+++ classes/manager/form/SectionForm.inc.php   26 Sep 2008 16:09:00 -0000
--------------------------
File to patch:

================================================================
Dear all, why the patch program can't find the file?
Path and version are exactly correct.
Please advise.
Comment 6 Alec Smecher 2008-09-28 19:54:55 PDT
Try using -p0 instead of -p1.
Comment 7 Alec Smecher 2008-10-02 08:06:18 PDT
*** Bug 3796 has been marked as a duplicate of this bug. ***
Comment 8 Alec Smecher 2008-10-02 09:06:21 PDT
Created attachment 1002 [details]
Additional patch against OJS 2.2.2
Comment 9 Alec Smecher 2008-10-02 09:08:15 PDT
*** Bug 3796 has been marked as a duplicate of this bug. ***
Comment 10 Rui 2009-02-12 04:32:14 PST
Created attachment 1435 [details]
Patch
Comment 11 Alec Smecher 2009-02-12 06:40:23 PST
Rui, is this an additional fix? If so, could you send a unified diff (generated using "diff -u") instead of the complete modified file?