Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

country type field #3644

Closed
Jimmi08 opened this issue Jan 24, 2019 · 6 comments
Closed

country type field #3644

Jimmi08 opened this issue Jan 24, 2019 · 6 comments
Labels
type: bug A problem that should not be happening
Milestone

Comments

@Jimmi08
Copy link
Contributor

Jimmi08 commented Jan 24, 2019

I have plugin with country field, but this field is not mandatory

	'team_country'            => array (  'title' => _WCOUNTRY,  'type' => 'country',  
      'data' => 'str',  'width' => 'auto',  'batch' => true,  
      'filter' => true,  'help' => '',  'readParms' =>  array (),  
      'writeParms' =>  array (),  'class' => 'left',  
      'thclass' => 'left',),

Edit mode is OK:
image

But edit mode, if country is not selected
image

I suppose I missed something in field array. Thanks for help.

@Moc Moc added the type: bug A problem that should not be happening label Jan 26, 2019
@Moc Moc added this to the e107 2.2.0 milestone Jan 26, 2019
@Moc Moc added status: testing required Someone needs to confirm this issue's existence and write a test to prevent the fix from regressing. and removed type: bug A problem that should not be happening labels Jan 27, 2019
@Moc Moc removed this from the e107 2.2.0 milestone Jan 27, 2019
@Moc
Copy link
Member

Moc commented Jan 27, 2019

@Jimmi08 what happens when you leave readParms and writeParms empty?

@Jimmi08
Copy link
Contributor Author

Jimmi08 commented Jan 27, 2019

php 7.1

'team_country'            => array (  'title' => _WCOUNTRY,  'type' => 'country',  
      'data' => 'str',  'width' => 'auto',  'batch' => true,  
      'filter' => true,  'help' => '',     'class' => 'left',  
      'thclass' => 'left',),

the same result

tried: 'writeParms' => array ('default'=>''),

@SimSync
Copy link
Contributor

SimSync commented Jan 30, 2019

This is how we did it in th vstore plugin:

'cust_country' => array ( 'title' => 'Country', 'tab' => 0, 'type' => 'method', 'data' => 'str', 'width' => 'auto', 'help' => '', 'readParms' => '', 'writeParms' => '', 'class' => 'center', 'thclass' => 'center', ),

And that is the method that is used to fill the country select and to display the countryname in the list instead of the country iso code:

function cust_country($curVal,$mode)
	{
		$frm = e107::getForm();		
		 		
		switch($mode)
		{
			case 'read': // List Page
				return  $this->getCountry($curVal);
			break;
			
			case 'write': // Edit Page
				return $frm->country('cust_country', $curVal);
			break;
			
			case 'filter':
			case 'batch':
				return  null;
			break;
		}

@Jimmi08 Jimmi08 closed this as completed Jan 30, 2019
@CaMer0n
Copy link
Member

CaMer0n commented Jan 31, 2019

Normally a custom method should no longer be required since type='country' was introduced.

@Moc Moc reopened this Jan 31, 2019
@Moc
Copy link
Member

Moc commented Jan 31, 2019

So, then there apparently is an issue with type='country' returning array in read mode.

@Moc Moc added type: bug A problem that should not be happening and removed status: testing required Someone needs to confirm this issue's existence and write a test to prevent the fix from regressing. labels Jan 31, 2019
@Moc Moc added this to the e107 2.2.0 milestone Jan 31, 2019
@CaMer0n
Copy link
Member

CaMer0n commented Jan 31, 2019

Fixed. getCountry() needed some tweaking.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
type: bug A problem that should not be happening
Projects
None yet
Development

No branches or pull requests

4 participants