CustomerID als Auswahlfeld?

Hilfe zu Znuny Problemen aller Art
Locked
Nexter
Znuny newbie
Posts: 60
Joined: 19 Jan 2011, 17:23
Znuny Version: 3.2.8

CustomerID als Auswahlfeld?

Post by Nexter »

Hallo Leute,

ich hab grad wieder ein Verständnisproblem:

Ich hab in der Config.pm 2 Backends angebunden
- CustomerUser1
- CustomerCompany

Das sieht dann so aus:

Code: Select all

# ------------------------------------------------------------------------------------------------------------ #
	# ----------------------------------- eigenes AccountBackend anbinden ---------------------------------------- #	
	# ------------------------------------------------------------------------------------------------------------ #

	# CustomerUser (Accountdatenbank & Einstellungen)
	$Self->{CustomerUser1} = {
		Name => 'Accountdaten',
		Module => 'Kernel::System::CustomerUser::DB',
		Params => {
			# MySQL Tabelle
			Table => 'com_customers',
			# Wenn hier auf 1 gestellt wird, wird die Performance auf großen DBs schlechter.
			CaseSensitive => 0,
		},
		# Eindeutige Kunden-Identifizierer
		CustomerKey => 'cust_login',

		# Einstellungen #
		CustomerID => 'cust_id',
		CustomerValid => 'valid_id',
		CustomerUserListFields => ['cust_first_name', 'cust_last_name', 'cust_email'],
		CustomerUserSearchFields => ['cust_login', 'cust_last_name', 'cust_id'],
		CustomerUserSearchPrefix => '',
		CustomerUserSearchSuffix => '*',
		CustomerUserSearchListLimit => 250,
		CustomerUserPostMasterSearchFields => ['cust_email'],
		CustomerUserNameFields => ['cust_title','cust_first_name','cust_last_name'],
		CustomerUserEmailUniqCheck => 1,
		# show not own tickets in customer panel, CompanyTickets
		# CustomerUserExcludePrimaryCustomerID => 0,
		# Automatische Logins erzeugen
		# AutoLoginCreation => 0,
		# AutoLoginCreationPrefix => 'auto',
		# Admin kann Benutzereinstellungen ändern
		# AdminSetPreferences => 1,
		# cache time to live in sec. - cache any database queries
		# CacheTTL => 0,
		# Definiert die Quelle als Readonly (Können also keine neuen User angelegt werden)
		# ReadOnly => 1,
		# ------------------------------------------------- Feldmapping ------------------------------------------------- #
		Map => [
			# Info: Login, Email & ID sind zwingend benötigt!
			# Parameter shown (1=always, 2=lite)
			# var,					frontend,		storage,		shown,	required,	storage-type,	http-link,	readonly,	http-link-target
			[ 'UserTitle',			'Title',		'cust_title',		1,		0,			'var',			'',			0 ],
			[ 'UserFirstname',		'Firstname',	'cust_first_name',	1,		1,			'var',			'',			0 ],
			[ 'UserLastname',		'Lastname',		'cust_last_name',	1,		1,			'var',			'',			0 ],
			[ 'UserLogin',			'Username',		'cust_login',		1,		1,			'var',			'',			0 ],
			[ 'UserPassword',		'Password',		'cust_pw',			0,		0,			'var',			'',			0 ],
			[ 'UserEmail',			'Email',		'cust_email',		1,		1,			'var',			'$Env{"CGIHandle"}?Action=AgentTicketCompose&ResponseID=1&TicketID=$Data{"TicketID"}&ArticleID=$Data{"ArticleID"}',	0 ],
			[ 'UserCustomerID',		'CustomerID',	'cust_id',			0,		1,			'var',			'',			0 ],
		    [ 'UserCustomerIDs',	'CustomerIDs',	'cust_ids',			1,		0,			'var',			'',			0 ],
			[ 'BranchID',			'BranchID',		'cust_branch_id',	1,		0,			'int',			'',			0 ],
			[ 'Branch',				'Branch',		'cust_branch',		1,		0,			'var',			'',			0 ],
			[ 'UserPhone',			'Phone',		'cust_phone',		1,		0,			'var',			'',			0 ],
			[ 'UserFax',			'Fax',			'cust_fax',			1,		0,			'var',			'',			0 ],
			[ 'UserMobile',			'Mobile',		'cust_mobile',		1,		0,			'var',			'',			0 ],
			[ 'UserStreet',			'Street',		'cust_street',		2,		0,			'var',			'',			0 ],
			[ 'UserZip',			'Zip',			'cust_zip',			2,		0,			'var',			'',			0 ],
			[ 'UserCity',			'City',			'cust_city',		2,		0,			'var',			'',			0 ],
			[ 'UserCountry',		'Country',		'cust_country',		1,		0,			'var',			'',			0 ],
			[ 'UserComment',		'Comment',		'cust_comments',	1,		0,			'var',			'',			0 ],
			[ 'ValidID',			'Valid',		'valid_id',			1,		1,			'int',			'',			0 ]
		],
		# --------------------------------------- Standard Auswahl --------------------------------------------- #
		Selections => {
			UserTitle => {
				'Herr'	=> 'Herr',
				'Frau'  => 'Frau',
				'Dr.'   => 'Dr.',
				'Prof.' => 'Prof.'
			},
			UserCountry => {
				'Germany'		=>	'Deutschland',
				'Switzerland'	=>	'Schweiz',
				'Austria'		=>	'Österreich',
				'Poland'		=>	'Polen',
				'Spain'			=>	'Spanien',
				'Italy'			=>	'Italien',
				'France'		=>	'Frankreich'	
			},
		},
	};
	# ---------------------------------------- Ende Accountdaten Backend ----------------------------------------- #	
	
	
	
	# ------------------------------------------------------------------------------------------------------------ #
	# -------------------------------------- eigenes FirmenBackend anbinden -------------------------------------- #	
	# ------------------------------------------------------------------------------------------------------------ #

	# CustomerCompany (Firmendatenbank & Einstellungen)
	$Self->{CustomerCompany} = {
		Name => 'Firmendaten',
		Module => 'Kernel::System::CustomerCompany::DB',
		Params => {
			# MySQL Tabelle
			Table => 'com_companies',
			# Wenn hier auf 1 gestellt wird, wird die Performance auf großen DBs schlechter.
			CaseSensitive => 0,
		},
		
		# Eindeutiger Firmen-Identifizierer
		CustomerCompanyKey => 'comp_nr',

		# Einstellungen #
		CustomerCompanyID => 'comp_nr',
		CustomerCompanyValid => 'valid_id',
		CustomerCompanyListFields => ['comp_name', 'comp_nr', 'valid_id'],
		CustomerCompanySearchFields => ['comp_name', 'comp_nr', 'comp_url'],
		CustomerCompanySearchPrefix => '',
		CustomerCompanySearchSuffix => '*',
		CustomerCompanySearchListLimit => 250,

		# ------------------------------------------------- Feldmapping ------------------------------------------------- #
		Map => [
			# Parameter shown (1=always, 2=lite)
			# var,						frontend,			storage,				shown,	required,	storage-type,	http-link,	readonly,	http-link-target
			[ 'CustomerID',				'CustomerID',		'comp_id',				2,		1,			'int',			'',			0 ],
			[ 'CompanyNr',				'CompanyNr',		'comp_nr',				1,		1,			'var',			'',			0 ],
			[ 'CompanyName',			'CompanyName',		'comp_name',			1,		1,			'var',			'',			0 ],
			[ 'CompanyType',			'CompanyType',		'comp_type',			1,		1,			'var',			'',			0 ],
			[ 'CompanyAddSuff1',		'CompanyAddSuff1',	'comp_addresssuffix1',	2,		0,			'var',			'',			0 ],
			[ 'CompanyAddSuff2',		'CompanyAddSuff2',	'comp_addresssuffix2',	2,		0,			'var',			'',			0 ],
			[ 'CompanyStreet',			'Street',			'comp_street',			2,		1,			'var',			'',			0 ],
			[ 'CompanyZip',				'Zip',				'comp_zip',				2,		1,			'var',			'',			0 ],
			[ 'CompanyCity',			'City',				'comp_city',			2,		1,			'var',			'',			0 ],
			[ 'CompanyCountry',			'Country',			'comp_country',			2,		1,			'var',			'',			0 ],
			[ 'CompanyPostBox',			'PostBox',			'comp_postbox',			2,		0,			'var',			'',			0 ],
			[ 'CompanyPhone',			'Phone',			'comp_tel',				1,		1,			'var',			'',			0 ],
			[ 'CompanyFax',				'Fax',				'comp_fax',				2,		0,			'var',			'',			0 ],
			[ 'CompanyMail',			'EMail',			'comp_email',			1,		1,			'var',			'',			0 ],
			[ 'CompanyReferenz',		'CompanyReferenz',	'comp_referenz',		2,		0,			'var',			'',			0 ],
			[ 'CompanyComment',			'Comment',			'comp_comments',		2,		0,			'var',			'',			0 ],
			[ 'CompanyURL',				'URL',				'comp_url',				2,		0,			'var',			'',			0 ],
			[ 'ValidID',				'Valid',			'valid_id',				1,		1,			'int',			'',			0 ]
		],
		# --------------------------------------- Standard Auswahl --------------------------------------------- #
		Selections => {
			CompanyType => {
				'K'	=>	'Kunde (Endkunde)',
				'P'	=>	'Partner',
				'I'	=>	'Intern'	
			},
			CompanyCountry => {
				'Germany'		=>	'Deutschland',
				'Switzerland'	=>	'Schweiz',
				'Austria'		=>	'Österreich',
				'Poland'		=>	'Polen',
				'Spain'			=>	'Spanien',
				'Italy'			=>	'Italien',
				'France'		=>	'Frankreich'	
			},
		},
		
	};
	# ---------------------------------------- Ende Firmendaten Backend ----------------------------------------- #	
Nun muss ich leider immer wenn ich eine Firma anlege einen User haben und dessen ID wissen (Ist im Usermenü nicht sichtbar, so gewollt)

1. Kann ich auch FIrmen ohne Userzuweisung anlegen? Denn ich habe längst nicht für jeden unserer Kunden einen Kontakt so prompt parat.

2. Könnte ich auch eine Selection "zaubern" um die User in einem Feld anzuzeigen und dann die richtige ID zu holen und automatisch einzutragen?

danke
--- Grüße vom Nexter ---
wurzel
Znuny guru
Posts: 3273
Joined: 08 Jul 2010, 22:25
Znuny Version: x.x.x
Real Name: Florian

Re: CustomerID als Auswahlfeld?

Post by wurzel »

Hi,

ich arbeite mit einer "_Dummy Company" fuer solche Faelle. Aber ob das richtig ist weiß ich nicht.

Flo
OTRS 2025 SILVER (Prod)
OTRS 2025 auf Debian 12 (Test)
Znuny 7.x latest version testing auf Debian 12

-- Ich beantworte keine Forums-Fragen PN - No PN please

I won't answer to unfriendly users any more. A greeting and regards are just polite.
Locked