Merge remote-tracking branch 'dolibarr/3.7' into 3.7

This commit is contained in:
Regis Houssin 2015-05-07 11:44:36 +02:00
commit 9ed658ab8f
7 changed files with 53 additions and 23 deletions

View File

@ -201,13 +201,10 @@ class HookManager
if (! empty($actionclassinstance->results) && is_array($actionclassinstance->results)) $this->resArray =array_merge($this->resArray, $actionclassinstance->results);
if (! empty($actionclassinstance->resprints)) $this->resPrint.=$actionclassinstance->resprints;
// TODO dead code to remove (do not enable this, but fix hook instead)
//if (is_array($result)) $this->resArray = array_merge($this->resArray, $result);
// TODO dead code to remove (do not enable this, but fix hook instead): result must not be a string. we must use $actionclassinstance->resprints to return a string
if (! is_array($result) && ! is_numeric($result))
{
//print 'Error: Bug into module '.get_class($actionclassinstance).' hook must not return a string but an int and set string into ->resprints';
dol_syslog('Error: Bug into module '.get_class($actionclassinstance).' hook must not return a string but an int and set string into ->resprints', LOG_ERR);
dol_syslog('Error: Bug into hook '.$method.' of module class '.get_class($actionclassinstance).'. Method must not return a string but an int (0=OK, 1=Replace, -1=KO) and set string into ->resprints', LOG_ERR);
if (empty($actionclassinstance->resprints)) { $this->resPrint.=$result; $result=0; }
}
}

View File

@ -3,6 +3,7 @@
* Copyright (C) 2008-2012 Regis Houssin <regis.houssin@capnetworks.com>
* Copyright (C) 2008 Raphael Bertrand (Resultic) <raphael.bertrand@resultic.fr>
* Copyright (C) 2014 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
@ -589,6 +590,7 @@ function get_next_value($db,$mask,$table,$field,$where='',$objsoc='',$date='',$m
global $conf;
if (! is_object($objsoc)) $valueforccc=$objsoc;
else if($table == "commande_fournisseur" || $table == "facture_fourn" ) $valueforccc=$objsoc->code_fournisseur;
else $valueforccc=$objsoc->code_client;
// Clean parameters

View File

@ -152,7 +152,7 @@ abstract class ModelNumRefExpedition
* @return int <=0 if KO, >0 if OK
* @deprecated Use the new function generateDocument of Expedition class
*/
function expedition_pdf_create(DoliDB $db, Expedition $object, $modele, $outputlangs)
function expedition_pdf_create(DoliDB $db, Expedition $object, $modele, $outputlangs, $hidedetails=0, $hidedesc=0, $hideref=0)
{
return $object->generateDocument($modele, $outputlangs);
return $object->generateDocument($modele, $outputlangs, $hidedetails, $hidedesc, $hideref);
}

View File

@ -2,7 +2,7 @@
/* Copyright (C) 2004-2014 Laurent Destailleur <eldy@users.sourceforge.net>
* Copyright (C) 2005-2012 Regis Houssin <regis.houssin@capnetworks.com>
* Copyright (C) 2008 Raphael Bertrand <raphael.bertrand@resultic.fr>
* Copyright (C) 2010-2014 Juanjo Menent <jmenent@2byte.es>
* Copyright (C) 2010-2015 Juanjo Menent <jmenent@2byte.es>
* Copyright (C) 2012 Christophe Battarel <christophe.battarel@altairis.fr>
*
* This program is free software; you can redistribute it and/or modify
@ -158,28 +158,60 @@ class pdf_azur extends ModelePDFPropales
$realpatharray=array();
if (! empty($conf->global->MAIN_GENERATE_PROPOSALS_WITH_PICTURE))
{
$objphoto = new Product($this->db);
for ($i = 0 ; $i < $nblignes ; $i++)
{
if (empty($object->lines[$i]->fk_product)) continue;
$objphoto = new Product($this->db);
$objphoto->fetch($object->lines[$i]->fk_product);
$pdir = get_exdir($object->lines[$i]->fk_product,2) . $object->lines[$i]->fk_product ."/photos/";
$dir = $conf->product->dir_output.'/'.$pdir;
$realpath='';
foreach ($objphoto->liste_photos($dir,1) as $key => $obj)
if (! empty($conf->global->PRODUCT_USE_OLD_PATH_FOR_PHOTO))
{
$filename=$obj['photo'];
//if ($obj['photo_vignette']) $filename='thumbs/'.$obj['photo_vignette'];
$realpath = $dir.$filename;
break;
$pdir[0] = get_exdir($objphoto->id,2) . $objphoto->id ."/photos/";
$pdir[1] = dol_sanitizeFileName($objphoto->ref).'/';
}
else
{
$pdir[0] = dol_sanitizeFileName($objphoto->ref).'/';
$pdir[1] = get_exdir($objphoto->id,2) . $objphoto->id ."/photos/";
}
if ($realpath) $realpatharray[$i]=$realpath;
$arephoto = false;
foreach ($pdir as $midir)
{
if (! $arephoto)
{
$dir = $conf->product->dir_output.'/'.$midir;
foreach ($objphoto->liste_photos($dir,1) as $key => $obj)
{
if (empty($conf->global->CAT_HIGH_QUALITY_IMAGES)) // If CAT_HIGH_QUALITY_IMAGES not defined, we use thumb if defined and then original photo
{
if ($obj['photo_vignette'])
{
$filename= $obj['photo_vignette'];
}
else
{
$filename=$obj['photo'];
}
}
else
{
$filename=$obj['photo'];
}
$realpath = $dir.$filename;
$arephoto = true;
}
}
}
if ($realpath && $arephoto) $realpatharray[$i]=$realpath;
}
}
if (count($realpatharray) == 0) $this->posxpicture=$this->posxtva;
if ($conf->propal->dir_output)

View File

@ -381,7 +381,7 @@ if (empty($reshook))
$outputlangs = new Translate("",$conf);
$outputlangs->setDefaultLang($newlang);
}
$result = $object->generateDocument($object->modelpdf, $outputlangs);
$result = $object->generateDocument($object->modelpdf, $outputlangs, $hidedetails, $hidedesc, $hideref);
if ($result <= 0)
{
dol_print_error($db,$result);

View File

@ -1604,7 +1604,7 @@ class Expedition extends CommonObject
* @param Translate $outputlangs Objet lang a utiliser pour traduction
* @return int <=0 if KO, >0 if OK
*/
public function generateDocument($modele, $outputlangs)
public function generateDocument($modele, $outputlangs,$hidedetails=0, $hidedesc=0, $hideref=0)
{
global $conf,$user,$langs;
@ -1627,7 +1627,7 @@ class Expedition extends CommonObject
$this->fetch_origin();
return $this->commonGenerateDocument($modelpath, $modele, $outputlangs, 0, 0, 0);
return $this->commonGenerateDocument($modelpath, $modele, $outputlangs, $hidedetails, $hidedesc, $hideref);
}
}

View File

@ -1423,7 +1423,6 @@ class Product extends CommonObject
else if ($ref_ext) $sql.= " AND ref_ext = '".$this->db->escape($ref_ext)."'";
}
dol_syslog(get_class($this)."::fetch", LOG_DEBUG);
$resql = $this->db->query($sql);
if ( $resql )
{
@ -3170,7 +3169,7 @@ class Product extends CommonObject
function is_photo_available($sdir)
{
include_once DOL_DOCUMENT_ROOT .'/core/lib/files.lib.php';
global $conf;
$dir = $sdir;