<?xml version="1.0" encoding="UTF-8" ?>
<?xml-stylesheet type="text/xsl" href="https://sugarclub.sugarai.com/cfs-file/__key/system/syndication/rss.xsl" media="screen"?><rss version="2.0" xmlns:dc="http://purl.org/dc/elements/1.1/" xmlns:slash="http://purl.org/rss/1.0/modules/slash/" xmlns:wfw="http://wellformedweb.org/CommentAPI/"><channel><title>warning undefined key &amp;quot;calculated&amp;quot;</title><link>https://sugarclub.sugarai.com/dev-club/f/questions-answers/7831/warning-undefined-key-calculated</link><description>Hi, 
 
 I have created a custom scheduler, which runs fine, but it gives me the following warning: 
 Warning [2]: Undefined array key &amp;quot;calculated&amp;quot; over /var/www/html/include/Expressions/DependencyManager.php op regel 188 
 I feel like this is a bug, but</description><dc:language>en-US</dc:language><generator>Telligent Community 12</generator><item><title>RE: warning undefined key "calculated"</title><link>https://sugarclub.sugarai.com/thread/32605?ContentTypeID=1</link><pubDate>Thu, 16 Jan 2025 15:07:24 GMT</pubDate><guid isPermaLink="false">5c521d64-519d-47a6-9065-134618b211bf:d5e0c66b-f9ac-4671-9589-67f8d50b09df</guid><dc:creator>Stijn Vermeulen</dc:creator><description>&lt;p&gt;Thank you Andr&amp;eacute;, I am trying the suggestions, but think I will have to pin point the cause of the problem further, because the cause of the problem is still not clear. I will update this thread once I have more info.&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: warning undefined key "calculated"</title><link>https://sugarclub.sugarai.com/thread/32559?ContentTypeID=1</link><pubDate>Thu, 09 Jan 2025 18:01:14 GMT</pubDate><guid isPermaLink="false">5c521d64-519d-47a6-9065-134618b211bf:d33efb22-0a65-4261-845f-47388fa741c8</guid><dc:creator>Andre Serrazina</dc:creator><description>&lt;p&gt;Hi&amp;nbsp;&lt;a href="/members/stijnvermeulen330276"&gt;Stijn Vermeulen&lt;/a&gt;&amp;nbsp;,&amp;nbsp;&lt;br /&gt;&lt;br /&gt;&lt;/p&gt;
&lt;p class="p1"&gt;I implemented a very similar&amp;nbsp;Scheduler using the &lt;a href="https://support.sugarcrm.com/documentation/sugar_developer/sugar_developer_guide_14.1/architecture/job_queue/schedulers/creating_custom_schedulers/#Defining_the_Job_Function"&gt;standard approach outlined in our documentation&lt;/a&gt;,&lt;/p&gt;
&lt;p class="p2"&gt;&lt;/p&gt;
&lt;p class="p1"&gt;Here is the code I added to my instance:&lt;/p&gt;
&lt;p&gt;&lt;br /&gt;&lt;br /&gt;&lt;pre class="ui-code" data-mode="php"&gt;&amp;lt;?php

//file custom/Extension/modules/Schedulers/Ext/ScheduledTasks/update_quotes.php

