Overview
Comment:Allow to have a NULL country for a user if the country is not mandatory
Downloads: Tarball | ZIP archive | SQL archive
Timelines: family | ancestors | descendants | both | trunk | stable
Files: files | file ages | folders
SHA3-256: ef6f1b6923f907380a44e471356ab16e2ea23e4482200094a305a83c16881a95
User & Date: bohwaz on 2023-03-19 18:48:58
Other Links: manifest | tags
Context
2023-03-19
19:09
Fix ledger link check-in: 37a0b264fe user: bohwaz tags: trunk, stable
18:48
Allow to have a NULL country for a user if the country is not mandatory check-in: ef6f1b6923 user: bohwaz tags: trunk, stable
2023-03-18
18:07
Remove links to account journal from projects views check-in: a31ffe9268 user: bohwaz tags: trunk, stable
Changes

Modified src/include/lib/Garradin/Template.php from [58ed6f9fb3] to [e6a08fd537].

799
800
801
802
803
804
805
806
807
808
809
810
811
812
813
814
			}

			$options = (array) $config->options;
		}
		elseif ($type == 'country')
		{
			$type = 'select';
			$options = Utils::getCountryList();
			$params['default'] = Config::getInstance()->get('pays');
		}
		elseif ($type == 'date')
		{
			$params['pattern'] = '\d{4}-\d{2}-\d{2}';
		}

		$field = '';







|
|







799
800
801
802
803
804
805
806
807
808
809
810
811
812
813
814
			}

			$options = (array) $config->options;
		}
		elseif ($type == 'country')
		{
			$type = 'select';
			$options = [null => '— Non renseigné —'] + Utils::getCountryList();
			$params['default'] ??= Config::getInstance()->get('pays');
		}
		elseif ($type == 'date')
		{
			$params['pattern'] = '\d{4}-\d{2}-\d{2}';
		}

		$field = '';
847
848
849
850
851
852
853
854
855
856
857
858
859
860
861
			foreach ($options as $k=>$v)
			{
				if (is_int($k))
					$k = $v;

				$field .= '<option value="' . htmlspecialchars($k, ENT_QUOTES, 'UTF-8') . '"';

				if ($value == $k || empty($value) && !empty($params['default']))
					$field .= ' selected="selected"';

				$field .= '>' . htmlspecialchars($v, ENT_QUOTES, 'UTF-8') . '</option>';
			}
			$field .= '</select>';
		}
		elseif ($type == 'multiple')







|







847
848
849
850
851
852
853
854
855
856
857
858
859
860
861
			foreach ($options as $k=>$v)
			{
				if (is_int($k))
					$k = $v;

				$field .= '<option value="' . htmlspecialchars($k, ENT_QUOTES, 'UTF-8') . '"';

				if ($value === $k || (empty($value) && !empty($params['default']) && $params['default'] === $value))
					$field .= ' selected="selected"';

				$field .= '>' . htmlspecialchars($v, ENT_QUOTES, 'UTF-8') . '</option>';
			}
			$field .= '</select>';
		}
		elseif ($type == 'multiple')