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

This commit is contained in:
Maxime Kohlhaas 2015-04-18 23:09:24 +02:00
commit 098f2ab0b1
13 changed files with 184 additions and 24 deletions

View File

@ -1,5 +1,5 @@
<?php
/* Copyright (c) 2015 Lorenzo Novaro <novalore@19.coop>
/* Copyright (c) 2015 Tommaso Basilici <t.basilici@19.coop>
*
* 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
@ -15,8 +15,129 @@
* along with this program. If not, see <http://www.gnu.org/licenses/>.
*/
echo "<html>";
echo "<head>";
echo "<STYLE type=\"text/css\">
body {
color: #444;
font: 100%/30px 'Helvetica Neue', helvetica, arial, sans-serif;
text-shadow: 0 1px 0 #fff;
}
strong {
font-weight: bold;
}
em {
font-style: italic;
}
table {
background: #f5f5f5;
border-collapse: separate;
box-shadow: inset 0 1px 0 #fff;
font-size: 12px;
line-height: 24px;
margin: 30px auto;
text-align: left;
width: 800px;
}
th {
background-color: #777;
border-left: 1px solid #555;
border-right: 1px solid #777;
border-top: 1px solid #555;
border-bottom: 1px solid #333;
box-shadow: inset 0 1px 0 #999;
color: #fff;
font-weight: bold;
padding: 10px 15px;
position: relative;
text-shadow: 0 1px 0 #000;
}
th:after {
background: linear-gradient(rgba(255,255,255,0), rgba(255,255,255,.08));
content: '';
display: block;
height: 25%;
left: 0;
margin: 1px 0 0 0;
position: absolute;
top: 25%;
width: 100%;
}
th:first-child {
border-left: 1px solid #777;
box-shadow: inset 1px 1px 0 #999;
}
th:last-child {
box-shadow: inset -1px 1px 0 #999;
}
td {
border-right: 1px solid #fff;
border-left: 1px solid #e8e8e8;
border-top: 1px solid #fff;
border-bottom: 1px solid #e8e8e8;
padding: 10px 15px;
position: relative;
transition: all 300ms;
}
td:first-child {
box-shadow: inset 1px 0 0 #fff;
}
td:last-child {
border-right: 1px solid #e8e8e8;
box-shadow: inset -1px 0 0 #fff;
}
tr {
background-color: #f1f1f1;
}
tr:nth-child(odd) td {
background-color: #f1f1f1;
}
tr:last-of-type td {
box-shadow: inset 0 -1px 0 #fff;
}
tr:last-of-type td:first-child {
box-shadow: inset 1px -1px 0 #fff;
}
tr:last-of-type td:last-child {
box-shadow: inset -1px -1px 0 #fff;
}
tbody:hover td {
color: transparent;
text-shadow: 0 0 3px #aaa;
}
tbody:hover tr:hover td {
color: #444;
text-shadow: 0 1px 0 #fff;
} </STYLE>";
echo "<body>";
echo "<h3>If you call this file with the argument \"?unused=true\" it searches for the translation strings that exist in en_US but are never used</h3>";
echo "<h2>IMPORTANT: that can take quite a lot of time (up to 10 minutes), you need to tune the max_execution_time on your php.ini accordingly</h2>";
echo "<h3>Happy translating :)</h3>";
// directory containing the php and lang files
$htdocs = "../../htdocs/";
// directory containing the english lang files
$workdir = "../../htdocs/langs/en_US/";
$workdir = $htdocs."langs/en_US/";
$files = scandir($workdir);
$exludefiles = array('.','..','README');
@ -36,6 +157,7 @@ foreach ($files AS $file) {
$row_array = explode('=',$row);
$langstrings_3d[$path_file['basename']][$line+1]=$row_array[0];
$langstrings_full[]=$row_array[0];
$langstrings_dist[$row_array[0]]=$row_array[0];
}
}
}
@ -53,8 +175,48 @@ foreach ($langstrings_3d AS $filename => $file) {
}
}
echo "<h2>Duplicate strings in lang files in $workdir</h2>";
echo "<h2>Duplicate strings in lang files in $workdir - ".count($dups)." found</h2>";
echo "<pre>";
print_r($dups);
echo "<table border_bottom=1> ";
echo "<thead><tr><th align=\"center\">#</th><th>String</th><th>File and lines</th></thead>";
echo "<tbody>";
$count = 0;
foreach ($dups as $string => $pages) {
$count++;
echo "<tr>";
echo "<td align=\"center\">$count</td>";
echo "<td>$string</td>";
echo "<td>";
foreach ($pages AS $page => $lines ) {
echo "$page ";
foreach ($lines as $line => $nothing) {
echo "($line) ";
}
echo "<br>";
}
echo "</td></tr>";
}
echo "</tbody>";
echo "</table>";
if ($_REQUEST['unused'] == 'true') {
foreach ($langstrings_dist AS $value){
$search = '\'trans("'.$value.'")\'';
$string = 'grep -R -m 1 -F --include=*.php '.$search.' '.$htdocs.'*';
exec($string,$output);
if (empty($output)) {
$unused[$value] = true;
echo $value.'<br>';
}
}
echo "<h2>Strings in en_US that are never used</h2>";
echo "<pre>";
print_r($unused);
}
echo "</body>";
echo "</html>";
?>

View File