// Register the custom job
array_push($job_strings, &amp;#39;custom_job&amp;#39;);

// Define a constant outside the function
define(&amp;#39;RECORD_LIMIT&amp;#39;, 100);

function custom_job()
{
    $sugarQuery = new SugarQuery();
    $sugarQuery-&amp;gt;from(BeanFactory::newBean(&amp;#39;Quotes&amp;#39;));
    $sugarQuery-&amp;gt;select(array(&amp;#39;id&amp;#39;, &amp;#39;quote_num&amp;#39;));
    $sugarQuery-&amp;gt;where()-&amp;gt;equals(&amp;#39;quote_stage&amp;#39;, &amp;#39;Draft&amp;#39;);
    $sugarQuery-&amp;gt;limit(RECORD_LIMIT);

    $quotes = $sugarQuery-&amp;gt;execute();
    if (!empty($quotes)) {
        foreach ($quotes as $entry) {
            $quote = BeanFactory::retrieveBean(&amp;#39;Quotes&amp;#39;, $entry[&amp;quot;id&amp;quot;]);
            if ($quote) {
                $quote-&amp;gt;quote_stage = &amp;#39;Delivered&amp;#39;;
                $quote-&amp;gt;projectcode_c = &amp;#39;123746&amp;#39;;
                $quote-&amp;gt;save();
            }
        }
    }

    return true;
}&lt;/pre&gt;&lt;/p&gt;
&lt;p&gt;&lt;/p&gt;
&lt;p&gt;&lt;/p&gt;
&lt;p class="p1"&gt;The job is running as expected, and I&amp;rsquo;m not seeing any warnings on my end.&amp;nbsp;&lt;/p&gt;
&lt;p class="p2"&gt;&lt;/p&gt;
&lt;p class="p1"&gt;Would you mind testing my approach to see if it makes any difference?&lt;/p&gt;
&lt;p class="p2"&gt;&lt;/p&gt;
&lt;p class="p1"&gt;Another thing I noticed is that &lt;span class="s1"&gt;match()&lt;a href="https://www.php.net/manual/en/reserved.keywords.php?utm_source=chatgpt.com"&gt; is a reserved keyword in PHP 8&lt;/a&gt;&lt;/span&gt;&amp;nbsp;due to the introduction of the &lt;span class="s1"&gt;match&lt;/span&gt; expression. Could you try changing the function name to see if the behavior changes?&lt;/p&gt;
&lt;p class="p2"&gt;&lt;/p&gt;
&lt;p class="p1"&gt;If that doesn&amp;rsquo;t resolve the issue, could you share the field vardefs for both:&lt;/p&gt;
&lt;p class="p3"&gt;&lt;span class="s2"&gt;&lt;span class="Apple-tab-span"&gt; &lt;/span&gt;&amp;bull;&lt;span class="Apple-tab-span"&gt; &lt;/span&gt;&lt;/span&gt;projectcode_c&lt;/p&gt;
&lt;p class="p3"&gt;&lt;span class="s2"&gt;&lt;span class="Apple-tab-span"&gt; &lt;/span&gt;&amp;bull;&lt;span class="Apple-tab-span"&gt; &lt;/span&gt;&lt;/span&gt;quote_stage&lt;br /&gt;&lt;br /&gt;&lt;/p&gt;
&lt;p class="p2"&gt;&lt;/p&gt;
&lt;p class="p1"&gt;This would help us identify if there&amp;rsquo;s anything in the&amp;nbsp;fields we are trying to edit&amp;nbsp;causing the discrepancy in behavior.&lt;/p&gt;
&lt;p class="p2"&gt;&lt;/p&gt;
&lt;p class="p1"&gt;&lt;br /&gt;I hope this brings us closer to a resolution!&lt;/p&gt;
&lt;p class="p2"&gt;&lt;/p&gt;
&lt;p class="p1"&gt;&lt;br /&gt;Cheers,&lt;/p&gt;
&lt;p class="p1"&gt;Andr&amp;eacute;&lt;/p&gt;
&lt;div&gt;
&lt;div&gt;
&lt;div&gt;
&lt;div&gt;&lt;span&gt;&lt;/span&gt;&lt;/div&gt;
&lt;/div&gt;
&lt;/div&gt;
&lt;/div&gt;
&lt;div&gt;&lt;/div&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: warning undefined key "calculated"</title><link>https://sugarclub.sugarai.com/thread/32552?ContentTypeID=1</link><pubDate>Thu, 09 Jan 2025 11:18:41 GMT</pubDate><guid isPermaLink="false">5c521d64-519d-47a6-9065-134618b211bf:ec348256-32aa-4176-98c8-a1294edb2041</guid><dc:creator>Stijn Vermeulen</dc:creator><description>&lt;p&gt;Normally project code would be determined based on other data, but without this logic, the code still gives the same error. So to simplify I removed as much code which still results in the same error.&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: warning undefined key "calculated"</title><link>https://sugarclub.sugarai.com/thread/32551?ContentTypeID=1</link><pubDate>Thu, 09 Jan 2025 11:16:02 GMT</pubDate><guid isPermaLink="false">5c521d64-519d-47a6-9065-134618b211bf:009bcc64-fa9b-4f67-98a0-08dad4dcbee7</guid><dc:creator>Stijn Vermeulen</dc:creator><description>&lt;div&gt;
&lt;pre&gt;&lt;span&gt;&amp;lt;?php&lt;br /&gt;&lt;/span&gt;&lt;span&gt;namespace &lt;/span&gt;Sugarcrm\Sugarcrm\custom\inc\processors;&lt;br /&gt;&lt;br /&gt;&lt;span&gt;use &lt;/span&gt;BeanFactory;&lt;br /&gt;&lt;span&gt;use &lt;/span&gt;&lt;span&gt;SugarBean&lt;/span&gt;;&lt;br /&gt;&lt;span&gt;use &lt;/span&gt;SugarQuery;&lt;br /&gt;&lt;br /&gt;&lt;span&gt;class My&lt;/span&gt;Scheduler&lt;br /&gt;{&lt;br /&gt;    &lt;span&gt;const &lt;/span&gt;&lt;span&gt;RECORD_LIMIT &lt;/span&gt;= &lt;span&gt;100&lt;/span&gt;;&lt;br /&gt;&lt;br /&gt;    &lt;span&gt;public function &lt;/span&gt;match()&lt;br /&gt;    {&lt;br /&gt;        &lt;span&gt;$sugarQuery &lt;/span&gt;= &lt;span&gt;new &lt;/span&gt;SugarQuery();&lt;br /&gt;        &lt;span&gt;$sugarQuery&lt;/span&gt;-&amp;gt;from(BeanFactory::&lt;span&gt;newBean&lt;/span&gt;(&lt;span&gt;&amp;#39;Quotes&amp;#39;&lt;/span&gt;));&lt;br /&gt;        &lt;span&gt;$sugarQuery&lt;/span&gt;-&amp;gt;select(&lt;span&gt;array&lt;/span&gt;(&lt;span&gt;&amp;#39;id&amp;#39;&lt;/span&gt;, &lt;span&gt;&amp;#39;quote_num&amp;#39;&lt;/span&gt;));&lt;br /&gt;        &lt;span&gt;$sugarQuery&lt;/span&gt;-&amp;gt;where()-&amp;gt;equals(&lt;span&gt;&amp;#39;quote_stage&amp;#39;&lt;/span&gt;, &lt;span&gt;&amp;#39;Wacht op verwerking&amp;#39;&lt;/span&gt;);&lt;br /&gt;        &lt;span&gt;$sugarQuery&lt;/span&gt;-&amp;gt;limit(&lt;span&gt;self&lt;/span&gt;::&lt;span&gt;RECORD_LIMIT&lt;/span&gt;);&lt;br /&gt;&lt;br /&gt;        &lt;span&gt;$quotes &lt;/span&gt;= &lt;span&gt;$sugarQuery&lt;/span&gt;-&amp;gt;execute();&lt;br /&gt;        &lt;span&gt;if&lt;/span&gt;(safeCount(&lt;span&gt;$quotes&lt;/span&gt;) &amp;gt; &lt;span&gt;0&lt;/span&gt;) {&lt;br /&gt;            &lt;span&gt;foreach&lt;/span&gt;(&lt;span&gt;$quotes &lt;/span&gt;&lt;span&gt;as &lt;/span&gt;&lt;span&gt;$entry&lt;/span&gt;) {&lt;br /&gt;                &lt;span&gt;$entry &lt;/span&gt;= BeanFactory::&lt;span&gt;retrieveBean&lt;/span&gt;(&lt;span&gt;&amp;#39;Quotes&amp;#39;&lt;/span&gt;, &lt;span&gt;$entry&lt;/span&gt;[&lt;span&gt;&amp;quot;id&amp;quot;&lt;/span&gt;]);&lt;br /&gt;                &lt;span&gt;$entry&lt;/span&gt;-&amp;gt;&lt;span&gt;quote_stage &lt;/span&gt;= &lt;span&gt;&amp;#39;Concept offerte&amp;#39;&lt;/span&gt;;&lt;br /&gt;                &lt;span&gt;$entry&lt;/span&gt;-&amp;gt;&lt;span&gt;projectcode_c &lt;/span&gt;= &lt;span&gt;&amp;#39;123746&amp;#39;&lt;/span&gt;;&lt;br /&gt;                &lt;span&gt;$entry&lt;/span&gt;-&amp;gt;save();&lt;br /&gt;            }&lt;br /&gt;        }&lt;br /&gt;    }&lt;br /&gt;}&lt;/pre&gt;
&lt;/div&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: warning undefined key "calculated"</title><link>https://sugarclub.sugarai.com/thread/32550?ContentTypeID=1</link><pubDate>Thu, 09 Jan 2025 10:58:03 GMT</pubDate><guid isPermaLink="false">5c521d64-519d-47a6-9065-134618b211bf:2a447f63-ef96-4a73-821b-399811f9ca97</guid><dc:creator>Andre Serrazina</dc:creator><description>&lt;p&gt;Hi&amp;nbsp;&lt;a href="/members/stijnvermeulen330276"&gt;Stijn Vermeulen&lt;/a&gt;&amp;nbsp;,&amp;nbsp;&lt;br /&gt;&lt;br /&gt;Hum...that&amp;#39;s a bummer.&amp;nbsp;&lt;br /&gt;Would you mind sharing the complete custom Scheduler file content, I would like to test it locally to see if I get the same on a stock 13.0.3.&amp;nbsp;&lt;br /&gt;&lt;br /&gt;Cheers,&amp;nbsp;&lt;br /&gt;&lt;br /&gt;Andr&amp;eacute;&amp;nbsp;&lt;br /&gt;&lt;br /&gt;&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: warning undefined key "calculated"</title><link>https://sugarclub.sugarai.com/thread/32549?ContentTypeID=1</link><pubDate>Thu, 09 Jan 2025 09:36:38 GMT</pubDate><guid isPermaLink="false">5c521d64-519d-47a6-9065-134618b211bf:01efb5e6-7538-4ece-a64a-a42e2ac56335</guid><dc:creator>Stijn Vermeulen</dc:creator><description>&lt;p&gt;Hi Andr&amp;eacute;,&lt;/p&gt;
&lt;p&gt;It took a while for sugar to give me the hotfix, hence the late reply. I tested the hotfix, but it does not solve my problem. Any idea what else could cause this problem?&lt;/p&gt;
&lt;p&gt;Regards,&lt;/p&gt;
&lt;p&gt;Stijn&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: warning undefined key "calculated"</title><link>https://sugarclub.sugarai.com/thread/32403?ContentTypeID=1</link><pubDate>Thu, 12 Dec 2024 13:48:47 GMT</pubDate><guid isPermaLink="false">5c521d64-519d-47a6-9065-134618b211bf:258bee88-32a2-4ac5-8289-a744c5b66031</guid><dc:creator>Stijn Vermeulen</dc:creator><description>&lt;p&gt;Hi Andr&amp;eacute;,&lt;/p&gt;
&lt;p&gt;&lt;/p&gt;
&lt;p&gt;Thank you very much, I have asked for a hotfix, I will update this question when I have received the hotfix.&lt;/p&gt;
&lt;p&gt;&lt;/p&gt;
&lt;p&gt;Kind regards,&lt;/p&gt;
&lt;p&gt;Stijn&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: warning undefined key "calculated"</title><link>https://sugarclub.sugarai.com/thread/32402?ContentTypeID=1</link><pubDate>Thu, 12 Dec 2024 12:57:05 GMT</pubDate><guid isPermaLink="false">5c521d64-519d-47a6-9065-134618b211bf:1ad13e21-e4a1-456c-8433-ea3dfb1cc878</guid><dc:creator>Andre Serrazina</dc:creator><description>&lt;p&gt;Hello &lt;a href="/members/stijnvermeulen330276"&gt;Stijn Vermeulen&lt;/a&gt;&amp;nbsp;,&lt;br /&gt;&lt;br /&gt;I suspect that this is the issue behind the warning that you are seeing&lt;/p&gt;
&lt;p&gt;&amp;nbsp;#92699 ( &lt;a href="https://portal.sugarondemand.com/#supp_Bugs/92699"&gt;portal.sugarondemand.com/&lt;/a&gt; )&lt;/p&gt;
&lt;p&gt;This issue arises because certain &lt;code&gt;E_NOTICE&lt;/code&gt; warnings that were previously suppressed in &lt;code&gt;SugarCronJobs::executeJob()&lt;/code&gt; under PHP 7 are now being treated as &lt;code&gt;E_WARNING&lt;/code&gt; in PHP 8.&lt;br /&gt; As a result, these warnings are no longer ignored and are displayed during execution, causing the Warning that you see in the log.&amp;nbsp;&lt;/p&gt;
&lt;p&gt;This issue was fixed, you should be able to get an hotfix via support case.&amp;nbsp;&lt;br /&gt;Let us know if that prevents the warnings to show.&amp;nbsp;&lt;br /&gt;&lt;br /&gt;Cheers,&amp;nbsp;&lt;br /&gt;&lt;br /&gt;Andr&amp;eacute;&amp;nbsp;&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item></channel></rss>