Mass Update Error

Topics related to AppGini plugins/add-ons go here.
Post Reply
User avatar
ronwill
Veteran Member
Posts: 228
Joined: 2015-08-08 10:12
Location: Cheltenham UK +Weatherford USA

Mass Update Error

Post by ronwill » 2019-11-10 17:19

Using Mass Update I get below

Copying language-mass-update.js ... OK
Updating footer-extras.php to load nicEdit and language file Skipped
Table 'contactform' has 1 commands
Generating /homepages/5/d106639433/htdocs/budgetapp/hooks/ajax-mass-update-contactform-category-3c3iee354et9wuscgv3r.php OK
File contactform-tv.js already exists, so we're updating it OK
Generating code in contactform_batch_actions function OK

But when I go to my contactform table it does not load anymore, instead I get following error message:
*************
Parse error: syntax error, unexpected '<', expecting case (T_CASE) or default (T_DEFAULT) or '}' in /homepages/5/d106639433/htdocs/budgetapp/hooks/contactform.php on line 388
*************

Locally all works fine it's on on server (live site) that it does not work.
I have to upload a 'clean' contactform.php to server to have page loading work again.

The returned contactform after applying Mass Update shows:

Code: Select all

	function contactform_batch_actions(&$args) {
		/* Inserted by Mass Update on 2019-11-10 04:59:55 */
		
		/*
		 * Q: How do I return other custom batch commands not defined in mass_update plugin?
		 * 
		 * A: Define your commands ABOVE the 'Inserted by Mass Update' comment above 
		 * in an array named $custom_actions_top to display them above the commands 
		 * created by the mass_update plugin.
		 * 
		 * You can also define commands in an array named $custom_actions_bottom
		 * (also ABOVE the 'Inserted by Mass Update' comment block) to display them 
		 * below the commands created by the mass_update plugin.
		 * 
		*/

		if(!isset($custom_actions_top) || !is_array($custom_actions_top))
			$custom_actions_top = array();

		if(!isset($custom_actions_bottom) || !is_array($custom_actions_bottom))
			$custom_actions_bottom = array();

		$command = array(
			'3c3iee354et9wuscgv3r' => array(
				'title' => "Contact Category",
				'function' => 'massUpdateCommand_3c3iee354et9wuscgv3r',
				'icon' => 'asterisk'
			),
		);

		$mi = getMemberInfo();
		switch($mi['group']) {
			case 'Admins':
				return array_merge(
					$custom_actions_top,
					array(
						$command['3c3iee354et9wuscgv3r']
					),
					$custom_actions_bottom
				);
<br /> /** THIS IS LINE 388 */ 
<b>Warning</b>:  count(): Parameter must be an array or an object that implements Countable in <b>/homepages/5/d106639433/htdocs/budgetapp/plugins/mass_update/generate.php</b> on line <b>620</b><br />
		}


		/* End of Mass Update code */


		return array();
	}
Anyone else have this issue or can help?

Cheers,
Ron
Ron - Gloucestershire, UK: AppGini Pro V 23.15 Rev 1484 - LOVING IT!
Plugins: Mass Update + Search Page Maker + Summary Reports + Calendar + Messages
Bizzworxx: AppGiniHelper + Inline Detail View
Alejandro Landini: To-Do List + MPI + TV Field Editor
Other: Udemy Course

User avatar
onoehring
AppGini Super Hero
AppGini Super Hero
Posts: 1156
Joined: 2019-05-21 22:42
Location: Germany
Contact:

Re: Mass Update Error

Post by onoehring » 2019-11-19 06:41

Hi ronwill,

did you reupload ALL files (maybe with removing old files first)?

If THIS is the code you get, maybe the error occurs because the PHP error message in between?
I find the
<b>Warning</b>: count(): Parameter must be an array or an object that implements Countable in <b>/homepages/5/d106639433/htdocs/budgetapp/plugins/mass_update/generate.php</b> on line <b>620</b><br />
interesting.
Maybe check out that line 620 in generate.php. Does it try to count something that is not countable - like the error says? Maybe try to write some debug file at different positions where you expect errors. I like to use a separate log file which I include if needed:

In the file where you want to use write_log:

Code: Select all

	if(!function_exists('write_log')){    	
		include(PREPEND_PATH."hooks/write_log.php");
	}
write_log function in included hooks/write_log.php file :

Code: Select all

<?php 
	//	use: write_log("included OXYZ");		
	function write_log($log){		
		$timestamp = time();
		$datum = date("d.m.Y - H:i", $timestamp);		
		$file = 'application.log';
		$current = @file_get_contents($file);
		$current .= "\n".  $datum . " : ". $log ."\n";
		file_put_contents($file, $current);	
	}	
?>
Maybe this helps tracing the bugger.

Olaf

User avatar
ronwill
Veteran Member
Posts: 228
Joined: 2015-08-08 10:12
Location: Cheltenham UK +Weatherford USA

Re: Mass Update Error

Post by ronwill » 2019-11-21 16:39

Hi onoehring,

I've not done a log file yet but have more info on the problem:

1. Works as expected locally, issue only happens on main server/site url
2. Issue comes only after specifying what group can see 'this command' i.e. if I leave this blank, everything works. If I add Admins group or any other set-up group or combination thereof, I get the error message as reported above. Taking out any/all named groups makes it work again.
massupdate.jpg
massupdate.jpg (64.33 KiB) Viewed 4752 times
Cheers,
Ron
Ron - Gloucestershire, UK: AppGini Pro V 23.15 Rev 1484 - LOVING IT!
Plugins: Mass Update + Search Page Maker + Summary Reports + Calendar + Messages
Bizzworxx: AppGiniHelper + Inline Detail View
Alejandro Landini: To-Do List + MPI + TV Field Editor
Other: Udemy Course

User avatar
ronwill
Veteran Member
Posts: 228
Joined: 2015-08-08 10:12
Location: Cheltenham UK +Weatherford USA

Re: Mass Update Error

Post by ronwill » 2019-11-21 17:09

One more thing:

Leaving 'Groups that can see this command' blank has following effect on my project:

Guests - not an issue as they only have permissions to submit a contact form (not to edit/delete)
Members - They can call up the command and see/change the specified mass update item for their own records (as these are the only ones they see in table view. Members permissions are set to view: owner, edit/delete: No

So to me, conflict may be something to do with permission settings or the order they are presented in as the massupdate plugin ignores admin settings for the 'members' group by them being able to use the massupdate plugin to edit records according to the massupdate setting, even though the member group permissions are set to NO for edit/delete (hope that makes sense!).

As a temporary fix, to avoid the error message, I leave the massupdate ' Groups that can see this command' as blank. For my/this project it does not concern me as its just something I'm working on, however if it is a bug it may affect others/myself in the future, hence my reason for reporting it.

Cheers,
Ron
Ron - Gloucestershire, UK: AppGini Pro V 23.15 Rev 1484 - LOVING IT!
Plugins: Mass Update + Search Page Maker + Summary Reports + Calendar + Messages
Bizzworxx: AppGiniHelper + Inline Detail View
Alejandro Landini: To-Do List + MPI + TV Field Editor
Other: Udemy Course

Post Reply