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

Feature/transportpulje form #8

Merged
merged 94 commits into from
Jan 8, 2018
Merged

Conversation

martinyde
Copy link
Contributor

No description provided.

'status' => 1,
'theme' => 'ulf_viborg',
'weight' => 0,
),
Copy link
Contributor

Choose a reason for hiding this comment

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

Why have this footer been removed ?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Should not be part of block features as it never reverts correctly

@@ -169,6 +169,19 @@ function secure_permissions_data_secure_permissions($role) {
'view user map',
'schedule publishing of nodes',
'view scheduled content',
'administer custom settings',
),

Copy link
Contributor

Choose a reason for hiding this comment

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

Why this empty line. It's not between the other roles in this array.

#transportpulje-form-add-application > div {
width: 100%;
display: -webkit-flex; /* Safari */
-webkit-flex-wrap: wrap; /* Safari 6.1+ */
Copy link
Contributor

Choose a reason for hiding this comment

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

Please remove the old safari lines. Stats says that it's less than 0,5 precent.

@@ -0,0 +1,133 @@
#transportpulje-form-add-application > div {
Copy link
Contributor

Choose a reason for hiding this comment

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

The file should be named transportpulje_form.css so it's easy to figure out where it's coming from in the theme layer,

@@ -0,0 +1,47 @@
/**
Copy link
Contributor

Choose a reason for hiding this comment

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

Would be nice to have a better name for the JS files. Eg. transportpulje-course-form-alter.js to is would be easier to see where this comes from when debugging the site.

unset($form_state['values']['distance_calc_failed']);

foreach ($form_state['values'] as $key => $value) {
if(empty($value) && $value != '0') {
Copy link
Contributor

Choose a reason for hiding this comment

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

Empty => A variable is considered empty if it does not exist or if its value equals FALSE

0 is the same an FALSE or is this a string with '0' in ?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

I'm looking for sting '0'

/**
* Validate expenses for numeric.
*
* @param $form_state
Copy link
Contributor

Choose a reason for hiding this comment

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

Missing parameter description!

/**
* Validate email fields / Email repeat check.
*
* @param $form_state
Copy link
Contributor

Choose a reason for hiding this comment

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

Missing parameter description!

/**
* Validate email fields / Email repeat check.
*
* @param $form_state
Copy link
Contributor

Choose a reason for hiding this comment

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

Missing parameter description!

* @return bool
*/
function _tpf_validate_email_address($form_state) {
return(filter_var($form_state['values']['email'], FILTER_VALIDATE_EMAIL)) ? FALSE : TRUE;
Copy link
Contributor

Choose a reason for hiding this comment

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

Could be rewritten:

return filter_var($form_state['values']['email'], FILTER_VALIDATE_EMAIL);

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Wont fix

Copy link
Contributor

Choose a reason for hiding this comment

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

Why the statement is just extra code thats not needed?

@@ -216,6 +216,9 @@ function ulf_default_preprocess_node(&$variables) {
$variables['profile_postal_code'] = $account->location['postal_code'];
$variables['profile_city'] = $account->location['city'];
}

// Transport application form
$variables['transport_form'] = module_exists('transportpulje_form') ? TRUE : FALSE;
Copy link
Contributor

Choose a reason for hiding this comment

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

Could be re-written:

$variables['transport_form'] = module_exists('transportpulje_form');

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Fixed

'description' => t('Access administration tasks for customized settings.'),
),
);
}
Copy link
Contributor

Choose a reason for hiding this comment

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

Missing newline!

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Fixed

if ('tpf_school' === $form_values['institution_type'] && 'grade_6' <= $form_values['institution_grade']) {
$distance = _tpf_get_distance($form_values);

if (is_array($distance) && array_key_exists('scalar', $distance)) {
Copy link
Contributor

Choose a reason for hiding this comment

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

Could be re-written to:

if (isset($distance['scalar']))

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Wont fix

$distance = _tpf_get_distance($form_values);

if (is_array($distance) && array_key_exists('scalar', $distance)) {
if (6 >= $distance['scalar']) {
Copy link
Contributor

Choose a reason for hiding this comment

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

Drupal do not use yoda notation!

Copy link
Contributor Author

@martinyde martinyde Jan 5, 2018

Choose a reason for hiding this comment

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

Wont' fix! All Hail Yoda!

// Get the institutions address/location.
$tpf_institution = taxonomy_term_load($form_values['institution_name']);
$tpf_from = field_get_items('taxonomy_term', $tpf_institution, 'field_field_tpf_geo_location');
$pos_from = empty($tpf_from[0]) ? NULL : array('lat' => $tpf_from[0]['latitude'], 'lon' => $tpf_from[0]['longitude']);
Copy link
Contributor

Choose a reason for hiding this comment

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

Array should be multiline

* True if input is not an integer.
*/
function _tpf_validate_participants(array $form_state) {
return(filter_var($form_state['values']['participants'], FILTER_VALIDATE_INT)) ? FALSE : TRUE;
Copy link
Contributor

Choose a reason for hiding this comment

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

Could be re-written:

return filter_var($form_state['values']['participants'], FILTER_VALIDATE_INT);

Copy link
Contributor Author

Choose a reason for hiding this comment

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

I'm retuning the reverse

Copy link
Contributor

Choose a reason for hiding this comment

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

The return !res

function _tpf_modify_course_dropdown(array $courses) {
// Cache the dropdown list.
if (!isset($courses)) {
if ($cache = cache_get('tpf_dropdown_data')) {
Copy link
Contributor

Choose a reason for hiding this comment

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

You need to check if the cache has exipred.

if ($cache = cache_get('tpf_dropdown_data') && REQUEST_TIME < $cache->expire)

->condition('bundle', 'course')
->condition('entity_id', array_keys($courses['course']), 'IN')
->execute();
foreach ($results as $result) {
Copy link
Contributor

Choose a reason for hiding this comment

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

Would like an empty line before foreach.

$form_state['values']['course_dropdown'];

// Set address from either selected node or user provided values.
$form_address = 'ERROR - NO VALID ADDRESS FOUND';
Copy link
Contributor

Choose a reason for hiding this comment

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

Should this be translatable!

* @return bool
* True if course is selected and street, postal code and city vary from node.
*/
function _tpf_address_variation(array $values) {
Copy link
Contributor

Choose a reason for hiding this comment

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

Maybe use an $ret = FALSE and change it to TRUE and return $ret;

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Fixed

@cableman cableman self-requested a review January 4, 2018 13:23
@martinyde martinyde merged commit 1782f32 into development Jan 8, 2018
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.

3 participants