2
0
forked from Wavyzz/dolibarr

Merge remote-tracking branch 'origin/3.7' into develop

Conflicts:
	htdocs/commande/card.php
	htdocs/compta/facture.php
	htdocs/compta/facture/class/facture.class.php
	htdocs/core/class/commonobject.class.php
	htdocs/core/modules/expedition/modules_expedition.php
	htdocs/core/modules/modContrat.class.php
	htdocs/expedition/class/expedition.class.php
This commit is contained in:
Laurent Destailleur
2015-05-07 13:35:09 +02:00
13 changed files with 88 additions and 46 deletions

View File

@@ -943,8 +943,8 @@ if (empty($reshook))
// Define vat_rate
$vat_rate = (GETPOST('tva_tx') ? GETPOST('tva_tx') : 0);
$vat_rate = str_replace('*', '', $vat_rate);
$localtax1_rate = get_localtax($vat_rate, 1, $object->thirdparty);
$localtax2_rate = get_localtax($vat_rate, 2, $object->thirdparty);
$localtax1_rate = get_localtax($vat_rate, 1, $object->thirdparty, $mysoc);
$localtax2_rate = get_localtax($vat_rate, 2, $object->thirdparty, $mysoc);
$pu_ht = GETPOST('price_ht');
// Add buying price

View File

@@ -590,7 +590,7 @@ class Propal extends CommonObject
{
global $mysoc;
dol_syslog(get_class($this)."::updateLine $rowid, $pu, $qty, $remise_percent, $txtva, $desc, $price_base_type, $info_bits");
dol_syslog(get_class($this)."::updateLine rowid=$rowid, pu=$pu, qty=$qty, remise_percent=$remise_percent, txtva=$txtva, desc=$desc, price_base_type=$price_base_type, info_bits=$info_bits, special_code=$special_code, fk_parent_line=$fk_parent_line, pa_ht=$a_ht, type=$type, date_start=$date_start, date_end=$date_end");
include_once DOL_DOCUMENT_ROOT.'/core/lib/price.lib.php';
// Clean parameters
@@ -615,7 +615,7 @@ class Propal extends CommonObject
$localtaxes_type=getLocalTaxesFromRate($txtva,0,$this->thirdparty,$mysoc);
$tabprice=calcul_price_total($qty, $pu, $remise_percent, $txtva, $txlocaltax1, $txlocaltax2, 0, $price_base_type, $info_bits, $type,'', $localtaxes_type);
$tabprice=calcul_price_total($qty, $pu, $remise_percent, $txtva, $txlocaltax1, $txlocaltax2, 0, $price_base_type, $info_bits, $type, $mysoc, $localtaxes_type);
$total_ht = $tabprice[0];
$total_tva = $tabprice[1];
$total_ttc = $tabprice[2];
@@ -709,7 +709,8 @@ class Propal extends CommonObject
}
else
{
$this->error=$this->db->error();
$this->error=$this->line->error;
$this->db->rollback();
return -1;
}

View File

