%name:Validations checks%
%version:v13.0.0.2d%
06 Apr 2022
%wikipage:Validations_checks%
========================================
Folder name is validations_checks_2
========================================
%description:
Ce Mod ajoute une colonne "Vérifié" à la liste des problèmes décelés par une des interrogations des "validation de données".
La table des vérifications effectuées (tng_validations_checks) est créée automatiquement à la première utilisation.
This mod adds a column "Checked" to the list of the encountered problems find by one of the "data validation" queries.
The checks done table (tng_validations_checks) is automatically created when using the mod for the first time.
Written by Michel Kirsch from Charleroi-Hainaut-Belgium:https://tng.lythgoes.net/wiki/index.php?title=User:MichelKirsch%
List of modifications
======================
V12.2.0.1 : 09 dec 2019 - original version
1a : 09 dec 2019 modify line 45 ($result = tng_query(...) in $monresult= tng_query(...) because warning raised in line. $result yet used by tng
2 : 04 jan 2020 report checked lines to the end of the table with array - Use array_unshift to integrate $values and $display (location#2) - creating icon tng_uncheck.gif
2a : 05 jan 2020 Fix a warning because array is empty
2b : 06 jan 2020 Now stay on the working page of the list - Adding validations_checks.php in $extspath
2c : 29 feb 2020 Add title to icon (checked - not checked)
2d : 06 apr 2022 Modify the test to create or not the table for PHP 8.1 (line 172 and next)
================================================================
=================== copy file ======================
================================================================
//copier tng_uncheck.gif vers img
%copyfile2:validations_checks_2/tng_uncheck.gif:img/tng_uncheck.gif%
//copier validations_checks.php.php
%copyfile2:validations_checks_2/validations_checks.php:$extspath/validations_checks.php%
================================================================
=================== Begin modifying files ======================
================================================================
================== admin_valreport.php ====================
%target:admin_valreport.php%
========================== location #1-1 ====================
%location:%
$newoffset = "$offset, ";
%end:%
%insert:after%
$tngpage = ((int)$offset / 50) + 1; //Added for Mod MichelKirsch Validations Checks
%end:%
========================== location #1-2 ====================
%location:%
$tngpage = 1;
%end:%
%insert:after%
$offset = 0; //Added for Mod MichelKirsch Validations Checks
%end:%
========================== location #2 ====================
%location:%
for($i = 0; $i < count($display); $i++) {
$header = $admtext[$display[$i]];
%end:%
%insert:before%
// ********** BEGIN MOD MichelKirsch validations check Location #2 ***********
array_unshift($display,"status");
array_unshift($values,"checkbutton");
// ********** END MOD MichelKirsch validations check Location #2 ***********
%end:%
========================== location #3 ====================
%location:%
echo "\n";
%end:%
%replace:%
/******************************************************
BEGIN MOD MichelKirsch validations check Location #3
******************************************************/
// check status and construct URL/icon
check_create_table();
$MySQL = "SELECT * FROM $val_checks_table WHERE personID = '{$row['personID']}' AND familyID = '{$row['familyID']}' AND tree = '{$row['gedcom']}' AND report = '$report'";
$myresult = tng_query($MySQL);
if (tng_num_rows($myresult) > 0)
{$checksign = '';
$hide_this_line = true;
}else{
$checksign = '';
$hide_this_line = false;
echo "
\n";
}
$line_to_report = "
\n";
/******************************************************
END MOD MichelKirsch validations check Location #3
******************************************************/
%end:%
========================== location #4 ====================
%location:%
else
$value = $row[$values[$i]];
%end:%
%insert:before%
/******************************************************
BEGIN MOD MichelKirsch validations check Location #4
******************************************************/
elseif($values[$i] == "checkbutton")
$value = $checksign;
/******************************************************
END MOD MichelKirsch validations check Location #4
******************************************************/
%end:%
========================== location #5 ====================
%location:%
echo " {$value} | \n";
%end:%
%insert:before%
/******************************************************
BEGIN MOD MichelKirsch validations check Location #5
******************************************************/
if ($hide_this_line)
$line_to_report .= " {$value} | \n";
else
/******************************************************
END MOD MichelKirsch validations check Location #5
******************************************************/
%end:%
========================== location #6 ====================
%location:%
echo "
\n";
}
%end:%
%insert:before%
/******************************************************
BEGIN MOD MichelKirsch validations check Location #6
******************************************************/
if($line_to_report != "\n")
$lines_to_report_at_end[] = $line_to_report . "
\n";
/******************************************************
END MOD MichelKirsch validations check Location #6
******************************************************/
%end:%
========================== location #7 ====================
%location:%
echo "\n";
%end:%
%insert:before%
/******************************************************
BEGIN MOD MichelKirsch validations check Location #7
******************************************************/
if(isset($lines_to_report_at_end))
{ foreach ($lines_to_report_at_end as $ligne) {
echo $ligne; }
}
/******************************************************
END MOD MichelKirsch validations check Location #7
******************************************************/
%end:%
========================== location #8 ====================
%location:%
echo tng_adminfooter();
%end:%
%insert:before%
/***********************************************************
BEGIN MOD MichelKirsch validations check Location #8
***********************************************************/
// Check if table exists. If not, create it
function check_create_table()
{ global $val_checks_table, $link;
$error = 0;
$mysql = "SHOW TABLES LIKE '$val_checks_table'";
$result = mysqli_query($link,$mysql);
if(mysqli_num_rows($result) == 0){
$MySQL = "CREATE TABLE $val_checks_table (
`personID` varchar(22) DEFAULT '',
`familyID` varchar(22) DEFAULT '',
`tree` varchar(20) NOT NULL,
`report` varchar(25) NOT NULL
)";
$result = mysqli_query($link,$MySQL);
}
}
/***********************************************************
END MOD MichelKirsch validations check Location #8
***********************************************************/
%end:%
================== customconfig.php ====================
%target:customconfig.php%
%location:%