From 74e9407bfb95c5ec82bc9a3cea95382c60f7d51d Mon Sep 17 00:00:00 2001 From: Nate Jones Date: Wed, 25 Feb 2015 23:38:20 +0000 Subject: [PATCH] Phrases: Prevent empty Structure entry from being created on save. --- app/phrases/app_languages.php | 8 +- app/phrases/phrase_edit.php | 134 +++++++++++++++++----------------- 2 files changed, 73 insertions(+), 69 deletions(-) diff --git a/app/phrases/app_languages.php b/app/phrases/app_languages.php index e1d30bdc94..d79d896fdb 100644 --- a/app/phrases/app_languages.php +++ b/app/phrases/app_languages.php @@ -70,10 +70,10 @@ $text['label-function']['pt-pt'] = "Função"; $text['label-function']['fr-fr'] = "Fonction"; - $text['label-file']['en-us'] = "File"; - $text['label-file']['es-cl'] = "Expediente"; - $text['label-file']['pt-pt'] = "Arquivo"; - $text['label-file']['fr-fr'] = "Fichier"; + $text['label-action']['en-us'] = "Action"; + $text['label-action']['es-cl'] = "Acción"; + $text['label-action']['pt-pt'] = "Ação"; + $text['label-action']['fr-fr'] = "Action"; $text['label-order']['en-us'] = "Order"; $text['label-order']['es-cl'] = "Orden"; diff --git a/app/phrases/phrase_edit.php b/app/phrases/phrase_edit.php index e1e2a1b16a..1786ac55cc 100644 --- a/app/phrases/phrase_edit.php +++ b/app/phrases/phrase_edit.php @@ -116,38 +116,40 @@ if (count($_POST) > 0 && strlen($_POST["persistformvar"]) == 0) { $_POST['phrase_detail_tag'] = 'action'; // default, for now $_POST['phrase_detail_group'] = "0"; // one group, for now - $phrase_detail_uuid = uuid(); - $sql = "insert into v_phrase_details "; - $sql .= "( "; - $sql .= "phrase_detail_uuid, "; - $sql .= "phrase_uuid, "; - $sql .= "domain_uuid, "; - $sql .= "phrase_detail_order, "; - $sql .= "phrase_detail_tag, "; - $sql .= "phrase_detail_pattern, "; - $sql .= "phrase_detail_function, "; - $sql .= "phrase_detail_data, "; - $sql .= "phrase_detail_method, "; - $sql .= "phrase_detail_type, "; - $sql .= "phrase_detail_group "; - $sql .= " ) "; - $sql .= "values "; - $sql .= "( "; - $sql .= "'".$phrase_detail_uuid."', "; - $sql .= "'".$phrase_uuid."', "; - $sql .= "'".$domain_uuid."', "; - $sql .= "'".$_POST['phrase_detail_order']."', "; - $sql .= "'".$_POST['phrase_detail_tag']."', "; - $sql .= "'".$_POST['phrase_detail_pattern']."', "; - $sql .= "'".$_POST['phrase_detail_function']."', "; - $sql .= "'".$_POST['phrase_detail_data']."', "; - $sql .= "'".$_POST['phrase_detail_method']."', "; - $sql .= "'".$_POST['phrase_detail_type']."', "; - $sql .= "'".$_POST['phrase_detail_group']."' "; - $sql .= ") "; - //echo $sql."

"; - $db->exec(check_sql($sql)); - unset($sql); + if ($_POST['phrase_detail_data'] != '') { + $phrase_detail_uuid = uuid(); + $sql = "insert into v_phrase_details "; + $sql .= "( "; + $sql .= "phrase_detail_uuid, "; + $sql .= "phrase_uuid, "; + $sql .= "domain_uuid, "; + $sql .= "phrase_detail_order, "; + $sql .= "phrase_detail_tag, "; + $sql .= "phrase_detail_pattern, "; + $sql .= "phrase_detail_function, "; + $sql .= "phrase_detail_data, "; + $sql .= "phrase_detail_method, "; + $sql .= "phrase_detail_type, "; + $sql .= "phrase_detail_group "; + $sql .= " ) "; + $sql .= "values "; + $sql .= "( "; + $sql .= "'".$phrase_detail_uuid."', "; + $sql .= "'".$phrase_uuid."', "; + $sql .= "'".$domain_uuid."', "; + $sql .= "'".$_POST['phrase_detail_order']."', "; + $sql .= "'".$_POST['phrase_detail_tag']."', "; + $sql .= "'".$_POST['phrase_detail_pattern']."', "; + $sql .= "'".$_POST['phrase_detail_function']."', "; + $sql .= "'".$_POST['phrase_detail_data']."', "; + $sql .= "'".$_POST['phrase_detail_method']."', "; + $sql .= "'".$_POST['phrase_detail_type']."', "; + $sql .= "'".$_POST['phrase_detail_group']."' "; + $sql .= ") "; + //echo $sql."

"; + $db->exec(check_sql($sql)); + unset($sql); + } } 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_group'] = "0"; // one group, for now - $phrase_detail_uuid = uuid(); - $sql = "insert into v_phrase_details "; - $sql .= "( "; - $sql .= "phrase_detail_uuid, "; - $sql .= "phrase_uuid, "; - $sql .= "domain_uuid, "; - $sql .= "phrase_detail_order, "; - $sql .= "phrase_detail_tag, "; - $sql .= "phrase_detail_pattern, "; - $sql .= "phrase_detail_function, "; - $sql .= "phrase_detail_data, "; - $sql .= "phrase_detail_method, "; - $sql .= "phrase_detail_type, "; - $sql .= "phrase_detail_group "; - $sql .= ") "; - $sql .= "values "; - $sql .= "( "; - $sql .= "'".$phrase_detail_uuid."', "; - $sql .= "'".$phrase_uuid."', "; - $sql .= "'".$domain_uuid."', "; - $sql .= "'".$_POST['phrase_detail_order']."', "; - $sql .= "'".$_POST['phrase_detail_tag']."', "; - $sql .= "'".$_POST['phrase_detail_pattern']."', "; - $sql .= "'".$_POST['phrase_detail_function']."', "; - $sql .= "'".$_POST['phrase_detail_data']."', "; - $sql .= "'".$_POST['phrase_detail_method']."', "; - $sql .= "'".$_POST['phrase_detail_type']."', "; - $sql .= "'".$_POST['phrase_detail_group']."' "; - $sql .= ") "; - //echo $sql."

"; - $db->exec(check_sql($sql)); - unset($sql); + if ($_POST['phrase_detail_data'] != '') { + $phrase_detail_uuid = uuid(); + $sql = "insert into v_phrase_details "; + $sql .= "( "; + $sql .= "phrase_detail_uuid, "; + $sql .= "phrase_uuid, "; + $sql .= "domain_uuid, "; + $sql .= "phrase_detail_order, "; + $sql .= "phrase_detail_tag, "; + $sql .= "phrase_detail_pattern, "; + $sql .= "phrase_detail_function, "; + $sql .= "phrase_detail_data, "; + $sql .= "phrase_detail_method, "; + $sql .= "phrase_detail_type, "; + $sql .= "phrase_detail_group "; + $sql .= ") "; + $sql .= "values "; + $sql .= "( "; + $sql .= "'".$phrase_detail_uuid."', "; + $sql .= "'".$phrase_uuid."', "; + $sql .= "'".$domain_uuid."', "; + $sql .= "'".$_POST['phrase_detail_order']."', "; + $sql .= "'".$_POST['phrase_detail_tag']."', "; + $sql .= "'".$_POST['phrase_detail_pattern']."', "; + $sql .= "'".$_POST['phrase_detail_function']."', "; + $sql .= "'".$_POST['phrase_detail_data']."', "; + $sql .= "'".$_POST['phrase_detail_method']."', "; + $sql .= "'".$_POST['phrase_detail_type']."', "; + $sql .= "'".$_POST['phrase_detail_group']."' "; + $sql .= ") "; + //echo $sql."

"; + $db->exec(check_sql($sql)); + unset($sql); + } } save_phrases_xml(); @@ -319,7 +323,7 @@ if (count($_POST) > 0 && strlen($_POST["persistformvar"]) == 0) { echo " \n"; echo " \n"; echo " \n"; - echo " \n"; + echo " \n"; echo " \n"; echo " \n"; echo " \n";
".$text['label-function']."".$text['label-file']."".$text['label-action']."".$text['label-order']."