Merge branch 'develop' of git@github.com:Dolibarr/dolibarr.git into develop

This commit is contained in:
Laurent Destailleur 2016-01-17 19:03:23 +01:00
commit 4b94c2ade7
6 changed files with 224 additions and 14 deletions

View File

@ -1,5 +1,5 @@
<?php
/* Copyright (C) 2007-2011 Laurent Destailleur <eldy@users.sourceforge.net>
/* Copyright (C) 2007-2016 Laurent Destailleur <eldy@users.sourceforge.net>
* Copyright (C) 2009 Regis Houssin <regis.houssin@capnetworks.com>
*
* This program is free software; you can redistribute it and/or modify
@ -33,15 +33,73 @@ $langs->load("errors");
if (!$user->admin) accessforbidden();
$action=GETPOST('action');
$id=GETPOST('rowid','int');
$action=GETPOST('action','alpha');
$langcode=GETPOST('langcode','alpha');
$transkey=GETPOST('transkey','alpha');
$transvalue=GETPOST('transvalue','alpha');
/*
* Actions
*/
// None
if ($action == 'add' || (GETPOST('add') && $action != 'update'))
{
$error=0;
if (empty($langcode))
{
setEventMessages($langs->trans("ErrorFieldRequired", $langs->transnoentitiesnoconv("Language")), null, 'errors');
$error++;
}
if ($transkey == '')
{
setEventMessages($langs->trans("ErrorFieldRequired", $langs->transnoentitiesnoconv("Key")), null, 'errors');
$error++;
}
if ($transvalue == '')
{
setEventMessages($langs->trans("ErrorFieldRequired", $langs->transnoentitiesnoconv("Value")), null, 'errors');
$error++;
}
if (! $error)
{
$sql = "INSERT INTO ".MAIN_DB_PREFIX."overwrite_trans(lang, transkey, transvalue) VALUE ('".$db->escape($langcode)."','".$db->escape($transkey)."','".$db->escape($transvalue)."')";
$result = $db->query($sql);
if ($result > 0)
{
setEventMessages($langs->trans("RecordSaved"), null, 'mesgs');
$action="";
$transkey="";
$transvalue="";
}
else
{
dol_print_error($db);
$action='';
}
}
}
// Delete line from delete picto
if ($action == 'delete')
{
$sql = "DELETE FROM ".MAIN_DB_PREFIX."overwrite_trans WHERE rowid = ".$db->escape($id);
$result = $db->query($sql);
if ($result >= 0)
{
setEventMessages($langs->trans("RecordDeleted"), null, 'mesgs');
}
else
{
dol_print_error($db);
}
}
@ -58,11 +116,121 @@ print $langs->trans("TranslationDesc")."<br>\n";
print "<br>\n";
print $langs->trans("CurrentUserLanguage").': <strong>'.$langs->defaultlang.'</strong><br>';
print img_warning().' '.$langs->trans("SomeTranslationAreUncomplete").'<br>';
print '<br>';
print img_warning().' '.$langs->trans("SomeTranslationAreUncomplete").'<br>';
$urlwikitranslatordoc='http://wiki.dolibarr.org/index.php/Translator_documentation';
print $langs->trans("SeeAlso").': <a href="'.$urlwikitranslatordoc.'" target="_blank">'.$urlwikitranslatordoc.'</a><br>';
print '<br>';
print $langs->trans("TranslationOverwriteDesc",$langs->transnoentitiesnoconv("Language"),$langs->transnoentitiesnoconv("Key"),$langs->transnoentitiesnoconv("Value"))."<br>\n";
print '<br>';
print '<form action="'.$_SERVER["PHP_SELF"].((empty($user->entity) && $debug)?'?debug=1':'').'" method="POST">';
print '<input type="hidden" name="token" value="'.$_SESSION['newtoken'].'">';
print '<input type="hidden" id="action" name="action" value="">';
print '<table class="noborder" width="100%">';
print '<tr class="liste_titre">';
print '<td>'.$langs->trans("Language").'</td>';
print '<td>'.$langs->trans("Key").'</td>';
print '<td>'.$langs->trans("Value").'</td>';
if (! empty($conf->multicompany->enabled) && !$user->entity) print '<td>'.$langs->trans("Entity").'</td>';
print '<td align="center"></td>';
print "</tr>\n";
// Line to add new record
$var=false;
print "\n";
print '<tr '.$bc[$var].'><td><input type="text" class="flat" size="24" name="langcode" value="'.GETPOST('langcode').'"></td>'."\n";
print '<td>';
print '<input type="text" class="flat" size="30" name="transkey" value="">';
print '</td><td>';
print '<input type="text" class="flat" size="40" name="transvalue" value="">';
print '</td>';
// Limit to superadmin
if (! empty($conf->multicompany->enabled) && !$user->entity)
{
print '<td>';
print '<input type="text" class="flat" size="1" name="entity" value="'.$conf->entity.'">';
print '</td>';
print '<td align="center">';
}
else
{
print '<td align="center">';
print '<input type="hidden" name="entity" value="'.$conf->entity.'">';
}
print '<input type="submit" class="button" value="'.$langs->trans("Add").'" name="add">';
print "</td>\n";
print '</tr>';
// Show constants
$sql = "SELECT";
$sql.= " rowid";
$sql.= ", lang";
$sql.= ", transkey";
$sql.= ", transvalue";
//$sql.= ", entity";
$sql.= " FROM ".MAIN_DB_PREFIX."overwrite_trans";
$sql.= " WHERE 1 = 1";
//$sql.= " AND entity IN (".$user->entity.",".$conf->entity.")";
//if ((empty($user->entity) || $user->admin) && $debug) {} // to force for superadmin to debug
//else if (! GETPOST('visible') || GETPOST('visible') != 'all') $sql.= " AND visible = 1"; // We must always have this. Otherwise, array is too large and submitting data fails due to apache POST or GET limits
//if (GETPOST('name')) $sql.=natural_search("name", GETPOST('name'));
//$sql.= " ORDER BY entity, name ASC";
$sql.= " ORDER BY lang ASC, transkey ASC";
dol_syslog("translation::select from table", LOG_DEBUG);
$result = $db->query($sql);
if ($result)
{
$num = $db->num_rows($result);
$i = 0;
$var=false;
while ($i < $num)
{
$obj = $db->fetch_object($result);
$var=!$var;
print "\n";
print '<tr '.$bc[$var].'>';
print '<td>'.$obj->lang.'</td>'."\n";
print '<td>'.$obj->transkey.'</td>'."\n";
// Value
print '<td>';
/*print '<input type="hidden" name="const['.$i.'][rowid]" value="'.$obj->rowid.'">';
print '<input type="hidden" name="const['.$i.'][lang]" value="'.$obj->lang.'">';
print '<input type="hidden" name="const['.$i.'][name]" value="'.$obj->transkey.'">';
print '<input type="text" id="value_'.$i.'" class="flat inputforupdate" size="30" name="const['.$i.'][value]" value="'.dol_escape_htmltag($obj->transvalue).'">';
*/
print $obj->transvalue;
print '</td>';
print '<td align="center">';
print '<a href="'.$_SERVER['PHP_SELF'].'?rowid='.$obj->rowid.'&entity='.$obj->entity.'&action=delete'.((empty($user->entity) && $debug)?'&debug=1':'').'">'.img_delete().'</a>';
print '</td>';
print "</tr>\n";
print "\n";
$i++;
}
}
print '</table>';
print "</form>\n";
llxFooter();

