Skip to content

Commit

Permalink
Merge remote-tracking branch 'origin/3.7' into 3.7_bug
Browse files Browse the repository at this point in the history
  • Loading branch information
hregis committed Dec 27, 2015
2 parents c71d578 + 96b6f0d commit c65babf
Show file tree
Hide file tree
Showing 18 changed files with 369 additions and 139 deletions.
393 changes: 291 additions & 102 deletions .travis.yml

Large diffs are not rendered by default.

18 changes: 18 additions & 0 deletions build/travis-ci/apache.conf
@@ -0,0 +1,18 @@
<VirtualHost *:80>
DocumentRoot %TRAVIS_BUILD_DIR%/htdocs

<Directory "%TRAVIS_BUILD_DIR%/htdocs">
Options FollowSymLinks MultiViews ExecCGI
AllowOverride All
Order deny,allow
Allow from all
</Directory>

# Wire up Apache to use Travis CI's php-fpm.
<IfModule mod_fastcgi.c>
AddHandler php5-fcgi .php
Action php5-fcgi /php5-fcgi
Alias /php5-fcgi /usr/lib/cgi-bin/php5-fcgi
FastCgiExternalServer /usr/lib/cgi-bin/php5-fcgi -host 127.0.0.1:9000 -pass-header Authorization
</IfModule>
</VirtualHost>
36 changes: 22 additions & 14 deletions composer.json
Expand Up @@ -6,26 +6,34 @@
"homepage": "http://www.dolibarr.org",
"license": "GPL-3.0+",
"support": {
"issues": "https://doliforge.org/projects/dolibarr",
"issues": "https://github.com/Dolibarr/dolibarr/issues",
"forum": "http://www.dolibarr.org/forum",
"wiki": "http://wiki.dolibarr.org"
"wiki": "http://wiki.dolibarr.org",
"irc": "irc://chat.freenode.net/dolibarr",
"source": "https://github.com/Dolibarr/dolibarr"
},
"require": {
"php": ">=5.3.0",
"ext-gd": "*",
"ext-curl": "*"
},
"suggest": {
"ext-mysqli": "*",
"ext-pgsql": "*",
"ext-mssql": "*",
"ext-pdo_sqlite": "*",
"ext-imagick": "*",
"ext-mcrypt": "*",
"ext-openssl": "*",
"ext-mbstring": "*",
"ext-soap": "*",
"ext-zip": "*",
"ext-xml": "*"
"ext-mysqlnd": "To use with MySQL or MariaDB",
"ext-mysqli": "To use with MySQL or MariaDB",
"ext-pgsql": "To use with PostgreSQL",
"ext-mssql": "To use with MSSQL (experimental)",
"ext-pdo_sqlite": "To use with SQLite (experimental)",
"ext-gd": "Image manipulation (Required but maybe built-in PHP)",
"ext-imagick": "Image manipulation (TCPDF)",
"ext-mcrypt": "(Required but maybe built-in PHP)",
"ext-openssl": "Secure connections (Emails, SOAP…)",
"ext-mbstring": "Handle non UTF-8 databases",
"ext-soap": "Native SOAP",
"ext-zip": "ODT and Excel support",
"ext-xml": "Excel support",
"firephp/firephp-core": "Logging to Firebug console support",
"raven/raven": "Sentry logging server support"
},
"config": {
"vendor-dir": "htdocs/includes"
}
}
12 changes: 6 additions & 6 deletions htdocs/accountancy/admin/card.php
Expand Up @@ -145,13 +145,13 @@

print '<table class="border" width="100%">';

