Phrases: Prevent empty Structure entry from being created on save.

This commit is contained in:
Nate Jones 2015-02-25 23:38:20 +00:00
parent 571a0cd2d8
commit f734a88530
2 changed files with 73 additions and 69 deletions

View File

@ -70,10 +70,10 @@
$text['label-function']['pt-pt'] = "Função"; $text['label-function']['pt-pt'] = "Função";
$text['label-function']['fr-fr'] = "Fonction"; $text['label-function']['fr-fr'] = "Fonction";
$text['label-file']['en-us'] = "File"; $text['label-action']['en-us'] = "Action";
$text['label-file']['es-cl'] = "Expediente"; $text['label-action']['es-cl'] = "Acción";
$text['label-file']['pt-pt'] = "Arquivo"; $text['label-action']['pt-pt'] = "Ação";
$text['label-file']['fr-fr'] = "Fichier"; $text['label-action']['fr-fr'] = "Action";
$text['label-order']['en-us'] = "Order"; $text['label-order']['en-us'] = "Order";
$text['label-order']['es-cl'] = "Orden"; $text['label-order']['es-cl'] = "Orden";

View File

@ -116,38 +116,40 @@ if (count($_POST) > 0 && strlen($_POST["persistformvar"]) == 0) {
$_POST['phrase_detail_tag'] = 'action'; // default, for now $_POST['phrase_detail_tag'] = 'action'; // default, for now
$_POST['phrase_detail_group'] = "0"; // one group, for now $_POST['phrase_detail_group'] = "0"; // one group, for now
$phrase_detail_uuid = uuid(); if ($_POST['phrase_detail_data'] != '') {
$sql = "insert into v_phrase_details "; $phrase_detail_uuid = uuid();
$sql .= "( "; $sql = "insert into v_phrase_details ";
$sql .= "phrase_detail_uuid, "; $sql .= "( ";
$sql .= "phrase_uuid, "; $sql .= "phrase_detail_uuid, ";
$sql .= "domain_uuid, "; $sql .= "phrase_uuid, ";
$sql .= "phrase_detail_order, "; $sql .= "domain_uuid, ";
$sql .= "phrase_detail_tag, "; $sql .= "phrase_detail_order, ";
$sql .= "phrase_detail_pattern, "; $sql .= "phrase_detail_tag, ";
$sql .= "phrase_detail_function, "; $sql .= "phrase_detail_pattern, ";
$sql .= "phrase_detail_data, "; $sql .= "phrase_detail_function, ";
$sql .= "phrase_detail_method, "; $sql .= "phrase_detail_data, ";
$sql .= "phrase_detail_type, "; $sql .= "phrase_detail_method, ";
$sql .= "phrase_detail_group "; $sql .= "phrase_detail_type, ";
$sql .= " ) "; $sql .= "phrase_detail_group ";
$sql .= "values "; $sql .= " ) ";
$sql .= "( "; $sql .= "values ";
$sql .= "'".$phrase_detail_uuid."', "; $sql .= "( ";
$sql .= "'".$phrase_uuid."', "; $sql .= "'".$phrase_detail_uuid."', ";
$sql .= "'".$domain_uuid."', "; $sql .= "'".$phrase_uuid."', ";
$sql .= "'".$_POST['phrase_detail_order']."', "; $sql .= "'".$domain_uuid."', ";
$sql .= "'".$_POST['phrase_detail_tag']."', "; $sql .= "'".$_POST['phrase_detail_order']."', ";
$sql .= "'".$_POST['phrase_detail_pattern']."', "; $sql .= "'".$_POST['phrase_detail_tag']."', ";
$sql .= "'".$_POST['phrase_detail_function']."', "; $sql .= "'".$_POST['phrase_detail_pattern']."', ";
$sql .= "'".$_POST['phrase_detail_data']."', "; $sql .= "'".$_POST['phrase_detail_function']."', ";
$sql .= "'".$_POST['phrase_detail_method']."', "; $sql .= "'".$_POST['phrase_detail_data']."', ";
$sql .= "'".$_POST['phrase_detail_type']."', "; $sql .= "'".$_POST['phrase_detail_method']."', ";
$sql .= "'".$_POST['phrase_detail_group']."' "; $sql .= "'".$_POST['phrase_detail_type']."', ";
$sql .= ") "; $sql .= "'".$_POST['phrase_detail_group']."' ";
//echo $sql."<br><br>"; $sql .= ") ";
$db->exec(check_sql($sql)); //echo $sql."<br><br>";
unset($sql); $db->exec(check_sql($sql));
unset($sql);
}
} }
save_phrases_xml(); save_phrases_xml();
@ -174,38 +176,40 @@ if (count($_POST) > 0 && strlen($_POST["persistformvar"]) == 0) {
$_POST['phrase_detail_tag'] = 'action'; // default, for now $_POST['phrase_detail_tag'] = 'action'; // default, for now
$_POST['phrase_detail_group'] = "0"; // one group, for now $_POST['phrase_detail_group'] = "0"; // one group, for now
$phrase_detail_uuid = uuid(); if ($_POST['phrase_detail_data'] != '') {
$sql = "insert into v_phrase_details "; $phrase_detail_uuid = uuid();
$sql .= "( "; $sql = "insert into v_phrase_details ";
$sql .= "phrase_detail_uuid, "; $sql .= "( ";
$sql .= "phrase_uuid, "; $sql .= "phrase_detail_uuid, ";
$sql .= "domain_uuid, "; $sql .= "phrase_uuid, ";
$sql .= "phrase_detail_order, "; $sql .= "domain_uuid, ";
$sql .= "phrase_detail_tag, "; $sql .= "phrase_detail_order, ";
$sql .= "phrase_detail_pattern, "; $sql .= "phrase_detail_tag, ";
$sql .= "phrase_detail_function, "; $sql .= "phrase_detail_pattern, ";
$sql .= "phrase_detail_data, "; $sql .= "phrase_detail_function, ";
$sql .= "phrase_detail_method, "; $sql .= "phrase_detail_data, ";
$sql .= "phrase_detail_type, "; $sql .= "phrase_detail_method, ";
$sql .= "phrase_detail_group "; $sql .= "phrase_detail_type, ";
$sql .= ") "; $sql .= "phrase_detail_group ";
$sql .= "values "; $sql .= ") ";
$sql .= "( "; $sql .= "values ";
$sql .= "'".$phrase_detail_uuid."', "; $sql .= "( ";
$sql .= "'".$phrase_uuid."', "; $sql .= "'".$phrase_detail_uuid."', ";
$sql .= "'".$domain_uuid."', "; $sql .= "'".$phrase_uuid."', ";
$sql .= "'".$_POST['phrase_detail_order']."', "; $sql .= "'".$domain_uuid."', ";
$sql .= "'".$_POST['phrase_detail_tag']."', "; $sql .= "'".$_POST['phrase_detail_order']."', ";
$sql .= "'".$_POST['phrase_detail_pattern']."', "; $sql .= "'".$_POST['phrase_detail_tag']."', ";
$sql .= "'".$_POST['phrase_detail_function']."', "; $sql .= "'".$_POST['phrase_detail_pattern']."', ";
$sql .= "'".$_POST['phrase_detail_data']."', "; $sql .= "'".$_POST['phrase_detail_function']."', ";
$sql .= "'".$_POST['phrase_detail_method']."', "; $sql .= "'".$_POST['phrase_detail_data']."', ";
$sql .= "'".$_POST['phrase_detail_type']."', "; $sql .= "'".$_POST['phrase_detail_method']."', ";
$sql .= "'".$_POST['phrase_detail_group']."' "; $sql .= "'".$_POST['phrase_detail_type']."', ";
$sql .= ") "; $sql .= "'".$_POST['phrase_detail_group']."' ";
//echo $sql."<br><br>"; $sql .= ") ";
$db->exec(check_sql($sql)); //echo $sql."<br><br>";
unset($sql); $db->exec(check_sql($sql));
unset($sql);
}
} }
save_phrases_xml(); save_phrases_xml();
@ -319,7 +323,7 @@ if (count($_POST) > 0 && strlen($_POST["persistformvar"]) == 0) {
echo " <table width='59%' border='0' cellpadding='0' cellspacing='0'>\n"; echo " <table width='59%' border='0' cellpadding='0' cellspacing='0'>\n";
echo " <tr>\n"; echo " <tr>\n";
echo " <td class='vtable'>".$text['label-function']."</td>\n"; echo " <td class='vtable'>".$text['label-function']."</td>\n";
echo " <td class='vtable'>".$text['label-file']."</td>\n"; echo " <td class='vtable'>".$text['label-action']."</td>\n";
echo " <td class='vtable' style='text-align: center;'>".$text['label-order']."</td>\n"; echo " <td class='vtable' style='text-align: center;'>".$text['label-order']."</td>\n";
echo " <td></td>\n"; echo " <td></td>\n";
echo " </tr>\n"; echo " </tr>\n";