View File

@ -518,10 +518,7 @@ function print_left_eldy_menu($db,$menu_array_before,$menu_array_after,&$tabMenu
$newmenu->add("/accountancy/admin/fiscalyear.php?mainmenu=home", $langs->trans("Fiscalyear"),1);
}
if (! in_array($langs->defaultlang,array('en_US')))
{
$newmenu->add("/admin/translation.php", $langs->trans("Translation"),1);
}
$newmenu->add("/admin/translation.php", $langs->trans("Translation"),1);
$newmenu->add("/admin/boxes.php?mainmenu=home", $langs->trans("Boxes"),1);
$newmenu->add("/admin/delais.php?mainmenu=home",$langs->trans("Alerts"),1);
$newmenu->add("/admin/security_other.php?mainmenu=home", $langs->trans("Security"),1);

View File

@ -31,3 +31,6 @@ ALTER TABLE llx_fichinter ADD COLUMN dateo date after duree;
ALTER TABLE llx_projet ADD COLUMN opp_percent double(5,2) after fk_opp_status;
UPDATE llx_projet as p set opp_percent = (SELECT percent from llx_c_lead_status as cls where cls.rowid = p.fk_opp_status) where opp_percent IS NULL;
ALTER TABLE llx_overwrite_trans ADD UNIQUE INDEX uk_overwrite_trans(lang, transkey);

