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

OParl: Add a links to originator in paper object. #161

Open
wants to merge 2 commits into
base: main
Choose a base branch
from

Conversation

darkdragon-001
Copy link
Contributor

I don't know how to test this, but it should work something like this.

Fixes #160

@darkdragon-001 darkdragon-001 changed the title OParl: Add a link to people in paper object. OParl: Add a links to originator in paper object. Sep 20, 2022
];

foreach ($antrag->antraegePersonen as $ap) {
if ($ap->typ == AntragPerson::$TYP_GESTELLT_VON) {
$organization = Gremium::model()->findByName($ap->person->name);
Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Does a findByName() method exist in the model?

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

No that might be rather ->findByAttributes(["name" => ...]). Though sure you want to find a "Gremium" by a person's name? Which information (in the UI) do you actually want to retrieve?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

In the UI (e.g. here) the field "Gestellt von" which seems to be rendered by

zeile_anzeigen($personen[AntragPerson::$TYP_GESTELLT_VON], "Gestellt von:", "gestellt_von", function ($person) use ($antrag) {
/** @var Person $person */
if ($person->stadtraetIn) {
echo CHtml::link($person->stadtraetIn->name, $person->stadtraetIn->getLink());
echo " (" . CHtml::encode($person->ratePartei($antrag->gestellt_am)) . ")";
} else {
echo CHtml::encode($person->name);
}
});

If you could fix the data model / parser, this would of course be preferable.

$data['originatorOrganization'][] = OParl10Controller::getOparlObjectUrl('organization', $organization->id)
}
} else if ($ap->typ == AntragPerson::$TYP_INITIATORIN) {
$data['originatorPerson'][] = OParl10Controller::getOparlObjectUrl('person', $ap->person->id)
Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Is $ap->person-id the right property or do we want to use $ap->person->stadtraetIn->id?

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The latter is probably more relevant, as that is the ID used by the original RIS (the number in the URL https://www.muenchen-transparent.de/personen/5963817_Andreas+Schuster)

if ($ap->typ == AntragPerson::$TYP_GESTELLT_VON) {
$organization = Gremium::model()->findByName($ap->person->name);
if ($organization) {
$data['originatorOrganization'][] = OParl10Controller::getOparlObjectUrl('organization', $organization->id)
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Mind the trailing semicolon at the end of the line is (unfortunately) not optional here

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@CatoTH Also I missed the necessary sub-id fraktion for organizations.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

OParl: originatorPerson and originatorOrganization missing for Paper
2 participants