summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorfisharebest <fisharebest@gmail.com>2011-10-22 21:58:33 +0000
committerfisharebest <fisharebest@gmail.com>2011-10-22 21:58:33 +0000
commit61d72c051041c9a7f97a3629cc11eb3378ada15c (patch)
tree37b254206f2dccea3f5a6e1fb76a0eb2a5786aa6
parentc08abedc42a7ce924b1bbad50bc5f801ff4e44e5 (diff)
downloadwebtrees-61d72c051041c9a7f97a3629cc11eb3378ada15c.tar.gz
webtrees-61d72c051041c9a7f97a3629cc11eb3378ada15c.tar.bz2
webtrees-61d72c051041c9a7f97a3629cc11eb3378ada15c.zip
#816949 - occurence of a DEAT, BIRT or CHR event with only a note attached
-rw-r--r--edit_interface.php13
-rw-r--r--includes/functions/functions_edit.php20
2 files changed, 21 insertions, 12 deletions
diff --git a/edit_interface.php b/edit_interface.php
index 4355519813..4ff9926567 100644
--- a/edit_interface.php
+++ b/edit_interface.php
@@ -1168,9 +1168,16 @@ case 'update':
$tmp=new WT_GedcomRecord($gedrec);
list($gedrec, $private_gedrec)=$tmp->privatizeGedcom(WT_USER_ACCESS_LEVEL);
- // add or remove Y
- if ($text[0]=="Y" or $text[0]=="y") $text[0]="";
- if (in_array($tag[0], $emptyfacts) && array_unique($text)==array("") && !$islink[0]) $text[0]="Y";
+ // If the fact has a DATE or PLAC, then delete any value of Y
+ if ($text[0]=='Y') {
+ for ($n=1; $n<count($tag); ++$n) {
+ if ($glevels[$n]==2 && ($tag[$n]=='DATE' || $tag[$n]=='PLAC') && $text[$n]) {
+ $text[0]='';
+ break;
+ }
+ }
+ }
+
//-- check for photo update
if (count($_FILES)>0) {
if (isset($_REQUEST['folder'])) $folder = $_REQUEST['folder'];
diff --git a/includes/functions/functions_edit.php b/includes/functions/functions_edit.php
index 7d25c1d5ef..f454a16d5f 100644
--- a/includes/functions/functions_edit.php
+++ b/includes/functions/functions_edit.php
@@ -1471,15 +1471,13 @@ function add_simple_tag($tag, $upperlevel='', $label='', $readOnly='', $noClose=
}
}
- if (in_array($fact, $emptyfacts)&& (empty($value) || $value=="y" || $value=="Y")) {
- $value = strtoupper($value);
- //-- don't default anything to Y when adding events through people
- //-- default to Y when specifically adding one of these events
- if ($level==1) $value="Y"; // default YES
+ if (in_array($fact, $emptyfacts) && ($value=='' || $value=='Y' || $value=='y')) {
echo "<input type=\"hidden\" id=\"", $element_id, "\" name=\"", $element_name, "\" value=\"", $value, "\" />";
if ($level<=1) {
- echo "<input type=\"checkbox\" ";
- if ($value=="Y") echo " checked=\"checked\"";
+ echo '<input type="checkbox" ';
+ if ($value) {
+ echo ' checked="checked"';
+ }
echo " onclick=\"if (this.checked) ", $element_id, ".value='Y'; else ", $element_id, ".value=''; \" />";
echo WT_I18N::translate('yes');
}
@@ -2289,7 +2287,7 @@ function unlinkMedia($linktoid, $linenum, $mediaid, $level=1, $chan=true) {
* @param string $fact the new fact we are adding
*/
function create_add_form($fact) {
- global $tags, $FULL_SOURCES;
+ global $tags, $FULL_SOURCES, $emptyfacts;
$tags = array();
@@ -2314,7 +2312,11 @@ function create_add_form($fact) {
if (in_array($fact, array('ASSO'))) {
$fact.=' @';
}
- add_simple_tag("1 ".$fact);
+ if (in_array($fact, $emptyfacts)) {
+ add_simple_tag('1 '.$fact.' Y');
+ } else {
+ add_simple_tag('1 '.$fact);
+ }
insert_missing_subtags($tags[0]);
//-- handle the special SOURce case for level 1 sources [ 1759246 ]
if ($fact=="SOUR") {