View File

@ -0,0 +1,21 @@
-- ============================================================================
-- Copyright (C) 2016 Laurent Destailleur <eldy@users.sourceforge.net>
--
-- This program is free software; you can redistribute it and/or modify
-- it under the terms of the GNU General Public License as published by
-- the Free Software Foundation; either version 3 of the License, or
-- (at your option) any later version.
--
-- This program is distributed in the hope that it will be useful,
-- but WITHOUT ANY WARRANTY; without even the implied warranty of
-- MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
-- GNU General Public License for more details.
--
-- You should have received a copy of the GNU General Public License
-- along with this program. If not, see <http://www.gnu.org/licenses/>.
--
-- ===========================================================================
ALTER TABLE llx_overwrite_trans ADD UNIQUE INDEX uk_overwrite_trans(lang, transkey);

View File

@ -1088,6 +1088,7 @@ PathDirectory=Directory
SendmailOptionMayHurtBuggedMTA=Feature to send mails using method "PHP mail direct" will generate a mail message that might be not correctly parsed by some receiving mail servers. Result is that some mails can't be read by people hosted by those bugged platforms. It's case for some Internet providers (Ex: Orange in France). This is not a problem into Dolibarr nor into PHP but onto receiving mail server. You can however add option MAIN_FIX_FOR_BUGGED_MTA to 1 into setup - other to modify Dolibarr to avoid this. However, you may experience problem with other servers that respect strictly the SMTP standard. The other solution (recommended) is to use the method "SMTP socket library" that has no disadvantages.
TranslationSetup=Configuration de la traduction
TranslationDesc=Choice of language visible on screen can be modified:<br>* Globally from menu <strong>Home - Setup - Display</strong><br>* For user only from tab <strong>User display</strong> of user card (click on login on top of screen).
TranslationOverwriteDesc=You can also overwrite some value by completing/editing the following table. You must use for "%s" the language code, for "%s" the key found into file langs/xx_XX/somefile.lang and "%s" the new value you want to use as new translation.
TotalNumberOfActivatedModules=Total number of activated feature modules: <b>%s</b>
YouMustEnableOneModule=You must at least enable 1 module
ClassNotFoundIntoPathWarning=Class %s not found into PHP path

View File

