2
0
forked from Wavyzz/dolibarr

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

Conflicts:
	htdocs/install/step1.php
	htdocs/projet/tasks/time.php
This commit is contained in:
Laurent Destailleur
2016-10-26 10:40:03 +02:00
15 changed files with 112 additions and 68 deletions

View File

@@ -1,7 +1,7 @@
Format: http://www.debian.org/doc/packaging-manuals/copyright-format/1.0/ Format: http://www.debian.org/doc/packaging-manuals/copyright-format/1.0/
Upstream-Name: Dolibarr Upstream-Name: Dolibarr
Upstream-Contact: Laurent Destailleur <eldy@users.sourceforge.net> Upstream-Contact: Laurent Destailleur <eldy@users.sourceforge.net>
Source: http://www.dolibarr.org/files/stable/standard/ Source: https://www.dolibarr.org/files/stable/standard/
Files: * Files: *
Copyright: 2002-2009, Rodolphe Quiedeville <rodolphe@quiedeville.org> Copyright: 2002-2009, Rodolphe Quiedeville <rodolphe@quiedeville.org>

View File

@@ -257,6 +257,7 @@ if (empty($reshook))
} }
$lastname=$_POST["lastname"]; $lastname=$_POST["lastname"];
$firstname=$_POST["firstname"]; $firstname=$_POST["firstname"];
$societe=$_POST["societe"];
$morphy=$_POST["morphy"]; $morphy=$_POST["morphy"];
$login=$_POST["login"]; $login=$_POST["login"];
if ($morphy != 'mor' && empty($lastname)) { if ($morphy != 'mor' && empty($lastname)) {

View File

@@ -268,7 +268,8 @@ class Utils
{ {
$i++; // output line number $i++; // output line number
$read = fgets($handlein); $read = fgets($handlein);
if ($i == 1 && preg_match('/'.preg_quote('Warning: Using a password').'/i', $read)) continue; // Exclude warning line we don't want
if ($i == 1 && preg_match('/Warning.*Using a password/i', $read)) continue;
fwrite($handle,$read); fwrite($handle,$read);
if (preg_match('/'.preg_quote('-- Dump completed').'/i',$read)) $ok=1; if (preg_match('/'.preg_quote('-- Dump completed').'/i',$read)) $ok=1;
elseif (preg_match('/'.preg_quote('SET SQL_NOTES=@OLD_SQL_NOTES').'/i',$read)) $ok=1; elseif (preg_match('/'.preg_quote('SET SQL_NOTES=@OLD_SQL_NOTES').'/i',$read)) $ok=1;

View File

@@ -7,7 +7,7 @@
* Copyright (C) 2004 Christophe Combelles <ccomb@free.fr> * Copyright (C) 2004 Christophe Combelles <ccomb@free.fr>
* Copyright (C) 2005-2012 Regis Houssin <regis.houssin@capnetworks.com> * Copyright (C) 2005-2012 Regis Houssin <regis.houssin@capnetworks.com>
* Copyright (C) 2008 Raphael Bertrand (Resultic) <raphael.bertrand@resultic.fr> * Copyright (C) 2008 Raphael Bertrand (Resultic) <raphael.bertrand@resultic.fr>
* Copyright (C) 2010-2014 Juanjo Menent <jmenent@2byte.es> * Copyright (C) 2010-2016 Juanjo Menent <jmenent@2byte.es>
* Copyright (C) 2013 Cédric Salvador <csalvador@gpcsolutions.fr> * Copyright (C) 2013 Cédric Salvador <csalvador@gpcsolutions.fr>
* Copyright (C) 2013 Alexandre Spangaro <aspangaro.dolibarr@gmail.com> * Copyright (C) 2013 Alexandre Spangaro <aspangaro.dolibarr@gmail.com>
* Copyright (C) 2014 Cédric GROSS <c.gross@kreiz-it.fr> * Copyright (C) 2014 Cédric GROSS <c.gross@kreiz-it.fr>
@@ -2500,9 +2500,9 @@ function img_printer($titlealt = "default", $other='')
/** /**
* Show help logo with cursor "?" * Show help logo with cursor "?"
* *
* @param string $usehelpcursor Use help cursor * @param int $usehelpcursor Use help cursor
* @param string $usealttitle Text to use as alt title * @param int|string $usealttitle Text to use as alt title
* @return string Retourne tag img * @return string Return tag img
*/ */
function img_help($usehelpcursor = 1, $usealttitle = 1) function img_help($usehelpcursor = 1, $usealttitle = 1)
{ {
@@ -3600,7 +3600,7 @@ function get_localtax($vatrate, $local, $thirdparty_buyer="", $thirdparty_seller
$vatratecleaned = $vatrate; $vatratecleaned = $vatrate;
if (preg_match('/^(.*)\s*\((.*)\)$/', $vatrate, $reg)) // If vat is "xx (yy)" if (preg_match('/^(.*)\s*\((.*)\)$/', $vatrate, $reg)) // If vat is "xx (yy)"
{ {
$vatratecleaned = $reg[1]; $vatratecleaned = trim($reg[1]);
$vatratecode = $reg[2]; $vatratecode = $reg[2];
} }
@@ -3614,7 +3614,7 @@ function get_localtax($vatrate, $local, $thirdparty_buyer="", $thirdparty_seller
{ {
if ($local == 1) if ($local == 1)
{ {
if (! $mysoc->localtax1_assuj) return 0; if (! $mysoc->localtax1_assuj || (string) $vatratecleaned == "0") return 0;
if ($thirdparty_seller->id == $mysoc->id) if ($thirdparty_seller->id == $mysoc->id)
{ {
if (! $thirdparty_buyer->localtax1_assuj) return 0; if (! $thirdparty_buyer->localtax1_assuj) return 0;
@@ -3627,7 +3627,7 @@ function get_localtax($vatrate, $local, $thirdparty_buyer="", $thirdparty_seller
if ($local == 2) if ($local == 2)
{ {
if (! $mysoc->localtax2_assuj) return 0; if (! $mysoc->localtax2_assuj || (string) $vatratecleaned == "0") return 0;
if ($thirdparty_seller->id == $mysoc->id) if ($thirdparty_seller->id == $mysoc->id)
{ {
if (! $thirdparty_buyer->localtax2_assuj) return 0; if (! $thirdparty_buyer->localtax2_assuj) return 0;
@@ -3899,7 +3899,7 @@ function getLocalTaxesFromRate($vatrate, $local, $buyer, $seller, $firstparamisi
* @param int $idprod Id of product or 0 if not a predefined product * @param int $idprod Id of product or 0 if not a predefined product
* @param Societe $thirdparty_seller Thirdparty with a ->country_code defined (FR, US, IT, ...) * @param Societe $thirdparty_seller Thirdparty with a ->country_code defined (FR, US, IT, ...)
* @param int $idprodfournprice Id product_fournisseur_price (for "supplier" order/invoice) * @param int $idprodfournprice Id product_fournisseur_price (for "supplier" order/invoice)
* @return int <0 if KO, Vat rate if OK * @return float Vat rate
* @see get_product_localtax_for_country * @see get_product_localtax_for_country
*/ */
function get_product_vat_for_country($idprod, $thirdparty_seller, $idprodfournprice=0) function get_product_vat_for_country($idprod, $thirdparty_seller, $idprodfournprice=0)
@@ -4049,7 +4049,7 @@ function get_product_localtax_for_country($idprod, $local, $thirdparty_seller)
* @param Societe $thirdparty_buyer Objet societe acheteuse * @param Societe $thirdparty_buyer Objet societe acheteuse
* @param int $idprod Id product * @param int $idprod Id product
* @param int $idprodfournprice Id product_fournisseur_price (for supplier order/invoice) * @param int $idprodfournprice Id product_fournisseur_price (for supplier order/invoice)
* @return float Taux de tva a appliquer, -1 si ne peut etre determine * @return float Vat rate to use, -1 if we can't guess it
* @see get_default_npr, get_default_localtax * @see get_default_npr, get_default_localtax
*/ */
function get_default_tva(Societe $thirdparty_seller, Societe $thirdparty_buyer, $idprod=0, $idprodfournprice=0) function get_default_tva(Societe $thirdparty_seller, Societe $thirdparty_buyer, $idprod=0, $idprodfournprice=0)
@@ -4598,7 +4598,7 @@ function dol_nboflines_bis($text,$maxlinesize=0,$charset='UTF-8')
else $pattern = '/(<br[^>]*>)/U'; // /U is to have UNGREEDY regex to limit to one html tag. else $pattern = '/(<br[^>]*>)/U'; // /U is to have UNGREEDY regex to limit to one html tag.
$a = preg_split($pattern, $text, -1, PREG_SPLIT_DELIM_CAPTURE | PREG_SPLIT_NO_EMPTY); $a = preg_split($pattern, $text, -1, PREG_SPLIT_DELIM_CAPTURE | PREG_SPLIT_NO_EMPTY);
$nblines = floor((count($a)+1)/2); $nblines = (int) floor((count($a)+1)/2);
// count possible auto line breaks // count possible auto line breaks
if($maxlinesize) if($maxlinesize)
{ {

View File

@@ -64,6 +64,10 @@ class ExportExcel extends ModeleExports
$this->picto='mime/xls'; // Picto $this->picto='mime/xls'; // Picto
$this->version='1.30'; // Driver version $this->version='1.30'; // Driver version
$this->disabled = (in_array(constant('PHPEXCEL_PATH'),array('disabled','disabled/'))?1:0); // A condition to disable module (used for native debian packages)
if (empty($this->disabled))
{
// If driver use an external library, put its name here // If driver use an external library, put its name here
if (! empty($conf->global->MAIN_USE_PHP_WRITEEXCEL)) if (! empty($conf->global->MAIN_USE_PHP_WRITEEXCEL))
{ {
@@ -80,8 +84,7 @@ class ExportExcel extends ModeleExports
$this->label_lib='PhpExcel'; $this->label_lib='PhpExcel';
$this->version_lib='1.8.0'; // No way to get info from library $this->version_lib='1.8.0'; // No way to get info from library
} }
}
$this->disabled = (in_array(constant('PHPEXCEL_PATH'),array('disabled','disabled/'))?1:0); // A condition to disable module (used for native debian packages)
$this->row=0; $this->row=0;
} }

View File

@@ -64,6 +64,10 @@ class ExportExcel2007 extends ExportExcel
$this->picto='mime/xls'; // Picto $this->picto='mime/xls'; // Picto
$this->version='1.30'; // Driver version $this->version='1.30'; // Driver version
$this->disabled = (in_array(constant('PHPEXCEL_PATH'),array('disabled','disabled/'))?1:0); // A condition to disable module (used for native debian packages)
if (empty($this->disabled))
{
// If driver use an external library, put its name here // If driver use an external library, put its name here
if (! empty($conf->global->MAIN_USE_PHP_WRITEEXCEL)) if (! empty($conf->global->MAIN_USE_PHP_WRITEEXCEL))
{ {
@@ -80,8 +84,7 @@ class ExportExcel2007 extends ExportExcel
$this->label_lib='PhpExcel'; $this->label_lib='PhpExcel';
$this->version_lib='1.8.0'; // No way to get info from library $this->version_lib='1.8.0'; // No way to get info from library
} }
}
$this->disabled = (in_array(constant('PHPEXCEL_PATH'),array('disabled','disabled/'))?1:0); // A condition to disable module (used for native debian packages)
$this->row=0; $this->row=0;
} }

View File

@@ -65,10 +65,12 @@ class ModeleExports extends CommonDocGenerator // This class can't be abstrac
$moduleid=$reg[1]; $moduleid=$reg[1];
// Loading Class // Loading Class
$file = $dir."/export_".$moduleid.".modules.php"; $file = $dir."export_".$moduleid.".modules.php";
$classname = "Export".ucfirst($moduleid); $classname = "Export".ucfirst($moduleid);
require_once $file; require_once $file;
if (class_exists($classname))
{
$module = new $classname($db); $module = new $classname($db);
// Picto // Picto
@@ -80,7 +82,7 @@ class ModeleExports extends CommonDocGenerator // This class can't be abstrac
// If use an external lib // If use an external lib
$this->liblabel[$module->id]=$module->getLibLabel(); $this->liblabel[$module->id]=$module->getLibLabel();
$this->libversion[$module->id]=$module->getLibVersion(); $this->libversion[$module->id]=$module->getLibVersion();
}
$i++; $i++;
} }
} }

View File

@@ -73,8 +73,6 @@ $fieldstosearchall = array(
'd.firstname'=>'Firstname', 'd.firstname'=>'Firstname',
); );
/* /*
* View * View
*/ */
@@ -115,6 +113,12 @@ if (trim($search_name) != '')
if ($search_amount) $sql.= natural_search(array('d.amount'), price2num(trim($search_amount)), 1); if ($search_amount) $sql.= natural_search(array('d.amount'), price2num(trim($search_amount)), 1);
$sql.= $db->order($sortfield,$sortorder); $sql.= $db->order($sortfield,$sortorder);
$nbtotalofrecords = 0;
if (empty($conf->global->MAIN_DISABLE_FULL_SCANLIST))
{
$result = $db->query($sql);
$nbtotalofrecords = $db->num_rows($result);
}
$sql.= $db->plimit($limit+1, $offset); $sql.= $db->plimit($limit+1, $offset);
$resql = $db->query($sql); $resql = $db->query($sql);
@@ -124,18 +128,18 @@ if ($resql)
$i = 0; $i = 0;
$param = '&statut='.$statut; $param = '&statut='.$statut;
if ($page > 0) $param.= '&page='.$page; //if ($page > 0) $param.= '&page='.$page;
if ($optioncss != '') $param.='&optioncss='.$optioncss; if ($optioncss != '') $param.='&optioncss='.$optioncss;
if ($statut >= 0) if ($statut >= 0)
{ {
$donationstatic->statut=$statut; $donationstatic->statut=$statut;
$label=$donationstatic->getLibStatut(0); $label=$donationstatic->getLibStatut(0);
print_barre_liste($label, $page, $_SERVER["PHP_SELF"], $param, $sortfield, $sortorder, '', $num); print_barre_liste($langs->trans("Donations"), $page, $_SERVER["PHP_SELF"], $param, $sortfield, $sortorder, '', $num,$nbtotalofrecords);
} }
else else
{ {
print_barre_liste($langs->trans("Donations"), $page, $_SERVER["PHP_SELF"], $param, $sortfield, $sortorder, '', $num); print_barre_liste($langs->trans("Donations"), $page, $_SERVER["PHP_SELF"], $param, $sortfield, $sortorder, '', $num,$nbtotalofrecords);
} }
@@ -200,7 +204,7 @@ if ($resql)
$var=True; $var=True;
while ($i < min($num,$limit)) while ($i < min($num,$limit))
{ {
$objp = $db->fetch_object($result); $objp = $db->fetch_object($resql);
$var=!$var; $var=!$var;
print "<tr ".$bc[$var].">"; print "<tr ".$bc[$var].">";
$donationstatic->id=$objp->rowid; $donationstatic->id=$objp->rowid;

View File

@@ -1967,6 +1967,7 @@ class Expedition extends CommonObject
*/ */
function set_billed() function set_billed()
{ {
global $user;
$error=0; $error=0;
$this->db->begin(); $this->db->begin();

View File

@@ -946,6 +946,7 @@ if ($action == 'create')
if ($socid > 0) if ($socid > 0)
{ {
$soc=new Societe($db);
$soc->fetch($socid); $soc->fetch($socid);
print '<form name="fichinter" action="'.$_SERVER['PHP_SELF'].'" method="POST">'; print '<form name="fichinter" action="'.$_SERVER['PHP_SELF'].'" method="POST">';

View File

@@ -48,7 +48,8 @@
*/ */
// include class for decoding filters // include class for decoding filters
require_once(dirname(__FILE__).'/../tecnickcom/tcpdf/include/tcpdf_filters.php'); if (defined('TCPDF_PATH')) require_once(constant('TCPDF_PATH').'/include/tcpdf_filters.php');
else require_once(dirname(__FILE__).'/../tecnickcom/tcpdf/include/tcpdf_filters.php');
if (!defined ('PDF_TYPE_NULL')) if (!defined ('PDF_TYPE_NULL'))
define ('PDF_TYPE_NULL', 0); define ('PDF_TYPE_NULL', 0);

View File

@@ -211,9 +211,9 @@ if (! empty($id) || ! empty($ref) || GETPOST('id') == 'all')
//print '<table width="100%">'; //print '<table width="100%">';
// Generation des graphs // Generation des graphs
$dir = (! empty($conf->product->multidir_temp[$object->entity])?$conf->product->multidir_temp[$object->entity]:$conf->service->multidir_temp[$object->entity]);
if ($object->id > 0) // We are on statistics for a dedicated product if ($object->id > 0) // We are on statistics for a dedicated product
{ {
$dir = (! empty($conf->product->multidir_temp[$object->entity])?$conf->product->multidir_temp[$object->entity]:$conf->service->multidir_temp[$object->entity]);
if (! file_exists($dir.'/'.$object->id)) if (! file_exists($dir.'/'.$object->id))
{ {
if (dol_mkdir($dir.'/'.$object->id) < 0) if (dol_mkdir($dir.'/'.$object->id) < 0)

View File

@@ -59,6 +59,8 @@ class Task extends CommonObject
var $timespent_fk_user; var $timespent_fk_user;
var $timespent_note; var $timespent_note;
public $oldcopy;
/** /**
* Constructor * Constructor
@@ -317,6 +319,30 @@ class Task extends CommonObject
} }
} }
if (! $error && (is_object($this->oldcopy) && $this->oldcopy->ref !== $this->ref))
{
// We remove directory
if ($conf->projet->dir_output)
{
$project = new Project($this->db);
$project->fetch($this->fk_project);
$olddir = $conf->projet->dir_output.'/'.dol_sanitizeFileName($project->ref).'/'.dol_sanitizeFileName($this->oldcopy->ref);
$newdir = $conf->projet->dir_output.'/'.dol_sanitizeFileName($project->ref).'/'.dol_sanitizeFileName($this->ref);
if (file_exists($olddir))
{
include_once DOL_DOCUMENT_ROOT . '/core/lib/files.lib.php';
$res=dol_move($olddir, $newdir);
if (! $res)
{
$langs->load("errors");
$this->error=$langs->trans('ErrorFailToRenameDir',$olddir,$newdir);
$error++;
}
}
}
}
// Commit or rollback // Commit or rollback
if ($error) if ($error)
{ {

View File

@@ -82,6 +82,7 @@ if ($action == 'update' && ! $_POST["cancel"] && $user->rights->projet->creer)
if (! $error) if (! $error)
{ {
$object->fetch($id,$ref); $object->fetch($id,$ref);
$object->oldcopy = clone $object;
$tmparray=explode('_',$_POST['task_parent']); $tmparray=explode('_',$_POST['task_parent']);
$task_parent=$tmparray[1]; $task_parent=$tmparray[1];