print '<tr><td width="25%">' . $langs->trans("AccountNumber") . '</td>';
print '<tr><td width="25%"><span class="fieldrequired">' . $langs->trans("AccountNumber") . '</span></td>';
print '<td><input name="account_number" size="30" value="' . $accounting->account_number . '"</td></tr>';
print '<tr><td>' . $langs->trans("Label") . '</td>';
print '<tr><td><span class="fieldrequired">' . $langs->trans("Label") . '</span></td>';
print '<td><input name="label" size="70" value="' . $accounting->label . '"</td></tr>';
print '<tr><td>' . $langs->trans("Accountparent") . '</td>';
print '<td>';
print $htmlacc->select_account($accounting->account_parent, 'account_parent');
print $htmlacc->select_account($accounting->account_parent, 'account_parent', 1);
print '</td></tr>';
print '<tr><td>' . $langs->trans("Pcgtype") . '</td>';
print '<td>';
Expand Down Expand Up @@ -195,13 +195,13 @@

print '<table class="border" width="100%">';

print '<tr><td width="25%">' . $langs->trans("AccountNumber") . '</td>';
print '<tr><td width="25%"><span class="fieldrequired">' . $langs->trans("AccountNumber") . '</span></td>';
print '<td><input name="account_number" size="30" value="' . $accounting->account_number . '"</td></tr>';
print '<tr><td>' . $langs->trans("Label") . '</td>';
print '<tr><td><span class="fieldrequired">' . $langs->trans("Label") . '</span></td>';
print '<td><input name="label" size="70" value="' . $accounting->label . '"</td></tr>';
print '<tr><td>' . $langs->trans("Accountparent") . '</td>';
print '<td>';
print $htmlacc->select_account($accounting->account_parent, 'account_parent');
print $htmlacc->select_account($accounting->account_parent, 'account_parent', 1);
print '</td></tr>';
print '<tr><td>' . $langs->trans("Pcgtype") . '</td>';
print '<td>';
Expand Down
8 changes: 8 additions & 0 deletions htdocs/contrat/class/contrat.class.php
Expand Up @@ -8,6 +8,7 @@
* Copyright (C) 2013 Christophe Battarel <christophe.battarel@altairis.fr>
* Copyright (C) 2013 Florian Henry <florian.henry@open-concept.pro>
* Copyright (C) 2014-2015 Marcos García <marcosgdf@gmail.com>
* Copyright (C) 2015 Ferran Marcet <fmarcet@2byte.es>
*
* 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
Expand Down Expand Up @@ -1017,6 +1018,13 @@ function delete($user)
}
}

if (! $error)
{
// Delete linked object
$res = $this->deleteObjectLinked();
if ($res < 0) $error++;
}