@ -54,6 +54,7 @@ $search_account_customer_code=trim(GETPOST('search_account_customer_code'));
$search_account_supplier_code=trim(GETPOST('search_account_supplier_code'));
$search_town=trim(GETPOST("search_town"));
$search_zip=trim(GETPOST("search_zip"));
$search_state=trim(GETPOST("search_state"));
$search_idprof1=trim(GETPOST('search_idprof1'));
$search_idprof2=trim(GETPOST('search_idprof2'));
$search_idprof3=trim(GETPOST('search_idprof3'));
@ -148,7 +149,8 @@ $arrayfields=array(
's.code_compta_fournisseur'=>array('label'=>$langs->trans("SupplierAccountancyCodeShort"), 'checked'=>$checkedsupplieraccountcode, 'enabled'=>(! empty($conf->fournisseur->enabled))),
's.town'=>array('label'=>$langs->trans("Town"), 'checked'=>1),
's.zip'=>array('label'=>$langs->trans("Zip"), 'checked'=>1),
'country.code_iso'=>array('label'=>$langs->trans("Country"), 'checked'=>0),
'state.state_name'=>array('label'=>$langs->trans("State"), 'checked'=>0),
'country.code_iso'=>array('label'=>$langs->trans("Country"), 'checked'=>0),
'typent.code'=>array('label'=>$langs->trans("ThirdPartyType"), 'checked'=>$checkedtypetiers),
's.siren'=>array('label'=>$langs->trans("ProfId1Short"), 'checked'=>$checkedprofid1),
's.siret'=>array('label'=>$langs->trans("ProfId2Short"), 'checked'=>$checkedprofid2),
@ -209,6 +211,7 @@ if (GETPOST("button_removefilter_x") || GETPOST("button_removefilter.x") || GETP
$search_account_supplier_code='';
$search_town="";
$search_zip="";
$search_state="";
$search_idprof1='';
$search_idprof2='';
$search_idprof3='';
@ -340,7 +343,8 @@ $sql = "SELECT s.rowid, s.nom as name, s.name_alias, s.barcode, s.town, s.zip, s
$sql.= " st.libelle as stcomm, s.fk_stcomm as stcomm_id, s.fk_prospectlevel, s.prefix_comm, s.client, s.fournisseur, s.canvas, s.status as status,";
$sql.= " s.siren as idprof1, s.siret as idprof2, ape as idprof3, idprof4 as idprof4, s.fk_pays,";
$sql.= " s.tms as date_update, s.datec as date_creation,";
$sql.= " typent.code as typent_code";
$sql.= " typent.code as typent_code,";
$sql.= " state.code_departement as state_code, state.nom as state_name";
// We'll need these fields in order to filter by sale (including the case where the user can only see his prospects)
if ($search_sale) $sql .= ", sc.fk_soc, sc.fk_user";
// We'll need these fields in order to filter by categ
@ -353,8 +357,9 @@ $reshook=$hookmanager->executeHooks('printFieldListSelect',$parameters); // N
$sql.=$hookmanager->resPrint;
$sql.= " FROM ".MAIN_DB_PREFIX."societe as s";
if (is_array($extrafields->attribute_label) && count($extrafields->attribute_label)) $sql.= " LEFT JOIN ".MAIN_DB_PREFIX."societe_extrafields as ef on (s.rowid = ef.fk_object)";
$sql.= " LEFT JOIN ".MAIN_DB_PREFIX."c_country as country on (country.rowid = s.fk_pays) ";
$sql.= " LEFT JOIN ".MAIN_DB_PREFIX."c_typent as typent on (typent.id = s.fk_typent) ";
$sql.= " LEFT JOIN ".MAIN_DB_PREFIX."c_country as country on (country.rowid = s.fk_pays)";
$sql.= " LEFT JOIN ".MAIN_DB_PREFIX."c_typent as typent on (typent.id = s.fk_typent)";
$sql.= " LEFT JOIN ".MAIN_DB_PREFIX."c_departements as state on (state.rowid = s.fk_departement)";
$sql.= " ,".MAIN_DB_PREFIX."c_stcomm as st";
// We'll need this table joined to the select in order to filter by sale
if ($search_sale || (!$user->rights->societe->client->voir && !$socid)) $sql.= ", ".MAIN_DB_PREFIX."societe_commerciaux as sc";
@ -378,6 +383,7 @@ if ($search_account_customer_code) $sql.= natural_search("s.code_compta",$search
if ($search_account_supplier_code) $sql.= natural_search("s.code_compta_fournisseur",$search_account_supplier_code);
if ($search_town) $sql.= natural_search("s.town",$search_town);
if ($search_zip) $sql.= natural_search("s.zip",$search_zip);
if ($search_state) $sql.= natural_search("state.nom",$search_state);
if ($search_idprof1) $sql.= natural_search("s.siren",$search_idprof1);
if ($search_idprof2) $sql.= natural_search("s.siret",$search_idprof2);
if ($search_idprof3) $sql.= natural_search("s.ape",$search_idprof3);
@ -435,6 +441,7 @@ if ($resql)
if ($search_nom != '') $param.= "&amp;search_nom=".urlencode($search_nom);
if ($search_town != '') $param.= "&amp;search_town=".urlencode($search_town);
if ($search_zip != '') $param.= "&amp;search_zip=".urlencode($search_zip);
if ($search_state != '') $param.= "&amp;search_state=".urlencode($search_state);
if ($search_country != '') $param.= "&amp;search_country=".urlencode($search_country);
if ($search_customer_code != '') $param.= "&amp;search_customer_code=".urlencode($search_customer_code);
if ($search_supplier_code != '') $param.= "&amp;search_supplier_code=".urlencode($search_supplier_code);
@ -553,6 +560,7 @@ if ($resql)
if (! empty($arrayfields['s.code_compta_fournisseur']['checked'])) print_liste_field_titre($arrayfields['s.code_compta_fournisseur']['label'],$_SERVER["PHP_SELF"],"s.code_compta_fournisseur","",$param,'',$sortfield,$sortorder);
if (! empty($arrayfields['s.town']['checked'])) print_liste_field_titre($langs->trans("Town"),$_SERVER["PHP_SELF"],"s.town","",$param,'',$sortfield,$sortorder);
if (! empty($arrayfields['s.zip']['checked'])) print_liste_field_titre($langs->trans("Zip"),$_SERVER["PHP_SELF"],"s.zip","",$param,'',$sortfield,$sortorder);
if (! empty($arrayfields['state.state_name']['checked'])) print_liste_field_titre($langs->trans("StateShort"),$_SERVER["PHP_SELF"],"state.state_name","",$param,'',$sortfield,$sortorder);
if (! empty($arrayfields['country.code_iso']['checked'])) print_liste_field_titre($langs->trans("Country"),$_SERVER["PHP_SELF"],"country.code_iso","",$param,'align="center"',$sortfield,$sortorder);
if (! empty($arrayfields['typent.code']['checked'])) print_liste_field_titre($langs->trans("ThirdPartyType"),$_SERVER["PHP_SELF"],"typent.code","",$param,'align="center"',$sortfield,$sortorder);
if (! empty($arrayfields['s.siren']['checked'])) print_liste_field_titre($form->textwithpicto($langs->trans("ProfId1Short"),$textprofid[1],1,0),$_SERVER["PHP_SELF"],"s.siren","",$param,'class="nowrap"',$sortfield,$sortorder);
@ -643,6 +651,13 @@ if ($resql)
print '<td class="liste_titre">';
print '<input class="flat" size="4" type="text" name="search_zip" value="'.dol_escape_htmltag($search_zip).'">';
print '</td>';
}
// State
if (! empty($arrayfields['state.state_name']['checked']))
{
print '<td class="liste_titre">';
print '<input class="flat" size="4" type="text" name="search_state" value="'.dol_escape_htmltag($search_state).'">';
print '</td>';
}
// Country
if (! empty($arrayfields['country.code_iso']['checked']))
@ -856,7 +871,12 @@ if ($resql)
{
print "<td>".$obj->zip."</td>\n";
}
// Country
// State
if (! empty($arrayfields['state.state_name']['checked']))
{
print "<td>".$obj->state_name."</td>\n";
}
// Country
if (! empty($arrayfields['country.code_iso']['checked']))
{
print '<td align="center">';