@ -1730,7 +1730,7 @@ if ($action == 'create')
/*
* Action presend
*/
if (!empty(GETPOST('modelselected'))) {
if (GETPOST('modelselected')) {
$action = 'presend';
}
if ($action == 'presend')

View File

@ -2308,7 +2308,7 @@ if ($action == 'create')
* Action presend
*/
//Select mail models is same action as presend
if (!empty(GETPOST('modelselected'))) {
if (GETPOST('modelselected')) {
$action = 'presend';
}
if ($action == 'presend')

View File

@ -3734,7 +3734,7 @@ if ($action == 'create')
print '<br>';
//Select mail models is same action as presend
if (!empty(GETPOST('modelselected'))) {
if (GETPOST('modelselected')) {
$action = 'presend';
}
if ($action != 'prerelance' && $action != 'presend')

View File

@ -530,7 +530,7 @@ if ($resql)
print '<form id="form_unpaid" method="POST" action="'.$_SERVER["PHP_SELF"].'?sortfield='. $sortfield .'&sortorder='. $sortorder .'">';
if (!empty(GETPOST('modelselected'))) {
if (GETPOST('modelselected')) {
$action = 'presend';
}
if (! empty($mode) && $action == 'presend')

View File

@ -1514,7 +1514,7 @@ else if ($id || $ref)
* Action presend
*/
//Select mail models is same action as presend
if (!empty(GETPOST('modelselected'))) {
if (GETPOST('modelselected')) {
$action = 'presend';
}
if ($action == 'presend')

View File

@ -1732,7 +1732,7 @@ else if ($id > 0 || ! empty($ref))
/*
* Action presend
*/
if (!empty(GETPOST('modelselected'))) {
if (GETPOST('modelselected')) {
$action = 'presend';
}
if ($action == 'presend')

View File

@ -8,6 +8,7 @@
* Copyright (C) 2005 Simon Tosser <simon@kornog-computing.com>
* Copyright (C) 2006 Andre Cianfarani <andre.cianfarani@acdeveloppement.net>
* Copyright (C) 2010 Juanjo Menent <jmenent@2byte.es>
* Copyright (C) 2015 Bahfir Abbes <bafbes@gmail.com>
*
* 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
@ -66,15 +67,12 @@ $conffiletoshow = "htdocs/conf/conf.php";
//$conffile = "/etc/dolibarr/conf.php";
//$conffiletoshow = "/etc/dolibarr/conf.php";
// Replace conf filename with "conf" parameter on url by GET
if (GETPOST('conf'))
{
setcookie('dolconf', GETPOST('conf'),0,'/');
$conffile = 'conf/' . dol_sanitizeFileName(GETPOST('conf')) . '.php';
}
else
{
$conffile = 'conf/' . dol_sanitizeFileName((!empty($_COOKIE['dolconf']) ? $_COOKIE['dolconf'] : 'conf') . '.php');
//replace conf filename with "conf" parameter on url by GET
if (!empty($_GET['conf'])) {
setcookie('dolconf', $_GET['conf'],0,'/');
$conffile = 'conf/' . $_GET['conf'] . '.php';
} else {
$conffile = 'conf/' . (!empty($_COOKIE['dolconf']) ? $_COOKIE['dolconf'] : 'conf') . '.php';
}

View File

@ -2246,7 +2246,7 @@ elseif (! empty($object->id))
/*
* Action presend
*/
if (!empty(GETPOST('modelselected'))) {
if (GETPOST('modelselected')) {
$action = 'presend';
}
if ($action == 'presend')

View File

@ -2499,7 +2499,7 @@ else
/*
* Show mail form
*/
if (!empty(GETPOST('modelselected'))) {
if (GETPOST('modelselected')) {
$action = 'presend';
}
if ($action == 'presend')

View File

@ -536,4 +536,4 @@ CREATE TABLE IF NOT EXISTS llx_propal_merge_pdf_product (
-- Feature request: A page to merge two thirdparties into one #2613
ALTER TABLE llx_categorie_societe CHANGE COLUMN fk_societe fk_soc INTEGER NOT NULL;
ALTER TABLE llx_societe CHANGE COLUMN fk_societe fk_soc INTEGER NOT NULL;
ALTER TABLE llx_user CHANGE COLUMN fk_societe fk_soc INTEGER NOT NULL;

View File

@ -52,7 +52,7 @@ create table llx_user
admin smallint DEFAULT 0,
module_comm smallint DEFAULT 1,
module_compta smallint DEFAULT 1,
fk_soc integer,
fk_soc integer,
fk_socpeople integer,
fk_member integer,
fk_user integer, -- Hierarchic parent

View File

@ -119,7 +119,7 @@ CREATE TRIGGER update_customer_modtime BEFORE UPDATE ON llx_user FOR EACH ROW EX
CREATE TRIGGER update_customer_modtime BEFORE UPDATE ON llx_user_extrafields FOR EACH ROW EXECUTE PROCEDURE update_modified_column_tms();
CREATE TRIGGER update_customer_modtime BEFORE UPDATE ON llx_usergroup FOR EACH ROW EXECUTE PROCEDURE update_modified_column_tms();
CREATE TRIGGER update_customer_modtime BEFORE UPDATE ON llx_cronjob FOR EACH ROW EXECUTE PROCEDURE update_modified_column_tms();
CREATE TRIGGER update_customer_modtime BEFORE UPDATE ON llx_printer_ipp FOR EACH ROW EXECUTE PROCEDURE update_modified_column_tms();
CREATE TRIGGER update_customer_modtime BEFORE UPDATE ON llx_printing FOR EACH ROW EXECUTE PROCEDURE update_modified_column_tms();
CREATE OR REPLACE FUNCTION update_modified_column_date_m() RETURNS TRIGGER AS $$ BEGIN NEW.date_m = now(); RETURN NEW; END; $$ LANGUAGE plpgsql;
CREATE TRIGGER update_customer_modtime BEFORE UPDATE ON llx_ecm_directories FOR EACH ROW EXECUTE PROCEDURE update_modified_column_date_m();