From: <rc...@us...> - 2014-05-26 07:08:23
|
Revision: 6730 http://sourceforge.net/p/web-erp/reponame/6730 Author: rchacon Date: 2014-05-26 07:08:19 +0000 (Mon, 26 May 2014) Log Message: ----------- Correct other problems related to updating translations of the items description. Improves Spanish translation. Modified Paths: -------------- trunk/StockClone.php trunk/Stocks.php trunk/locale/es_ES.utf8/LC_MESSAGES/messages.mo trunk/locale/es_ES.utf8/LC_MESSAGES/messages.po Modified: trunk/StockClone.php =================================================================== --- trunk/StockClone.php 2014-05-24 19:25:49 UTC (rev 6729) +++ trunk/StockClone.php 2014-05-26 07:08:19 UTC (rev 6730) @@ -321,10 +321,10 @@ //now insert the language descriptions $ErrMsg = _('Could not update the language description because'); $DbgMsg = _('The SQL that was used to update the language description and failed was'); - if (count($ItemDescriptionLanguages)>0){ - foreach ($ItemDescriptionLanguagesArray as $DescriptionLanguage) { - if ($DescriptionLanguage!=''){ - $result = DB_query("INSERT INTO stockdescriptiontranslations VALUES('" . $_POST['StockID'] . "','" . $DescriptionLanguage . "', '" . $_POST['Description_' . str_replace('.','_',$DescriptionLanguage)] . "')",$db,$ErrMsg,$DbgMsg,true); + if (count($ItemDescriptionLanguagesArray)>0){ + foreach ($ItemDescriptionLanguagesArray as $LanguageId) { + if ($LanguageId!=''){ + $result = DB_query("INSERT INTO stockdescriptiontranslations VALUES('" . $_POST['StockID'] . "','" . $LanguageId . "', '" . $_POST['Description_' . str_replace('.','_',$LanguageId)] . "')",$db,$ErrMsg,$DbgMsg,true); } } } @@ -538,8 +538,8 @@ unset($_POST['Pansize']); unset($_POST['StockID']); //unset($_POST['OldStockID']); - foreach ($ItemDescriptionLanguagesArray as $DescriptionLanguage) { - unset($_POST['Description_' . str_replace('.','_',$DescriptionLanguage)]); + foreach ($ItemDescriptionLanguagesArray as $LanguageId) { + unset($_POST['Description_' . str_replace('.','_',$LanguageId)]); $_POST['New'] = 1; //do not show input form again } }//Reset the form variables @@ -632,8 +632,8 @@ $_POST['ShrinkFactor'] = $myrow['shrinkfactor']; $sql = "SELECT descriptiontranslation, language_id FROM stockdescriptiontranslations WHERE stockid='" . $selectedStockID . "' AND ("; - foreach ($ItemDescriptionLanguagesArray as $DescriptionLanguage) { - $sql .= "language_id='" . $DescriptionLanguage ."' OR "; + foreach ($ItemDescriptionLanguagesArray as $LanguageId) { + $sql .= "language_id='" . $LanguageId ."' OR "; } $sql = mb_substr($sql,0,mb_strlen($sql)-3) . ')'; $result = DB_query($sql,$db); @@ -654,15 +654,15 @@ <td><input ' . (in_array('Description',$Errors) ? 'class="inputerror"' : '' ) .' type="text" name="Description" size="52" maxlength="50" value="' . $Description . '" /></td> </tr>'; - foreach ($ItemDescriptionLanguagesArray as $DescriptionLanguage) { - if ($DescriptionLanguage!=''){ + foreach ($ItemDescriptionLanguagesArray as $LanguageId) { + if ($LanguageId!=''){ //unfortunately cannot have points in POST variables so have to mess with the language id - $PostVariableName = 'Description_' . str_replace('.','_',$DescriptionLanguage); + $PostVariableName = 'Description_' . str_replace('.','_',$LanguageId); if (!isset($_POST[$PostVariableName])){ $_POST[$PostVariableName] =''; } echo '<tr> - <td>' . $LanguagesArray[$DescriptionLanguage]['LanguageName'] . ' ' . _('Description') . ':</td> + <td>' . $LanguagesArray[$LanguageId]['LanguageName'] . ' ' . _('Description') . ':</td> <td><input type="text" name="'. $PostVariableName . '" size="52" maxlength="50" value="' . $_POST[$PostVariableName] . '" /></td> </tr>'; } Modified: trunk/Stocks.php =================================================================== --- trunk/Stocks.php 2014-05-24 19:25:49 UTC (rev 6729) +++ trunk/Stocks.php 2014-05-26 07:08:19 UTC (rev 6730) @@ -19,22 +19,22 @@ $StockID = ''; } -$ItemDescriptionLanguagesArray = explode(',',$_SESSION['ItemDescriptionLanguages']); +$ItemDescriptionLanguagesArray = explode(',',$_SESSION['ItemDescriptionLanguages']);//WARNING: if the last character is a ",", there are n+1 languages. if (isset($_POST['NextItem'])){ $Result = DB_query("SELECT stockid FROM stockmaster WHERE stockid>'" . $StockID . "' ORDER BY stockid ASC LIMIT 1",$db); $NextItemRow = DB_fetch_row($Result); $StockID = $NextItemRow[0]; - foreach ($ItemDescriptionLanguagesArray as $DescriptionLanguage) { - unset($_POST['Description_' . str_replace('.','_',$DescriptionLanguage)]); + foreach ($ItemDescriptionLanguagesArray as $LanguageId) { + unset($_POST['Description_' . str_replace('.','_',$LanguageId)]); } } if (isset($_POST['PreviousItem'])){ $Result = DB_query("SELECT stockid FROM stockmaster WHERE stockid<'" . $StockID . "' ORDER BY stockid DESC LIMIT 1",$db); $PreviousItemRow = DB_fetch_row($Result); $StockID = $PreviousItemRow[0]; - foreach ($ItemDescriptionLanguagesArray as $DescriptionLanguage) { - unset($_POST['Description_' . str_replace('.','_',$DescriptionLanguage)]); + foreach ($ItemDescriptionLanguagesArray as $LanguageId) { + unset($_POST['Description_' . str_replace('.','_',$LanguageId)]); } } @@ -427,14 +427,26 @@ $ErrMsg = _('Could not update the language description because'); $DbgMsg = _('The SQL that was used to update the language description and failed was'); - if (count($ItemDescriptionLanguages)>0){ - foreach ($ItemDescriptionLanguagesArray as $DescriptionLanguage) { - if ($DescriptionLanguage!=''){ - $result = DB_query("DELETE FROM stockdescriptiontranslations WHERE stockid='" . $StockID . "' AND language_id='" . $DescriptionLanguage . "'",$db,$ErrMsg,$DbgMsg,true); - $result = DB_query("INSERT INTO stockdescriptiontranslations VALUES('" . $StockID . "','" . $DescriptionLanguage . "', '" . $_POST['Description_' . str_replace('.','_',$DescriptionLanguage)] . "')",$db,$ErrMsg,$DbgMsg,true); + if (count($ItemDescriptionLanguagesArray)>0){ + foreach ($ItemDescriptionLanguagesArray as $LanguageId) { + if ($LanguageId!=''){ + $result = DB_query("DELETE FROM stockdescriptiontranslations WHERE stockid='" . $StockID . "' AND language_id='" . $LanguageId . "'",$db,$ErrMsg,$DbgMsg,true); + $result = DB_query("INSERT INTO stockdescriptiontranslations VALUES('" . $StockID . "','" . $LanguageId . "', '" . $_POST['Description_' . str_replace('.','_',$LanguageId)] . "')",$db,$ErrMsg,$DbgMsg,true); } } + /* + foreach ($ItemDescriptionLanguagesArray as $LanguageId) { + $DescriptionTranslation = $_POST['Description_' . str_replace('.', '_', $LanguageId)]; + //WARNING: It DOES NOT update if database row DOES NOT exist. + $sql = "UPDATE stockdescriptiontranslations " . + "SET descriptiontranslation='" . $DescriptionTranslation . "' " . + "WHERE stockid='" . $StockID . "' AND (language_id='" . $LanguageId. "')"; + $result = DB_query($sql, $db, $ErrMsg, $DbgMsg, true); + } + */ + } + //delete any properties for the item no longer relevant with the change of category $result = DB_query("DELETE FROM stockitemproperties WHERE stockid ='" . $StockID . "'", @@ -623,9 +635,10 @@ $ErrMsg = _('Could not update the language description because'); $DbgMsg = _('The SQL that was used to update the language description and failed was'); if (count($ItemDescriptionLanguages)>0){ - foreach ($ItemDescriptionLanguagesArray as $DescriptionLanguage) { - if ($DescriptionLanguage!=''){ - $result = DB_query("INSERT INTO stockdescriptiontranslations VALUES('" . $StockID . "','" . $DescriptionLanguage . "', '" . $_POST['Description_' . str_replace('.','_',$DescriptionLanguage)] . "')",$db,$ErrMsg,$DbgMsg,true); + foreach ($ItemDescriptionLanguagesArray as $LanguageId) { + if ($LanguageId!=''){ + $sql = "INSERT INTO stockdescriptiontranslations VALUES('" . $StockID . "','" . $LanguageId . "', '" . $_POST['Description_' . str_replace('.','_',$LanguageId)] . "')"; + $result = DB_query($sql,$db,$ErrMsg,$DbgMsg,true); } } } @@ -694,8 +707,8 @@ unset($_POST['ShrinkFactor']); unset($_POST['Pansize']); unset($StockID); - foreach ($ItemDescriptionLanguagesArray as $DescriptionLanguage) { - unset($_POST['Description_' . str_replace('.','_',$DescriptionLanguage)]); + foreach ($ItemDescriptionLanguagesArray as $LanguageId) { + unset($_POST['Description_' . str_replace('.','_',$LanguageId)]); } $New=1; }//ALL WORKED SO RESET THE FORM VARIABLES @@ -840,8 +853,8 @@ unset($_POST['TaxCat']); unset($_POST['DecimalPlaces']); unset($_SESSION['SelectedStockItem']); - foreach ($ItemDescriptionLanguagesArray as $DescriptionLanguage) { - unset($_POST['Description_' . str_replace('.','_',$DescriptionLanguage)]); + foreach ($ItemDescriptionLanguagesArray as $LanguageId) { + unset($_POST['Description_' . str_replace('.','_',$LanguageId)]); } unset($StockID); @@ -934,8 +947,8 @@ $sql = "SELECT descriptiontranslation, language_id FROM stockdescriptiontranslations WHERE stockid='" . $StockID . "' AND ("; - foreach ($ItemDescriptionLanguagesArray as $DescriptionLanguage) { - $sql .= "language_id='" . $DescriptionLanguage ."' OR "; + foreach ($ItemDescriptionLanguagesArray as $LanguageId) { + $sql .= "language_id='" . $LanguageId ."' OR "; } $sql = mb_substr($sql,0,mb_strlen($sql)-3) . ')'; $result = DB_query($sql,$db); @@ -964,15 +977,15 @@ <td><input ' . (in_array('Description',$Errors) ? 'class="inputerror"' : '' ) .' type="text" ' . ($New==0?'autofocus="autofocus"':'') . ' name="Description" required="required" size="52" maxlength="50" value="' . stripslashes($Description) . '" /></td> </tr>'; -foreach ($ItemDescriptionLanguagesArray as $DescriptionLanguage) { - if ($DescriptionLanguage!=''){ +foreach ($ItemDescriptionLanguagesArray as $LanguageId) { + if ($LanguageId!=''){ //unfortunately cannot have points in POST variables so have to mess with the language id - $PostVariableName = 'Description_' . str_replace('.','_',$DescriptionLanguage); + $PostVariableName = 'Description_' . str_replace('.','_',$LanguageId); if (!isset($_POST[$PostVariableName])){ $_POST[$PostVariableName] =''; } echo '<tr> - <td>' . $LanguagesArray[$DescriptionLanguage]['LanguageName'] . ' ' . _('Description') . ':</td> + <td>' . $LanguagesArray[$LanguageId]['LanguageName'] . ' ' . _('Description') . ':</td> <td><input type="text" name="'. $PostVariableName . '" size="52" maxlength="50" value="' . $_POST[$PostVariableName] . '" title="' . _('This language translation of the item will be used in invoices and credits to customers who are defined to use this language. The language translations to maintain here can be configured in the system parameters page') . '" /></td> </tr>'; } Modified: trunk/locale/es_ES.utf8/LC_MESSAGES/messages.mo =================================================================== (Binary files differ) Modified: trunk/locale/es_ES.utf8/LC_MESSAGES/messages.po =================================================================== --- trunk/locale/es_ES.utf8/LC_MESSAGES/messages.po 2014-05-24 19:25:49 UTC (rev 6729) +++ trunk/locale/es_ES.utf8/LC_MESSAGES/messages.po 2014-05-26 07:08:19 UTC (rev 6730) @@ -8,7 +8,7 @@ "Project-Id-Version: WebERP 4.081\n" "Report-Msgid-Bugs-To: \n" "POT-Creation-Date: 2014-02-08 17:33+1300\n" -"PO-Revision-Date: 2014-05-22 11:43-0600\n" +"PO-Revision-Date: 2014-05-25 11:09-0600\n" "Last-Translator: Rafael Chacon <raf...@gm...>\n" "Language-Team: TecnoSoluciones.com <web...@te...>\n" "Language: es_ES\n" @@ -7826,7 +7826,7 @@ #: CustLoginSetup.php:155 msgid "Enter the user's real name" -msgstr "" +msgstr "Introduzca el nombre real del usuario" #: CustLoginSetup.php:158 Locations.php:590 SalesPeople.php:332 #: SupplierContacts.php:265 SuppLoginSetup.php:141 WWW_Users.php:462 @@ -7835,7 +7835,7 @@ #: CustLoginSetup.php:163 msgid "Enter the user's email address" -msgstr "" +msgstr "Introduzca la dirección de correo-e del usuario" #: CustLoginSetup.php:167 CustomerBranches.php:599 CustomerBranches.php:636 #: CustomerPurchases.php:79 WWW_Users.php:285 WWW_Users.php:531 @@ -8075,7 +8075,7 @@ #: CustomerAllocations.php:437 SupplierAllocations.php:506 msgid "Total Allocated" -msgstr "Total Asignado" +msgstr "Total asignado" #: CustomerAllocations.php:441 SupplierAllocations.php:519 msgid "Recalculate Total To Allocate" @@ -19906,7 +19906,7 @@ #: PDFPrintLabel.php:45 msgid "The Price Labels could not be retrieved by the SQL because" -msgstr "El SQL no pudo obtener las Etiquetas de Precios porque" +msgstr "El SQL no pudo obtener las etiquetas de precios porque" #: PDFPrintLabel.php:54 msgid "There were no price labels to print out for the category specified" @@ -19923,7 +19923,7 @@ #: PDFPrintLabel.php:184 PDFPrintLabel.php:185 PDFPrintLabel.php:268 #: PDFPrintLabel.php:271 msgid "Price Labels" -msgstr "Etiquetas de Precios" +msgstr "Etiquetas de precios" #: PDFPrintLabel.php:261 msgid "Price_Labels" @@ -19931,7 +19931,7 @@ #: PDFPrintLabel.php:272 includes/MainMenuLinksArray.php:220 msgid "Print Price Labels" -msgstr "Imrpimir Etiquetas de Precios" +msgstr "Imprimir etiquetas de precios" #: PDFPrintLabel.php:282 msgid "Label to print" @@ -20029,7 +20029,7 @@ #: PDFReceipt.php:33 msgid "Customer Receipt Number " -msgstr "Número de Recepción de cliente" +msgstr "Número de recibo de cliente" #: PDFReceipt.php:96 msgid "Received From" @@ -20075,7 +20075,7 @@ #: PDFRemittanceAdvice.php:48 msgid "and Paid On" -msgstr "Y Pagado en" +msgstr "Y pagado en" #: PDFRemittanceAdvice.php:80 msgid "Remittance Advice Problem Report" @@ -20112,7 +20112,7 @@ #: PDFRemittanceAdvice.php:311 msgid "This Payment" -msgstr "Este Pago" +msgstr "Este pago" #: PDFSellThroughSupportClaim.php:6 PDFSellThroughSupportClaim.php:164 #: includes/MainMenuLinksArray.php:67 |