@@ -545,7 +545,8 @@ if (empty($reshook))
}
// Add a new line
else if ($action == 'addline' && $user->rights->commande->creer) {
else if ($action == 'addline' && $user->rights->commande->creer)
{
$langs->load('errors');
$error = 0;
@@ -805,7 +806,7 @@ if (empty($reshook))
/*
* Update a line
*/
else if ($action == 'updateline' && $user->rights->commande->creer && GETPOST('save') == $langs->trans('Save'))
else if ($action == 'updateline' && $user->rights->commande->creer && GETPOST('save'))
{
// Clean parameters
$date_start='';
@@ -821,10 +822,10 @@ if (empty($reshook))
if (preg_match('/\*/', $vat_rate))
$info_bits |= 0x01;
// Define vat_rate
// Define vat_rate
$vat_rate = str_replace('*', '', $vat_rate);
$localtax1_rate = get_localtax($vat_rate, 1, $object->thirdparty);
$localtax2_rate = get_localtax($vat_rate, 2, $object->thirdparty);
$localtax1_rate = get_localtax($vat_rate, 1, $object->thirdparty, $mysoc);
$localtax2_rate = get_localtax($vat_rate, 2, $object->thirdparty, $mysoc);
// Add buying price
$fournprice = (GETPOST('fournprice') ? GETPOST('fournprice') : '');
@@ -841,6 +842,10 @@ if (empty($reshook))
}
}
// Define special_code for special lines
$special_code=GETPOST('special_code');
if (! GETPOST('qty')) $special_code=3;
// Check minimum price
$productid = GETPOST('productid', 'int');
if (! empty($productid)) {
@@ -871,7 +876,7 @@ if (empty($reshook))
}
if (! $error) {
$result = $object->updateline(GETPOST('lineid'), $description, $pu_ht, GETPOST('qty'), GETPOST('remise_percent'), $vat_rate, $localtax1_rate, $localtax2_rate, 'HT', $info_bits, $date_start, $date_end, $type, GETPOST('fk_parent_line'), 0, $fournprice, $buyingprice, $label, 0, $array_options, GETPOST('units'));
$result = $object->updateline(GETPOST('lineid'), $description, $pu_ht, GETPOST('qty'), GETPOST('remise_percent'), $vat_rate, $localtax1_rate, $localtax2_rate, 'HT', $info_bits, $date_start, $date_end, $type, GETPOST('fk_parent_line'), 0, $fournprice, $buyingprice, $label, $special_code, $array_options, GETPOST('units'));
if ($result >= 0) {
if (empty($conf->global->MAIN_DISABLE_PDF_AUTOUPDATE)) {

View File

@@ -2436,7 +2436,7 @@ class Commande extends CommonOrder
{
global $conf, $mysoc;
dol_syslog(get_class($this)."::updateline $rowid, $desc, $pu, $qty, $remise_percent, $txtva, $txlocaltax1, $txlocaltax2, $price_base_type, $info_bits, $date_start, $date_end, $type");
dol_syslog(get_class($this)."::updateline id=$rowid, desc=$desc, pu=$pu, qty=$qty, remise_percent=$remise_percent, txtva=$txtva, txlocaltax1=$txlocaltax1, txlocaltax2=$txlocaltax2, price_base_type=$price_base_type, info_bits=$info_bits, date_start=$date_start, date_end=$date_end, type=$type, fk_parent_line=$fk_parent_line, pa_ht=$pa_ht, special_code=$special_code");
include_once DOL_DOCUMENT_ROOT.'/core/lib/price.lib.php';
if (! empty($this->brouillon))
@@ -2468,7 +2468,7 @@ class Commande extends CommonOrder
$localtaxes_type=getLocalTaxesFromRate($txtva,0,$this->thirdparty, $mysoc);
$tabprice=calcul_price_total($qty, $pu, $remise_percent, $txtva, $txlocaltax1, $txlocaltax2, 0, $price_base_type, $info_bits, $type, '', $localtaxes_type);
$tabprice=calcul_price_total($qty, $pu, $remise_percent, $txtva, $txlocaltax1, $txlocaltax2, 0, $price_base_type, $info_bits, $type, $mysoc, $localtaxes_type);
$total_ht = $tabprice[0];
$total_tva = $tabprice[1];
$total_ttc = $tabprice[2];

View File

@@ -1484,7 +1484,7 @@ if (empty($reshook))
if (preg_match('/\*/', $vat_rate))
$info_bits |= 0x01;
// Define vat_rate
// Define vat_rate
$vat_rate = str_replace('*', '', $vat_rate);
$localtax1_rate = get_localtax($vat_rate, 1, $object->thirdparty);
$localtax2_rate = get_localtax($vat_rate, 2, $object->thirdparty);
@@ -1505,6 +1505,10 @@ if (empty($reshook))
}
}
// Define special_code for special lines
$special_code=GETPOST('special_code');
if (! GETPOST('qty')) $special_code=3;
$line = new FactureLigne($db);
$line->fetch(GETPOST('lineid'));
$percent = $line->get_prev_progress();
@@ -1557,7 +1561,7 @@ if (empty($reshook))
if (! $error) {
$result = $object->updateline(GETPOST('lineid'), $description, $pu_ht, $qty, GETPOST('remise_percent'),
$date_start, $date_end, $vat_rate, $localtax1_rate, $localtax2_rate, 'HT', $info_bits, $type,
GETPOST('fk_parent_line'), 0, $fournprice, $buyingprice, $label, 0, $array_options, GETPOST('progress'),
GETPOST('fk_parent_line'), 0, $fournprice, $buyingprice, $label, $special_code, $array_options, GETPOST('progress'),
$_POST['units']);
if ($result >= 0) {

View File

@@ -2293,7 +2293,7 @@ class Facture extends CommonInvoice
global $mysoc;
dol_syslog(get_class($this)."::updateline $rowid, $desc, $pu, $qty, $remise_percent, $date_start, $date_end, $txtva, $txlocaltax1, $txlocaltax2, $price_base_type, $info_bits, $type, $fk_parent_line, $fk_unit", LOG_DEBUG);
dol_syslog(get_class($this)."::updateline rowid=$rowid, desc=$desc, pu=$pu, qty=$qty, remise_percent=$remise_percent, date_start=$date_start, date_end=$date_end, txtva=$txtva, txlocaltax1=$txlocaltax1, txlocaltax2=$txlocaltax2, price_base_type=$price_base_type, info_bits=$info_bits, type=$type, fk_parent_line=$fk_parent_line pa_ht=$pa_ht, special_code=$special_code fk_unit=$fk_unit", LOG_DEBUG);
if ($this->brouillon)
{
@@ -2322,7 +2322,8 @@ class Facture extends CommonInvoice
$localtaxes_type=getLocalTaxesFromRate($txtva,0,$this->thirdparty, $mysoc);
$tabprice=calcul_price_total($qty, $pu, $remise_percent, $txtva, $txlocaltax1, $txlocaltax2, 0, $price_base_type, $info_bits, $type,'',$localtaxes_type, $situation_percent);
$tabprice=calcul_price_total($qty, $pu, $remise_percent, $txtva, $txlocaltax1, $txlocaltax2, 0, $price_base_type, $info_bits, $type, $mysoc, $localtaxes_type, $situation_percent);
$total_ht = $tabprice[0];
$total_tva = $tabprice[1];
$total_ttc = $tabprice[2];

View File

@@ -209,8 +209,7 @@ class HookManager
// 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

@@ -143,14 +143,17 @@ abstract class ModelNumRefExpedition
}
/**
* Cree un bon d'expedition sur disque
* Create a document onto disk according to template module.
*
* @param DoliDB $db Objet base de donnee
* @param Expedition $object Object expedition
* @param string $modele Force le modele a utiliser ('' to not force)
* @param Translate $outputlangs Objet lang a utiliser pour traduction
* @return int <=0 if KO, >0 if OK
* @deprecated Use the new function generateDocument of Expedition class
* @param DoliDB $db Objet base de donnee
* @param Object $object Object expedition
* @param string $modele Force le modele a utiliser ('' to not force)
* @param Translate $outputlangs Objet lang a utiliser pour traduction
* @param int $hidedetails Hide details of lines
* @param int $hidedesc Hide description
* @param int $hideref Hide ref
* @return int 1 if OK -1 if KO
* @deprecated Use the new function generateDocument of Expedition class
*/
function expedition_pdf_create(DoliDB $db, Expedition $object, $modele, $outputlangs, $hidedetails=0, $hidedesc=0, $hideref=0)
{

View File

@@ -41,7 +41,7 @@ class modContrat extends DolibarrModules
*/
function __construct($db)
{
global $conf, $langs;
global $conf;
$this->db = $db;
$this->numero = 54;
@@ -118,12 +118,10 @@ class modContrat extends DolibarrModules
// Exports
//--------
$langs->load("contracts");
$r=1;
$this->export_code[$r]=$this->rights_class.'_'.$r;
$this->export_label[$r]=$langs->trans('ContractsAndLine'); // Translation key (used only if key ExportDataset_xxx_z not found)
$this->export_label[$r]='ContractsAndLine'; // Translation key (used only if key ExportDataset_xxx_z not found)
$this->export_icon[$r]='contract';
$this->export_permission[$r]=array(array("contrat","export"));
$this->export_fields_array[$r]=array('s.rowid'=>"IdCompany",'s.nom'=>'CompanyName','s.address'=>'Address','s.zip'=>'Zip','s.town'=>'Town','c.code'=>'CountryCode',

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>
* Copyright (C) 2012 Cedric Salvador <csalvador@gpcsolutions.fr>
*
@@ -169,28 +169,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

@@ -1639,7 +1639,7 @@ class Expedition extends CommonObject
}
/**
* Create a document onto disk accordign to template module.
* Create a document onto disk according to template module.
*
* @param string $modele Force the model to using ('' to not force)
* @param Translate $outputlangs object lang to use for translations

View File

@@ -74,12 +74,12 @@ SuppliersCategoryShort=Tags/catégories de fournisseurs
CustomersCategoryShort=Tags/catégories de clients
ProductsCategoryShort=Tags/catégories de produits
MembersCategoryShort=Tags/catégories de membres
SuppliersCategoriesShort=Tags/catégories de fournisseurs
SuppliersCategoriesShort=Tags fournisseurs
CustomersCategoriesShort=Tags/catégories de clients
CustomersProspectsCategoriesShort=Tags clients/prosp.
ProductsCategoriesShort=Tags/catégories de produits
MembersCategoriesShort=Tags/catégories de membres
ContactCategoriesShort=Tags/catégories de contacts
ContactCategoriesShort=Tags de contacts
ThisCategoryHasNoProduct=Ce tag/catégorie ne contient aucun produit.
ThisCategoryHasNoSupplier=Ce tag/catégorie ne contient aucun fournisseur.
ThisCategoryHasNoCustomer=Ce tag/catégorie ne contient aucun client.

View File

@@ -1537,7 +1537,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 )
{