OCS - Custom data field for authors [SOLVED]

I need authors to inform their CPF (brazilian personal identification number) at paper registration, so we can certificate their presentation after the conference. I changed a field I didn’t need at the user registration/profile form to have “CPF” as its label. However, I noticed co-authors don’t need to be registered as users, so this solution didn’t work for the last conference.

With this, I ask your help about the best way to proceed. How to add a custom data field to authors in OCS? I may need to add other custom fields (e.g. identification of the advisor, which is mandatory in a specific conference).

I read about how to add custom field in this post Add new field to registration form - #3 by amirhosein, but it applies to users only.

Hi @Guilherme_Passero,

As you’ve noticed, author and user records are kept separately. To add this requirement to the author forms, check out classes/author/form/submit/AuthorSubmitStep3Form.inc.php (and the associated templates/author/submit/step3.tpl template). Changes here will be roughly equivalent to the ones you’ve already made to the user registration form code. (You’ll also need to make sure the back-end storage incorporates the new field – the equivalents here are AuthorDAO.inc.php to UserDAO.inc.php and Author.inc.php to User.inc.php.)

Regards,
Alec Smecher
Public Knowledge Project Team

Even with this hard work for custom changes, OCS and OJS are great! We’d need a lot of time and effort to develop a similar system.

Thanks for the guidance.

Hi @Guilherme_Passero,

Thanks, and we’re glad to hear it! We’re still considering the future of OCS (and note that the timeline suggested there is no longer realistic), and I’d be curious to know whether you considered other systems, and what the critical features were that led you to choose OCS. We’d like to make sure we tackle any future work on OCS sustainably; there are so many conference systems out there and we want to provide something sufficiently unique.

Regards,
Alec Smecher
Public Knowledge Project Team

Probably the most critical feature about OCS is that it is derived from OJS, which is used by us and many other brazilian educational institutes. However, I couldn’t find which systems our closest institutions are using for conferences management (I think OCS is not as popular as OJS in Brazil).
I found some other conference management systems, but most were paid. Because of the popularity of OJS “brother” and the fact that OCS is opensource, we decided to use OCS.

Also, a brazilian public institution relaunched OCS in Brazil under the “SOAC” name (abrev for Eletronic Conference Management System in Portuguese), the same which launched OJS here under “SEER” name. The existing portuguese translation of this system was also a critical feature for us.
http://www.ibict.br/pesquisa-desenvolvimento-tecnologico-e-inovacao/sistema-eletronico-de-adminstracao-de-conferencias(soac)

Hi @Guilherme_Passero,

Thanks, that’s a helpful answer!

Regards,
Alec Smecher
Public Knowledge Project Team

I added two fields to step3.tpl: nationality and document (CPF for brazilian, passaport for foreigners).
I added these lines to AuthorSubmitStep3Form:

		$this->addCheck(new FormValidatorArray($this, 'authors', 'required', 'author.submit.form.documentRequired', array('document')));
		$this->addCheck(new FormValidatorArrayCustom($this, 'authors', 'required', 'author.submit.form.cpfInvalid', 'validateCPF', array(), false, array('document')));

...

function initData() {
...

						'nationality' => $authors[$i]->getData('nationality'),
						'document' => $authors[$i]->getData('document')
...

function execute() {
...

				$author->setData('nationality', $authors[$i]['nationality']);
				$author->setData('document', $authors[$i]['document']);	

I want to validate the document number only when the author is brazilian. Do you know how can I do it?

Also, I added this to AuthorDAO.inc.php:

	function getAdditionalFieldNames() {
		return array('document', 'nationality');
	}

I can see the data persisted at paper_author_settings table. It seems to have worked! The only problem now is with CPF validation.

What is the best way to manually navigate through form data and add custom validation errors?

I solved the problem with validating CPF only for brazilians with a custom function:

function validateAuthorsCPF($authors) {
	foreach ($authors as $author) {
		if (!$author['nationality']) {;
			if (!validateCPF($author['document'])) {
				return false;
			}
		}
	}
	return true;
}
...
$this->addCheck(new FormValidatorCustom($this, 'authors', 'required', 'author.submit.form.cpfInvalid', 'validateAuthorsCPF'));

Hi Guillerme! did you include your last custom function in AuthorDAO.inc.php or in AuthorSubmitStep3Form ? I can not see how do you check that the author is brazilian or not.

Hey Aldo,

I added the ‘nationality’ field to the submission form (also to the account creation form). The values for this field are ‘0’ for brazilian and ‘1’ for foreigner. So testing !$author[‘nationality’] ensures that validateCPF is executed only for Brazillians (‘0’ == false in PHP) (see code in previous post).