if (! $error)
{
// Delete contratdet_log
Expand Down
12 changes: 6 additions & 6 deletions htdocs/core/class/html.form.class.php
Expand Up @@ -1579,13 +1579,13 @@ function select_produits_list($selected='',$htmlname='productid',$filtertype='',
foreach ($scrit as $crit)
{
if ($i > 0) $sql.=" AND ";
$sql.="(p.ref LIKE '".$prefix.$crit."%' OR p.label LIKE '".$prefix.$crit."%'";
if (! empty($conf->global->MAIN_MULTILANGS)) $sql.=" OR pl.label LIKE '".$prefix.$crit."%'";
$sql.="(p.ref LIKE '".$db->escape($prefix.$crit)."%' OR p.label LIKE '".$db->escape($prefix.$crit)."%'";
if (! empty($conf->global->MAIN_MULTILANGS)) $sql.=" OR pl.label LIKE '".$db->escape($prefix.$crit)."%'";
$sql.=")";
$i++;
}
if (count($scrit) > 1) $sql.=")";
if (! empty($conf->barcode->enabled)) $sql.= " OR p.barcode LIKE '".$prefix.$filterkey."%'";
if (! empty($conf->barcode->enabled)) $sql.= " OR p.barcode LIKE '".$db->escape($prefix.$filterkey)."%'";
$sql.=')';
}
$sql.= $db->order("p.ref");
Expand Down Expand Up @@ -1933,7 +1933,7 @@ function select_produits_fournisseurs_list($socid,$selected='',$htmlname='produc
$sql.= " LEFT JOIN ".MAIN_DB_PREFIX."societe as s ON pfp.fk_soc = s.rowid";
$sql.= " WHERE p.entity IN (".getEntity('product', 1).")";
$sql.= " AND p.tobuy = 1";
if (strval($filtertype) != '') $sql.=" AND p.fk_product_type=".$filtertype;
if (strval($filtertype) != '') $sql.=" AND p.fk_product_type=".$this->db->escape($filtertype);
if (! empty($filtre)) $sql.=" ".$filtre;
// Add criteria on ref/label
if ($filterkey != '')
Expand All @@ -1947,11 +1947,11 @@ function select_produits_fournisseurs_list($socid,$selected='',$htmlname='produc
foreach ($scrit as $crit)
{
if ($i > 0) $sql.=" AND ";
$sql.="(pfp.ref_fourn LIKE '".$prefix.$crit."%' OR p.ref LIKE '".$prefix.$crit."%' OR p.label LIKE '".$prefix.$crit."%')";
$sql.="(pfp.ref_fourn LIKE '".$this->db->escape($prefix.$crit)."%' OR p.ref LIKE '".$this->db->escape($prefix.$crit)."%' OR p.label LIKE '".$this->db->escape($prefix.$crit)."%')";
$i++;
}
if (count($scrit) > 1) $sql.=")";
if (! empty($conf->barcode->enabled)) $sql.= " OR p.barcode LIKE '".$prefix.$filterkey."%'";
if (! empty($conf->barcode->enabled)) $sql.= " OR p.barcode LIKE '".$this->db->escape($prefix.$filterkey)."%'";
$sql.=')';
}
$sql.= " ORDER BY pfp.ref_fourn DESC, pfp.quantity ASC";
Expand Down
2 changes: 1 addition & 1 deletion htdocs/core/modules/commande/doc/pdf_einstein.modules.php
Expand Up @@ -431,7 +431,7 @@ function write_file($object,$outputlangs,$srctemplatepath='',$hidedetails=0,$hid
$this->tva[$vatrate] += $tvaligne;

// Add line
if (! empty($conf->global->MAIN_PDF_DASH_BETWEEN_LINES) && $i < ($nblignes - 1))
if ($conf->global->MAIN_PDF_DASH_BETWEEN_LINES && $i < ($nblignes - 1))
{
$pdf->setPage($pageposafter);
$pdf->SetLineStyle(array('dash'=>'1,1','color'=>array(210,210,210)));
Expand Down
2 changes: 1 addition & 1 deletion htdocs/core/modules/commande/doc/pdf_proforma.modules.php
Expand Up @@ -429,7 +429,7 @@ function write_file($object,$outputlangs,$srctemplatepath='',$hidedetails=0,$hid
$this->tva[$vatrate] += $tvaligne;

// Add line
if (! empty($conf->global->MAIN_PDF_DASH_BETWEEN_LINES) && $i < ($nblignes - 1))
if ($conf->global->MAIN_PDF_DASH_BETWEEN_LINES && $i < ($nblignes - 1))
{
$pdf->setPage($pageposafter);
$pdf->SetLineStyle(array('dash'=>'1,1','color'=>array(210,210,210)));
Expand Down
2 changes: 1 addition & 1 deletion htdocs/core/modules/expedition/doc/pdf_merou.modules.php
Expand Up @@ -276,7 +276,7 @@ function write_file(&$object,$outputlangs,$srctemplatepath='',$hidedetails=0,$hi
$pdf->MultiCell(30, 3, $object->lines[$i]->qty_shipped, 0, 'C', 0);

// Add line
if (! empty($conf->global->MAIN_PDF_DASH_BETWEEN_LINES) && $i < ($nblignes - 1))
if ($conf->global->MAIN_PDF_DASH_BETWEEN_LINES && $i < ($nblignes - 1))
{
$pdf->setPage($pageposafter);
$pdf->SetLineStyle(array('dash'=>'1,1','color'=>array(210,210,210)));
Expand Down
2 changes: 1 addition & 1 deletion htdocs/core/modules/expedition/doc/pdf_rouget.modules.php
Expand Up @@ -290,7 +290,7 @@ function write_file(&$object,$outputlangs,$srctemplatepath='',$hidedetails=0,$hi
$pdf->MultiCell(($this->page_largeur - $this->marge_droite - $this->posxqtytoship), 3, $object->lines[$i]->qty_shipped,'','C');

// Add line
if (! empty($conf->global->MAIN_PDF_DASH_BETWEEN_LINES) && $i < ($nblignes - 1))
if ($conf->global->MAIN_PDF_DASH_BETWEEN_LINES && $i < ($nblignes - 1))
{
$pdf->setPage($pageposafter);
$pdf->SetLineStyle(array('dash'=>'1,1','color'=>array(210,210,210)));
Expand Down
2 changes: 1 addition & 1 deletion htdocs/core/modules/facture/doc/pdf_crabe.modules.php
Expand Up @@ -489,7 +489,7 @@ function write_file($object,$outputlangs,$srctemplatepath='',$hidedetails=0,$hid
if ($posYAfterImage > $posYAfterDescription) $nexY=$posYAfterImage;

// Add line
if (! empty($conf->global->MAIN_PDF_DASH_BETWEEN_LINES) && $i < ($nblignes - 1))
if ($conf->global->MAIN_PDF_DASH_BETWEEN_LINES && $i < ($nblignes - 1))
{
$pdf->setPage($pageposafter);
$pdf->SetLineStyle(array('dash'=>'1,1','color'=>array(210,210,210)));
Expand Down
2 changes: 1 addition & 1 deletion htdocs/core/modules/propale/doc/pdf_azur.modules.php
Expand Up @@ -520,7 +520,7 @@ function write_file($object,$outputlangs,$srctemplatepath='',$hidedetails=0,$hid
if ($posYAfterImage > $posYAfterDescription) $nexY=$posYAfterImage;

// Add line
if (! empty($conf->global->MAIN_PDF_DASH_BETWEEN_LINES) && $i < ($nblignes - 1))
if ($conf->global->MAIN_PDF_DASH_BETWEEN_LINES && $i < ($nblignes - 1))
{
$pdf->setPage($pageposafter);
$pdf->SetLineStyle(array('dash'=>'1,1','color'=>array(210,210,210)));
Expand Down
Expand Up @@ -396,7 +396,7 @@ function write_file($object, $outputlangs='', $srctemplatepath='', $hidedetails=
$this->localtax2[$localtax2rate]+=$localtax2ligne;

// Add line
if (! empty($conf->global->MAIN_PDF_DASH_BETWEEN_LINES) && $i < ($nblignes - 1))
if ($conf->global->MAIN_PDF_DASH_BETWEEN_LINES && $i < ($nblignes - 1))
{
$pdf->setPage($pageposafter);
$pdf->SetLineStyle(array('dash'=>'1,1','color'=>array(210,210,210)));
Expand Down
Expand Up @@ -420,7 +420,7 @@ function write_file($object,$outputlangs='',$srctemplatepath='',$hidedetails=0,$


// Add line
if (! empty($conf->global->MAIN_PDF_DASH_BETWEEN_LINES) && $i < ($nblignes - 1))
if ($conf->global->MAIN_PDF_DASH_BETWEEN_LINES && $i < ($nblignes - 1))
{
$pdf->setPage($pageposafter);
$pdf->SetLineStyle(array('dash'=>'1,1','color'=>array(210,210,210)));
Expand Down
7 changes: 6 additions & 1 deletion htdocs/filefunc.inc.php
Expand Up @@ -150,7 +150,11 @@
$tmp='';
$found=0;
$real_dolibarr_main_document_root=str_replace('\\','/',realpath($dolibarr_main_document_root)); // A) Value found into config file, to say where are store htdocs files. Ex: C:/xxx/dolibarr, C:/xxx/dolibarr/htdocs
$pathroot=$_SERVER["DOCUMENT_ROOT"]; // B) Value reported by web server setup, to say where is root of web server instance. Ex: C:/xxx/dolibarr, C:/xxx/dolibarr/htdocs
if (!empty($_SERVER["DOCUMENT_ROOT"])) {
$pathroot = $_SERVER["DOCUMENT_ROOT"]; // B) Value reported by web server setup, to say where is root of web server instance. Ex: C:/xxx/dolibarr, C:/xxx/dolibarr/htdocs
} else {
$pathroot = 'NOTDEFINED';
}
$paths=explode('/',str_replace('\\','/',$_SERVER["SCRIPT_NAME"])); // C) Value reported by web server, to say full path on filesystem of a file. Ex: /dolibarr/htdocs/admin/system/phpinfo.php
// Try to detect if $_SERVER["DOCUMENT_ROOT"]+start of $_SERVER["SCRIPT_NAME"] is $dolibarr_main_document_root. If yes, relative url to add before dol files is this start part.
$concatpath='';
Expand All @@ -169,6 +173,7 @@
}
//else print "Not found yet for concatpath=".$concatpath."<br>\n";
}
//print "found=".$found." dolibarr_main_url_root=".$dolibarr_main_url_root."\n";
if (! $found) $tmp=$dolibarr_main_url_root; // If autodetect fails (Ie: when using apache alias that point outside default DOCUMENT_ROOT).
else $tmp='http'.(((empty($_SERVER["HTTPS"]) || $_SERVER["HTTPS"] != 'on') && (empty($_SERVER["SERVER_PORT"])||$_SERVER["SERVER_PORT"]!=443))?'':'s').'://'.$_SERVER["SERVER_NAME"].((empty($_SERVER["SERVER_PORT"])||$_SERVER["SERVER_PORT"]==80||$_SERVER["SERVER_PORT"]==443)?'':':'.$_SERVER["SERVER_PORT"]).($tmp3?(preg_match('/^\//',$tmp3)?'':'/').$tmp3:'');
//print "tmp1=".$tmp1." tmp2=".$tmp2." tmp3=".$tmp3." tmp=".$tmp."\n";
Expand Down
3 changes: 2 additions & 1 deletion htdocs/product/ajax/products.php
Expand Up @@ -169,8 +169,9 @@

$match = preg_grep('/(' . $htmlname . '[0-9]+)/', array_keys($_GET));
sort($match);
$idprod = (! empty($match [0]) ? $match [0] : '');

$idprod = (! empty($match[0]) ? $match[0] : '');

if (! GETPOST($htmlname) && ! GETPOST($idprod))
return;

Expand Down
2 changes: 1 addition & 1 deletion htdocs/product/class/product.class.php
Expand Up @@ -2867,7 +2867,7 @@ function LibStatut($status,$mode=0,$type=0)
{
global $langs;
$langs->load('products');
if (!empty($conf->productbatch->enabled)) $langs->load("productbatch");
if (! empty($conf->productbatch->enabled)) $langs->load("productbatch");

if ($type == 2)
{
Expand Down
1 change: 1 addition & 0 deletions test/phpunit/AllTests.php
Expand Up @@ -30,6 +30,7 @@
//define('TEST_DB_FORCE_TYPE','mysql'); // This is to force using mysql driver
//require_once 'PHPUnit/Autoload.php';
require_once dirname(__FILE__).'/../../htdocs/master.inc.php';
print 'DOL_MAIN_URL_ROOT='.DOL_MAIN_URL_ROOT."\n"; // constant will be used by other tests

if ($langs->defaultlang != 'en_US')
{
Expand Down

0 comments on commit c65babf

Please sign in to comment.