We launched new forums in March 2019—join us there. In a hurry for help with your website? Get Help Now!
    • 5430
    • 247 Posts
    I'm using a datetime field in a MIGX based CMP and the date TV type to render/edit it. Changes are not saving and I have no clue why. On initial save, the field is set to default to "now" which works fine and saves the proper value, but I can't get any edits to take. I'm at a loss any help would be greatly appreciated.

    Error log shows:
    [2015-06-23 16:40:39] (ERROR @ /path/to/www/core/components/podcasts/processors/mgr/default/update.php : 296) PHP warning: get_headers(): This function may only be used against URLs
    [2015-06-23 16:40:39] (ERROR @ /assets/components/migx/connector.php) Podcast: Attempt to set NOT NULL field length to NULL
    [2015-06-23 16:40:39] (ERROR @ /assets/components/migx/connector.php) Podcast: Attempt to set NOT NULL field mime to NULL

    Using MIGX 2.9.4 and MODX 2.3.3 on MODX Cloud.

    This question has been answered by claytonk. See the first response.

    [ed. note: claytonk last edited this post 11 years, 3 months ago.]
      • 4172
      • 5,888 Posts
      what is you xpdo-schema and your MIGX - configuration?
        -------------------------------

        you can buy me a beer, if you like MIGX

        http://webcmsolutions.de/migx.html

        Thanks!
        • 5430
        • 247 Posts
        Quote from: Bruno17 at Jun 23, 2015, 11:34 PM
        what is you xpdo-schema and your MIGX - configuration?

        Schema:

        <?xml version="1.0" encoding="UTF-8"?>
        <model package="podcasts" baseClass="xPDOObject" platform="mysql" defaultEngine="MyISAM" version="1.1">
            <object class="Podcast" table="podcasts" extends="xPDOSimpleObject">
        		<field key="channel" dbtype="varchar" precision="255" phptype="string" null="false" default="" />
        		<field key="title" dbtype="varchar" precision="255" phptype="string" null="false" default="" />
        		<field key="speaker" dbtype="varchar" precision="255" phptype="string" null="false" default="" />
        		<field key="description" dbtype="text" phptype="string" null="true" />
        		<field key="link" dbtype="varchar" precision="255" phptype="string" null="false" default="" />
        		<field key="length" dbtype="int" precision="10" phptype="integer" null="false" />
        		<field key="mime" dbtype="varchar" precision="255" phptype="string" null="false" default="" />
        		<field key="keywords" dbtype="varchar" precision="255" phptype="string" null="true" default="" />
        		<field key="createdon" dbtype="datetime" phptype="datetime" null="true"/>
        		<field key="publishedon" dbtype="datetime" phptype="datetime" null="true"/>
        		<field key="expires" dbtype="datetime" phptype="datetime" null="true"/>
        		<field key="duration" dbtype="time" phptype="string" null="true" />
        		<field key="createdby" dbtype="int" precision="10" phptype="integer" null="false" />
        		<field key="group" dbtype="varchar" precision="255" phptype="string" null="true" default="" />
        	</object>
        </model>


        MIGX config:

        {
          "formtabs":[
            {
              "MIGX_id":1,
              "caption":"Episode Details",
              "print_before_tabs":"0",
              "fields":[
                {
                  "MIGX_id":1,
                  "field":"channel",
                  "caption":"Channel",
                  "description":"Select podcast channel(s) this episode should appear in",
                  "description_is_code":"0",
                  "inputTV":"",
                  "inputTVtype":"listbox-multiple",
                  "validation":"",
                  "configs":"",
                  "restrictive_condition":"",
                  "display":"",
                  "sourceFrom":"config",
                  "sources":"",
                  "inputOptionValues":"English-Kindergarten-Audio||English-Kindergarten-Video||English-Primary-Audio||English-Primary-Video",
                  "default":"",
                  "useDefaultIfEmpty":"0",
                  "pos":1
                },
                {
                  "MIGX_id":2,
                  "field":"title",
                  "caption":"Episode Title",
                  "description":"",
                  "description_is_code":"0",
                  "inputTV":"",
                  "inputTVtype":"",
                  "validation":"",
                  "configs":"",
                  "restrictive_condition":"",
                  "display":"",
                  "sourceFrom":"config",
                  "sources":"",
                  "inputOptionValues":"",
                  "default":"",
                  "useDefaultIfEmpty":"0",
                  "pos":2
                },
                {
                  "MIGX_id":3,
                  "field":"speaker",
                  "caption":"Speaker\/Author",
                  "description":"",
                  "description_is_code":"0",
                  "inputTV":"",
                  "inputTVtype":"",
                  "validation":"",
                  "configs":"",
                  "restrictive_condition":"",
                  "display":"",
                  "sourceFrom":"config",
                  "sources":"",
                  "inputOptionValues":"",
                  "default":"",
                  "useDefaultIfEmpty":"0",
                  "pos":3
                },
                {
                  "MIGX_id":4,
                  "field":"description",
                  "caption":"Description\/Summary",
                  "description":"",
                  "description_is_code":"0",
                  "inputTV":"",
                  "inputTVtype":"textarea",
                  "validation":"",
                  "configs":"",
                  "restrictive_condition":"",
                  "display":"",
                  "sourceFrom":"config",
                  "sources":"",
                  "inputOptionValues":"",
                  "default":"",
                  "useDefaultIfEmpty":"0",
                  "pos":4
                },
                {
                  "MIGX_id":5,
                  "field":"link",
                  "caption":"Media File",
                  "description":"Only enter the filename, don't include the URL or path leading to the file.",
                  "description_is_code":"0",
                  "inputTV":"",
                  "inputTVtype":"",
                  "validation":"",
                  "configs":"",
                  "restrictive_condition":"",
                  "display":"",
                  "sourceFrom":"config",
                  "sources":"",
                  "inputOptionValues":"",
                  "default":"",
                  "useDefaultIfEmpty":"0",
                  "pos":5
                },
                {
                  "MIGX_id":6,
                  "field":"duration",
                  "caption":"Episode Length (format HH:MM:SS)",
                  "description":"Enter the episode in hours:minutes:seconds using two digits for each value (i.e. 00:05:32 for an episode five minutes and thirty two seconds in length)",
                  "description_is_code":"0",
                  "inputTV":"",
                  "inputTVtype":"",
                  "validation":"",
                  "configs":"",
                  "restrictive_condition":"",
                  "display":"",
                  "sourceFrom":"config",
                  "sources":"",
                  "inputOptionValues":"",
                  "default":"",
                  "useDefaultIfEmpty":"0",
                  "pos":6
                },
                {
                  "MIGX_id":7,
                  "field":"createdon",
                  "caption":"Creation Date",
                  "description":"",
                  "description_is_code":"0",
                  "inputTV":"",
                  "inputTVtype":"date",
                  "validation":"",
                  "configs":"",
                  "restrictive_condition":"",
                  "display":"none",
                  "sourceFrom":"config",
                  "sources":"",
                  "inputOptionValues":"",
                  "default":"now",
                  "useDefaultIfEmpty":1,
                  "pos":7
                },
                {
                  "MIGX_id":11,
                  "field":"group",
                  "caption":"Group",
                  "description":"",
                  "description_is_code":"0",
                  "inputTV":"",
                  "inputTVtype":"",
                  "validation":"",
                  "configs":"",
                  "restrictive_condition":"",
                  "display":"none",
                  "sourceFrom":"config",
                  "sources":"",
                  "inputOptionValues":"",
                  "default":"gracelink-english",
                  "useDefaultIfEmpty":1,
                  "pos":8
                }
              ],
              "pos":1
            },
            {
              "MIGX_id":2,
              "caption":"Additional Options",
              "print_before_tabs":"0",
              "fields":[
                {
                  "MIGX_id":8,
                  "field":"keywords",
                  "caption":"Keywords",
                  "description":"",
                  "description_is_code":"0",
                  "inputTV":"",
                  "inputTVtype":"",
                  "validation":"",
                  "configs":"",
                  "restrictive_condition":"",
                  "display":"",
                  "sourceFrom":"config",
                  "sources":"",
                  "inputOptionValues":"",
                  "default":"GraceLink, Grace Link, Sabbath School, God, Jesus, Christ, Kindergarten, Primary, Sunday School, Christian, New Testament,Bible, Adventist, Old Testament, Stories, audio, Kids, Studio Elpizo, Aunt Frenita, Clayton Kinney,Faith Toh, Falvo Fowler",
                  "useDefaultIfEmpty":1,
                  "pos":1
                },
                {
                  "MIGX_id":9,
                  "field":"publishedon",
                  "caption":"Activation Date (optional)",
                  "description":"Enter a future date on which this episode will become part of your feed if you prefer to not make it available immediately.",
                  "description_is_code":"0",
                  "inputTV":"",
                  "inputTVtype":"date",
                  "validation":"",
                  "configs":"",
                  "restrictive_condition":"",
                  "display":"",
                  "sourceFrom":"config",
                  "sources":"",
                  "inputOptionValues":"",
                  "default":"now",
                  "useDefaultIfEmpty":"0",
                  "pos":2
                },
                {
                  "MIGX_id":10,
                  "field":"expires",
                  "caption":"Deactivation Date (optional)",
                  "description":"Enter a future date after which this episode will no longer be part of your feed.",
                  "description_is_code":"0",
                  "inputTV":"",
                  "inputTVtype":"date",
                  "validation":"",
                  "configs":"",
                  "restrictive_condition":"",
                  "display":"",
                  "sourceFrom":"config",
                  "sources":"",
                  "inputOptionValues":"",
                  "default":"",
                  "useDefaultIfEmpty":"0",
                  "pos":3
                }
              ],
              "pos":2
            }
          ],
          "contextmenus":"update||duplicate||remove",
          "actionbuttons":"addItem",
          "columnbuttons":"",
          "filters":[
            {
              "MIGX_id":1,
              "name":"search",
              "label":"search",
              "emptytext":"search...",
              "type":"textbox",
              "getlistwhere":{
                "channel:LIKE":"%[[+search]]%",
                "OR:title:LIKE":"%[[+search]]%",
                "OR:speaker:LIKE":"%[[+search]]%",
                "OR:description:LIKE":"%[[+search]]%",
                "OR:link:LIKE":"%[[+search]]%"
              },
              "getcomboprocessor":"",
              "combotextfield":"",
              "comboidfield":"",
              "comboparent":"",
              "default":""
            }
          ],
          "extended":{
            "migx_add":"Add Episode",
            "disable_add_item":"",
            "add_items_directly":"",
            "formcaption":"",
            "update_win_title":"",
            "win_id":"gracelinkEnglish",
            "maxRecords":"",
            "addNewItemAt":"top",
            "multiple_formtabs":"",
            "multiple_formtabs_label":"",
            "multiple_formtabs_field":"",
            "multiple_formtabs_optionstext":"",
            "multiple_formtabs_optionsvalue":"",
            "actionbuttonsperrow":4,
            "winbuttonslist":"",
            "extrahandlers":"",
            "filtersperrow":4,
            "packageName":"podcasts",
            "classname":"Podcast",
            "task":"",
            "getlistsort":"publishedon",
            "getlistsortdir":"DESC",
            "sortconfig":"",
            "gridpagesize":100,
            "use_custom_prefix":"0",
            "prefix":"",
            "grid":"",
            "gridload_mode":1,
            "check_resid":1,
            "check_resid_TV":"",
            "join_alias":"",
            "has_jointable":"no",
            "getlistwhere":{
              "group":"gracelink-english"
            },
            "joins":"",
            "hooksnippets":"",
            "cmpmaincaption":"Gracelink Podcasts",
            "cmptabcaption":"Gracelink English",
            "cmptabdescription":"Add\/edit episodes",
            "cmptabcontroller":"",
            "winbuttons":"",
            "onsubmitsuccess":"",
            "submitparams":""
          },
          "columns":[
            {
              "MIGX_id":1,
              "header":"ID",
              "dataIndex":"id",
              "width":"",
              "sortable":true,
              "show_in_grid":"0",
              "renderer":"",
              "clickaction":"",
              "selectorconfig":"",
              "renderchunktpl":"",
              "renderoptions":"",
              "editor":""
            },
            {
              "MIGX_id":2,
              "header":"Channel",
              "dataIndex":"channel",
              "width":"",
              "sortable":true,
              "show_in_grid":1,
              "renderer":"",
              "clickaction":"",
              "selectorconfig":"",
              "renderchunktpl":"",
              "renderoptions":"",
              "editor":""
            },
            {
              "MIGX_id":3,
              "header":"Episode Title",
              "dataIndex":"title",
              "width":"",
              "sortable":true,
              "show_in_grid":1,
              "renderer":"",
              "clickaction":"",
              "selectorconfig":"",
              "renderchunktpl":"",
              "renderoptions":"",
              "editor":""
            },
            {
              "MIGX_id":4,
              "header":"Speaker\/Author",
              "dataIndex":"speaker",
              "width":"",
              "sortable":true,
              "show_in_grid":1,
              "renderer":"",
              "clickaction":"",
              "selectorconfig":"",
              "renderchunktpl":"",
              "renderoptions":"",
              "editor":""
            },
            {
              "MIGX_id":5,
              "header":"Media File",
              "dataIndex":"link",
              "width":"",
              "sortable":true,
              "show_in_grid":1,
              "renderer":"",
              "clickaction":"",
              "selectorconfig":"",
              "renderchunktpl":"",
              "renderoptions":"",
              "editor":""
            },
            {
              "MIGX_id":6,
              "header":"Added to Feed",
              "dataIndex":"publishedon",
              "width":"",
              "sortable":true,
              "show_in_grid":1,
              "renderer":"",
              "clickaction":"",
              "selectorconfig":"",
              "renderchunktpl":"",
              "renderoptions":"",
              "editor":""
            }
          ]
        }

          • 5430
          • 247 Posts
          Should have mentioned, the field in question is createdon, but I'm sure whatever I've done wrong with that one will also apply to the other date fields.
            • 4172
            • 5,888 Posts
            there are some fields with null="false", but without a default
            this can make issues in some environments.

            try

            <field key="createdby" dbtype="int" precision="10" phptype="integer" null="false" default="0" />


            parsing the schema again will not change that in your tables.
            you will need to change that in your tables, too.
              -------------------------------

              you can buy me a beer, if you like MIGX

              http://webcmsolutions.de/migx.html

              Thanks!
              • 5430
              • 247 Posts
              No joy.

              I modified the schema so that all null="false" fields have a default, re-parsed the schema, and updated the database table to include the same set of defaults as the schema. Date values still won't save and I'm getting the same set of errors in my log:

              [2015-06-24 02:51:25] (ERROR @ /path/to/www/core/components/podcasts/processors/mgr/default/update.php : 296) PHP warning: get_headers(): This function may only be used against URLs
              [2015-06-24 02:51:25] (ERROR @ /assets/components/migx/connector.php) Podcast: Attempt to set NOT NULL field length to NULL
              [2015-06-24 02:51:25] (ERROR @ /assets/components/migx/connector.php) Podcast: Attempt to set NOT NULL field mime to NULL
              • discuss.answer
                • 5430
                • 247 Posts
                Think I found it. I commented out the following lines in the processor:
                if (empty($postvalues['ow_createdon'])) {
                    $postvalues['createdon'] = $tempvalues['createdon'];
                }
                if (empty($postvalues['ow_publishedon'])) {
                    $postvalues['publishedon'] = $tempvalues['publishedon'];
                }
                

                Seems this was conflicting with me values since I have fields with these same names. Seems to work now.
                  • 4172
                  • 5,888 Posts
                  when you modify MIGX-default-processors, they will get overridden with upgrades.

                  You should create a copy of that processort then, in

                  yourpackage/processors/mgr/default/

                  or alternative in

                  yourpackage/processors/mgr/yourprocessorspath/

                  if you need different processors for different configs and you have defined a processorspath in your MIGX-config
                    -------------------------------

                    you can buy me a beer, if you like MIGX

                    http://webcmsolutions.de/migx.html

                    Thanks!
                    • 5430
                    • 247 Posts
                    Thanks Bruno. In this case I was already using a custom processor to deal with some oddness in the data I was collecting, so we're all good. Many, many thanks for all your help.