Merge branch '5.0' of git@github.com:Dolibarr/dolibarr.git into develop
Conflicts: htdocs/compta/bank/class/account.class.php htdocs/core/class/html.formfile.class.php htdocs/core/lib/functions.lib.php htdocs/filefunc.inc.php htdocs/install/mysql/tables/llx_bank_account.sql
This commit is contained in:
commit
30cf3f2bda
@ -9,7 +9,7 @@
|
||||
* Copyright (C) 2012 Cedric Salvador <csalvador@gpcsolutions.fr>
|
||||
* Copyright (C) 2013 Florian Henry <florian.henry@open-concept.pro>
|
||||
* Copyright (C) 2014-2015 Marcos García <marcosgdf@gmail.com>
|
||||
* Copyright (C) 2016 Ferran Marcet <fmarcet@2byte.es>
|
||||
* Copyright (C) 2016-2017 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
|
||||
@ -136,6 +136,7 @@ class Commande extends CommonOrder
|
||||
public $linked_objects=array();
|
||||
|
||||
public $user_author_id;
|
||||
public $user_valid;
|
||||
|
||||
/**
|
||||
* @var OrderLine[]
|
||||
@ -1542,7 +1543,7 @@ class Commande extends CommonOrder
|
||||
// Check parameters
|
||||
if (empty($id) && empty($ref) && empty($ref_ext) && empty($ref_int)) return -1;
|
||||
|
||||
$sql = 'SELECT c.rowid, c.date_creation, c.ref, c.fk_soc, c.fk_user_author, c.fk_statut';
|
||||
$sql = 'SELECT c.rowid, c.date_creation, c.ref, c.fk_soc, c.fk_user_author, c.fk_user_valid, c.fk_statut';
|
||||
$sql.= ', c.amount_ht, c.total_ht, c.total_ttc, c.tva as total_tva, c.localtax1 as total_localtax1, c.localtax2 as total_localtax2, c.fk_cond_reglement, c.fk_mode_reglement, c.fk_availability, c.fk_input_reason';
|
||||
$sql.= ', c.fk_account';
|
||||
$sql.= ', c.date_commande';
|
||||
@ -1586,6 +1587,7 @@ class Commande extends CommonOrder
|
||||
$this->socid = $obj->fk_soc;
|
||||
$this->statut = $obj->fk_statut;
|
||||
$this->user_author_id = $obj->fk_user_author;
|
||||
$this->user_valid = $obj->fk_user_valid;
|
||||
$this->total_ht = $obj->total_ht;
|
||||
$this->total_tva = $obj->total_tva;
|
||||
$this->total_localtax1 = $obj->total_localtax1;
|
||||
@ -3004,8 +3006,8 @@ class Commande extends CommonOrder
|
||||
$sql.= " total_ht=".(isset($this->total_ht)?$this->total_ht:"null").",";
|
||||
$sql.= " total_ttc=".(isset($this->total_ttc)?$this->total_ttc:"null").",";
|
||||
$sql.= " fk_statut=".(isset($this->statut)?$this->statut:"null").",";
|
||||
$sql.= " fk_user_author=".(isset($this->user_author)?$this->user_author:"null").",";
|
||||
$sql.= " fk_user_valid=".(isset($this->fk_user_valid)?$this->fk_user_valid:"null").",";
|
||||
$sql.= " fk_user_author=".(isset($this->user_author_id)?$this->user_author_id:"null").",";
|
||||
$sql.= " fk_user_valid=".(isset($this->user_valid)?$this->user_valid:"null").",";
|
||||
$sql.= " fk_projet=".(isset($this->fk_project)?$this->fk_project:"null").",";
|
||||
$sql.= " fk_cond_reglement=".(isset($this->cond_reglement_id)?$this->cond_reglement_id:"null").",";
|
||||
$sql.= " fk_mode_reglement=".(isset($this->mode_reglement_id)?$this->mode_reglement_id:"null").",";
|
||||
|
||||
@ -1360,7 +1360,7 @@ class Account extends CommonObject
|
||||
{
|
||||
$country_code=$this->getCountryCode();
|
||||
|
||||
if (in_array($country_code,array('CH','FR','ES','GA','IT'))) return 1; // France, Spain, Gabon, ...
|
||||
if (in_array($country_code,array('CH','FR','ES','GA','IT','NC'))) return 1; // France, Spain, Gabon, ...
|
||||
if (in_array($country_code,array('AU','BE','CA','DE','DK','GR','GB','ID','IE','IR','KR','NL','NZ','UK','US'))) return 2; // Australia, England...
|
||||
return 0;
|
||||
}
|
||||
|
||||
@ -169,11 +169,16 @@ class FactureRec extends CommonInvoice
|
||||
$num=count($facsrc->lines);
|
||||
for ($i = 0; $i < $num; $i++)
|
||||
{
|
||||
$result_insert = $this->addline(
|
||||
$tva_tx = $facsrc->lines[$i]->tva_tx;
|
||||
if (! empty($facsrc->lines[$i]->vat_src_code) && ! preg_match('/\(/', $tva_tx)) $tva_tx .= ' ('.$facsrc->lines[$i]->vat_src_code.')';
|
||||
|
||||
$result_insert = $this->addline(
|
||||
$facsrc->lines[$i]->desc,
|
||||
$facsrc->lines[$i]->subprice,
|
||||
$facsrc->lines[$i]->qty,
|
||||
$facsrc->lines[$i]->tva_tx,
|
||||
$tva_tx,
|
||||
$facsrc->lines[$i]->localtax1_tx,
|
||||
$facsrc->lines[$i]->localtax2_tx,
|
||||
$facsrc->lines[$i]->fk_product,
|
||||
$facsrc->lines[$i]->remise_percent,
|
||||
'HT',
|
||||
@ -243,7 +248,8 @@ class FactureRec extends CommonInvoice
|
||||
*/
|
||||
function fetch($rowid, $ref='', $ref_ext='', $ref_int='')
|
||||
{
|
||||
$sql = 'SELECT f.rowid, f.entity, f.titre, f.fk_soc, f.amount, f.tva, f.total, f.total_ttc, f.remise_percent, f.remise_absolue, f.remise';
|
||||
$sql = 'SELECT f.rowid, f.entity, f.titre, f.fk_soc, f.amount, f.tva, f.localtax1, f.localtax2, f.total, f.total_ttc';
|
||||
$sql.= ', f.remise_percent, f.remise_absolue, f.remise';
|
||||
$sql.= ', f.date_lim_reglement as dlr';
|
||||
$sql.= ', f.note_private, f.note_public, f.fk_user_author';
|
||||
$sql.= ', f.fk_mode_reglement, f.fk_cond_reglement, f.fk_projet';
|
||||
@ -284,6 +290,8 @@ class FactureRec extends CommonInvoice
|
||||
$this->remise = $obj->remise;
|
||||
$this->total_ht = $obj->total;
|
||||
$this->total_tva = $obj->tva;
|
||||
$this->total_localtax1 = $obj->localtax1;
|
||||
$this->total_localtax2 = $obj->localtax2;
|
||||
$this->total_ttc = $obj->total_ttc;
|
||||
$this->paye = $obj->paye;
|
||||
$this->close_code = $obj->close_code;
|
||||
@ -364,8 +372,8 @@ class FactureRec extends CommonInvoice
|
||||
{
|
||||
$this->lines=array();
|
||||
|
||||
$sql = 'SELECT l.rowid, l.fk_product, l.product_type, l.label as custom_label, l.description, l.product_type, l.price, l.qty, l.tva_tx, ';
|
||||
$sql.= ' l.remise, l.remise_percent, l.subprice,';
|
||||
$sql = 'SELECT l.rowid, l.fk_product, l.product_type, l.label as custom_label, l.description, l.product_type, l.price, l.qty, l.vat_src_code, l.tva_tx, ';
|
||||
$sql.= ' l.localtax1_tx, l.localtax2_tx, l.localtax1_type, l.localtax2_type, l.remise, l.remise_percent, l.subprice,';
|
||||
$sql.= ' l.info_bits, l.total_ht, l.total_tva, l.total_ttc,';
|
||||
//$sql.= ' l.situation_percent, l.fk_prev_id,';
|
||||
//$sql.= ' l.localtax1_tx, l.localtax2_tx, l.localtax1_type, l.localtax2_type, l.remise_percent, l.fk_remise_except, l.subprice,';
|
||||
@ -404,7 +412,13 @@ class FactureRec extends CommonInvoice
|
||||
$line->fk_product_type = $objp->fk_product_type; // Type of product
|
||||
$line->qty = $objp->qty;
|
||||
$line->subprice = $objp->subprice;
|
||||
|
||||
$line->vat_src_code = $objp->vat_src_code;
|
||||
$line->tva_tx = $objp->tva_tx;
|
||||
$line->localtax1_tx = $objp->localtax1_tx;
|
||||
$line->localtax2_tx = $objp->localtax2_tx;
|
||||
$line->localtax1_type = $objp->localtax1_type;
|
||||
$line->localtax2_type = $objp->localtax2_type;
|
||||
$line->remise_percent = $objp->remise_percent;
|
||||
$line->fk_remise_except = $objp->fk_remise_except;
|
||||
$line->fk_product = $objp->fk_product;
|
||||
@ -493,6 +507,8 @@ class FactureRec extends CommonInvoice
|
||||
* @param double $pu_ht Prix unitaire HT (> 0 even for credit note)
|
||||
* @param double $qty Quantite
|
||||
* @param double $txtva Taux de tva force, sinon -1
|
||||
* @param double $txlocaltax1 Local tax 1 rate (deprecated)
|
||||
* @param double $txlocaltax2 Local tax 2 rate (deprecated)
|
||||
* @param int $fk_product Id du produit/service predefini
|
||||
* @param double $remise_percent Pourcentage de remise de la ligne
|
||||
* @param string $price_base_type HT or TTC
|
||||
@ -506,29 +522,40 @@ class FactureRec extends CommonInvoice
|
||||
* @param string $fk_unit Unit
|
||||
* @return int <0 if KO, Id of line if OK
|
||||
*/
|
||||
function addline($desc, $pu_ht, $qty, $txtva, $fk_product=0, $remise_percent=0, $price_base_type='HT', $info_bits=0, $fk_remise_except='', $pu_ttc=0, $type=0, $rang=-1, $special_code=0, $label='', $fk_unit=null)
|
||||
function addline($desc, $pu_ht, $qty, $txtva, $txlocaltax1=0, $txlocaltax2=0, $fk_product=0, $remise_percent=0, $price_base_type='HT', $info_bits=0, $fk_remise_except='', $pu_ttc=0, $type=0, $rang=-1, $special_code=0, $label='', $fk_unit=null)
|
||||
{
|
||||
global $mysoc;
|
||||
|
||||
$facid=$this->id;
|
||||
|
||||
dol_syslog(get_class($this)."::addline facid=$facid,desc=$desc,pu_ht=$pu_ht,qty=$qty,txtva=$txtva,fk_product=$fk_product,remise_percent=$remise_percent,info_bits=$info_bits,fk_remise_except=$fk_remise_except,price_base_type=$price_base_type,pu_ttc=$pu_ttc,type=$type,fk_unit=$fk_unit", LOG_DEBUG);
|
||||
dol_syslog(get_class($this)."::addline facid=$facid,desc=$desc,pu_ht=$pu_ht,qty=$qty,txtva=$txtva,txlocaltax1=$txlocaltax1,txlocaltax2=$txlocaltax2,fk_product=$fk_product,remise_percent=$remise_percent,info_bits=$info_bits,fk_remise_except=$fk_remise_except,price_base_type=$price_base_type,pu_ttc=$pu_ttc,type=$type,fk_unit=$fk_unit", LOG_DEBUG);
|
||||
include_once DOL_DOCUMENT_ROOT.'/core/lib/price.lib.php';
|
||||
|
||||
// Check parameters
|
||||
if ($type < 0) return -1;
|
||||
|
||||
$localtaxes_type=getLocalTaxesFromRate($txtva, 0, $this->thirdparty, $mysoc);
|
||||
|
||||
// Clean vat code
|
||||
$vat_src_code='';
|
||||
if (preg_match('/\((.*)\)/', $txtva, $reg))
|
||||
{
|
||||
$vat_src_code = $reg[1];
|
||||
$txtva = preg_replace('/\s*\(.*\)/', '', $txtva); // Remove code into vatrate.
|
||||
}
|
||||
|
||||
if ($this->brouillon)
|
||||
{
|
||||
// Clean parameters
|
||||
$remise_percent=price2num($remise_percent);
|
||||
if (empty($remise_percent)) $remise_percent=0;
|
||||
$qty=price2num($qty);
|
||||
if (! $qty) $qty=1;
|
||||
if (! $info_bits) $info_bits=0;
|
||||
$pu_ht=price2num($pu_ht);
|
||||
$pu_ttc=price2num($pu_ttc);
|
||||
$txtva=price2num($txtva);
|
||||
$txlocaltax1 = price2num($txlocaltax1);
|
||||
$txlocaltax2 = price2num($txlocaltax2);
|
||||
|
||||
if ($price_base_type=='HT')
|
||||
{
|
||||
@ -543,10 +570,14 @@ class FactureRec extends CommonInvoice
|
||||
// qty, pu, remise_percent et txtva
|
||||
// TRES IMPORTANT: C'est au moment de l'insertion ligne qu'on doit stocker
|
||||
// la part ht, tva et ttc, et ce au niveau de la ligne qui a son propre taux tva.
|
||||
$tabprice=calcul_price_total($qty, $pu, $remise_percent, $txtva, 0, 0, 0, $price_base_type, $info_bits, $type, $mysoc);
|
||||
|
||||
|
||||
$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];
|
||||
$total_localtax1=$tabprice[9];
|
||||
$total_localtax2=$tabprice[10];
|
||||
|
||||
$product_type=$type;
|
||||
if ($fk_product)
|
||||
@ -563,6 +594,11 @@ class FactureRec extends CommonInvoice
|
||||
$sql.= ", price";
|
||||
$sql.= ", qty";
|
||||
$sql.= ", tva_tx";
|
||||
$sql.= ", vat_src_code";
|
||||
$sql.= ", localtax1_tx";
|
||||
$sql.= ", localtax1_type";
|
||||
$sql.= ", localtax2_tx";
|
||||
$sql.= ", localtax2_type";
|
||||
$sql.= ", fk_product";
|
||||
$sql.= ", product_type";
|
||||
$sql.= ", remise_percent";
|
||||
@ -570,6 +606,8 @@ class FactureRec extends CommonInvoice
|
||||
$sql.= ", remise";
|
||||
$sql.= ", total_ht";
|
||||
$sql.= ", total_tva";
|
||||
$sql.= ", total_localtax1";
|
||||
$sql.= ", total_localtax2";
|
||||
$sql.= ", total_ttc";
|
||||
$sql.= ", rang";
|
||||
$sql.= ", special_code";
|
||||
@ -581,6 +619,11 @@ class FactureRec extends CommonInvoice
|
||||
$sql.= ", ".price2num($pu_ht);
|
||||
$sql.= ", ".price2num($qty);
|
||||
$sql.= ", ".price2num($txtva);
|
||||
$sql.= ", '".$this->db->escape($vat_src_code)."'";
|
||||
$sql.= ", ".price2num($txlocaltax1);
|
||||
$sql.= ", '".$this->db->escape($localtaxes_type[0])."'";
|
||||
$sql.= ", ".price2num($txlocaltax2);
|
||||
$sql.= ", '".$this->db->escape($localtaxes_type[2])."'";
|
||||
$sql.= ", ".(! empty($fk_product)?"'".$fk_product."'":"null");
|
||||
$sql.= ", ".$product_type;
|
||||
$sql.= ", ".price2num($remise_percent);
|
||||
@ -588,6 +631,8 @@ class FactureRec extends CommonInvoice
|
||||
$sql.= ", null";
|
||||
$sql.= ", ".price2num($total_ht);
|
||||
$sql.= ", ".price2num($total_tva);
|
||||
$sql.= ", ".price2num($total_localtax1);
|
||||
$sql.= ", ".price2num($total_localtax2);
|
||||
$sql.= ", ".price2num($total_ttc);
|
||||
$sql.= ", ".$rang;
|
||||
$sql.= ", ".$special_code;
|
||||
@ -616,6 +661,8 @@ class FactureRec extends CommonInvoice
|
||||
* @param double $pu_ht Prix unitaire HT (> 0 even for credit note)
|
||||
* @param double $qty Quantite
|
||||
* @param double $txtva Taux de tva force, sinon -1
|
||||
* @param double $txlocaltax1 Local tax 1 rate (deprecated)
|
||||
* @param double $txlocaltax2 Local tax 2 rate (deprecated)
|
||||
* @param int $fk_product Id du produit/service predefini
|
||||
* @param double $remise_percent Pourcentage de remise de la ligne
|
||||
* @param string $price_base_type HT or TTC
|
||||
@ -629,28 +676,39 @@ class FactureRec extends CommonInvoice
|
||||
* @param string $fk_unit Unit
|
||||
* @return int <0 if KO, Id of line if OK
|
||||
*/
|
||||
function updateline($rowid, $desc, $pu_ht, $qty, $txtva, $fk_product=0, $remise_percent=0, $price_base_type='HT', $info_bits=0, $fk_remise_except='', $pu_ttc=0, $type=0, $rang=-1, $special_code=0, $label='', $fk_unit=null)
|
||||
function updateline($rowid, $desc, $pu_ht, $qty, $txtva, $txlocaltax1=0, $txlocaltax2=0, $fk_product=0, $remise_percent=0, $price_base_type='HT', $info_bits=0, $fk_remise_except='', $pu_ttc=0, $type=0, $rang=-1, $special_code=0, $label='', $fk_unit=null)
|
||||
{
|
||||
global $mysoc;
|
||||
|
||||
$facid=$this->id;
|
||||
|
||||
dol_syslog(get_class($this)."::updateline facid=".$facid." rowid=$rowid,desc=$desc,pu_ht=$pu_ht,qty=$qty,txtva=$txtva,fk_product=$fk_product,remise_percent=$remise_percent,info_bits=$info_bits,fk_remise_except=$fk_remise_except,price_base_type=$price_base_type,pu_ttc=$pu_ttc,type=$type,fk_unit=$fk_unit", LOG_DEBUG);
|
||||
dol_syslog(get_class($this)."::updateline facid=".$facid." rowid=$rowid,desc=$desc,pu_ht=$pu_ht,qty=$qty,txtva=$txtva,txlocaltax1=$txlocaltax1,txlocaltax2=$txlocaltax2,fk_product=$fk_product,remise_percent=$remise_percent,info_bits=$info_bits,fk_remise_except=$fk_remise_except,price_base_type=$price_base_type,pu_ttc=$pu_ttc,type=$type,fk_unit=$fk_unit", LOG_DEBUG);
|
||||
include_once DOL_DOCUMENT_ROOT.'/core/lib/price.lib.php';
|
||||
|
||||
// Check parameters
|
||||
if ($type < 0) return -1;
|
||||
|
||||
|
||||
$localtaxes_type=getLocalTaxesFromRate($txtva, 0, $this->thirdparty, $mysoc);
|
||||
|
||||
// Clean vat code
|
||||
$vat_src_code='';
|
||||
if (preg_match('/\((.*)\)/', $txtva, $reg))
|
||||
{
|
||||
$vat_src_code = $reg[1];
|
||||
$txtva = preg_replace('/\s*\(.*\)/', '', $txtva); // Remove code into vatrate.
|
||||
}
|
||||
|
||||
if ($this->brouillon)
|
||||
{
|
||||
// Clean parameters
|
||||
$remise_percent=price2num($remise_percent);
|
||||
$qty=price2num($qty);
|
||||
if (! $qty) $qty=1;
|
||||
if (! $info_bits) $info_bits=0;
|
||||
$pu_ht=price2num($pu_ht);
|
||||
$pu_ttc=price2num($pu_ttc);
|
||||
$txtva=price2num($txtva);
|
||||
$txlocaltax1 = price2num($txlocaltax1);
|
||||
$txlocaltax2 = price2num($txlocaltax2);
|
||||
|
||||
if ($price_base_type=='HT')
|
||||
{
|
||||
@ -665,10 +723,13 @@ class FactureRec extends CommonInvoice
|
||||
// qty, pu, remise_percent et txtva
|
||||
// TRES IMPORTANT: C'est au moment de l'insertion ligne qu'on doit stocker
|
||||
// la part ht, tva et ttc, et ce au niveau de la ligne qui a son propre taux tva.
|
||||
$tabprice=calcul_price_total($qty, $pu, $remise_percent, $txtva, 0, 0, 0, $price_base_type, $info_bits, $type, $mysoc);
|
||||
$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];
|
||||
$total_localtax1=$tabprice[9];
|
||||
$total_localtax2=$tabprice[10];
|
||||
|
||||
$product_type=$type;
|
||||
if ($fk_product)
|
||||
@ -685,18 +746,25 @@ class FactureRec extends CommonInvoice
|
||||
$sql.= ", price=".price2num($pu_ht);
|
||||
$sql.= ", qty=".price2num($qty);
|
||||
$sql.= ", tva_tx=".price2num($txtva);
|
||||
$sql.= ", vat_src_code='".$this->db->escape($vat_src_code)."'";
|
||||
$sql.= ", localtax1_tx=".price2num($txlocaltax1);
|
||||
$sql.= ", localtax1_type='".$this->db->escape($localtaxes_type[0])."'";
|
||||
$sql.= ", localtax2_tx=".price2num($txlocaltax2);
|
||||
$sql.= ", localtax2_type='".$this->db->escape($localtaxes_type[2])."'";
|
||||
$sql.= ", fk_product=".(! empty($fk_product)?"'".$fk_product."'":"null");
|
||||
$sql.= ", product_type=".$product_type;
|
||||
$sql.= ", remise_percent='".price2num($remise_percent)."'";
|
||||
$sql.= ", subprice='".price2num($pu_ht)."'";
|
||||
$sql.= ", total_ht='".price2num($total_ht)."'";
|
||||
$sql.= ", total_tva='".price2num($total_tva)."'";
|
||||
$sql.= ", total_localtax1='".price2num($total_localtax1)."'";
|
||||
$sql.= ", total_localtax2='".price2num($total_localtax2)."'";
|
||||
$sql.= ", total_ttc='".price2num($total_ttc)."'";
|
||||
$sql.= ", rang=".$rang;
|
||||
$sql.= ", special_code=".$special_code;
|
||||
$sql.= ", fk_unit=".($fk_unit?"'".$this->db->escape($fk_unit)."'":"null");
|
||||
$sql.= " WHERE rowid = ".$rowid;
|
||||
|
||||
|
||||
dol_syslog(get_class($this)."::updateline", LOG_DEBUG);
|
||||
if ($this->db->query($sql))
|
||||
{
|
||||
|
||||
@ -615,7 +615,7 @@ if (empty($reshook))
|
||||
else
|
||||
{
|
||||
// Insert line
|
||||
$result = $object->addline($desc, $pu_ht, $qty, $tva_tx, $idprod, $remise_percent, $price_base_type, $info_bits, '', $pu_ttc, $type, - 1, $special_code, $label, $fk_unit);
|
||||
$result = $object->addline($desc, $pu_ht, $qty, $tva_tx,$localtax1_tx, $localtax2_tx, $idprod, $remise_percent, $price_base_type, $info_bits, '', $pu_ttc, $type, - 1, $special_code, $label, $fk_unit);
|
||||
|
||||
if ($result > 0)
|
||||
{
|
||||
@ -787,7 +787,9 @@ if (empty($reshook))
|
||||
$description,
|
||||
$pu_ht,
|
||||
$qty,
|
||||
$vat_rate,
|
||||
$vat_rate,
|
||||
$localtax1_rate,
|
||||
$localtax1_rate,
|
||||
GETPOST('productid'),
|
||||
GETPOST('remise_percent'),
|
||||
'HT',
|
||||
@ -1180,9 +1182,23 @@ else
|
||||
|
||||
print '<tr><td>'.$langs->trans("AmountVAT").'</td><td colspan="3">'.price($object->total_tva,'',$langs,1,-1,-1,$conf->currency).'</td>';
|
||||
print '</tr>';
|
||||
|
||||
// Amount Local Taxes
|
||||
if (($mysoc->localtax1_assuj == "1" && $mysoc->useLocalTax(1)) || $object->total_localtax1 != 0) // Localtax1
|
||||
{
|
||||
print '<tr><td>' . $langs->transcountry("AmountLT1", $mysoc->country_code) . '</td>';
|
||||
print '<td class="nowrap">' . price($object->total_localtax1, 1, '', 1, - 1, - 1, $conf->currency) . '</td></tr>';
|
||||
}
|
||||
if (($mysoc->localtax2_assuj == "1" && $mysoc->useLocalTax(2)) || $object->total_localtax2 != 0) // Localtax2
|
||||
{
|
||||
print '<tr><td>' . $langs->transcountry("AmountLT2", $mysoc->country_code) . '</td>';
|
||||
print '<td class=nowrap">' . price($object->total_localtax2, 1, '', 1, - 1, - 1, $conf->currency) . '</td></tr>';
|
||||
}
|
||||
|
||||
print '<tr><td>'.$langs->trans("AmountTTC").'</td><td colspan="3">'.price($object->total_ttc,'',$langs,1,-1,-1,$conf->currency).'</td>';
|
||||
print '</tr>';
|
||||
|
||||
|
||||
// Payment term
|
||||
print '<tr><td>';
|
||||
print '<table class="nobordernopadding" width="100%"><tr><td>';
|
||||
|
||||
@ -6041,7 +6041,7 @@ class Form
|
||||
{
|
||||
if ($addlinktofullsize)
|
||||
{
|
||||
$urladvanced=getAdvancedPreviewUrl($modulepart, $originalfile);
|
||||
$urladvanced=getAdvancedPreviewUrl($modulepart, $originalfile, 0, '&entity='.$entity);
|
||||
if ($urladvanced) $ret.='<a href="'.$urladvanced.'">';
|
||||
else $ret.='<a href="'.DOL_URL_ROOT.'/viewimage.php?modulepart='.$modulepart.'&entity='.$entity.'&file='.urlencode($originalfile).'&cache='.$cache.'">';
|
||||
}
|
||||
@ -6052,7 +6052,7 @@ class Form
|
||||
{
|
||||
if ($addlinktofullsize)
|
||||
{
|
||||
$urladvanced=getAdvancedPreviewUrl($modulepart, $originalfile);
|
||||
$urladvanced=getAdvancedPreviewUrl($modulepart, $originalfile, 0, '&entity='.$entity);
|
||||
if ($urladvanced) $ret.='<a href="'.$urladvanced.'">';
|
||||
else $ret.='<a href="'.DOL_URL_ROOT.'/viewimage.php?modulepart='.$modulepart.'&entity='.$entity.'&file='.urlencode($originalfile).'&cache='.$cache.'">';
|
||||
}
|
||||
|
||||
@ -710,7 +710,7 @@ class FormFile
|
||||
|
||||
// Show file name with link to download
|
||||
$out.= '<td class="tdoverflowmax300">';
|
||||
$tmp = $this->showPreview($file,$modulepart,$relativepath);
|
||||
$tmp = $this->showPreview($file,$modulepart,$relativepath,0,$param);
|
||||
$out.= ($tmp?$tmp.' ':'');
|
||||
$out.= '<a href="'.$documenturl.'?modulepart='.$modulepart.'&file='.urlencode($relativepath).($param?'&'.$param:'').'"';
|
||||
$mime=dol_mimetype($relativepath,'',0);
|
||||
@ -873,7 +873,7 @@ class FormFile
|
||||
// Preview
|
||||
if (! empty($conf->use_javascript_ajax) && ($conf->browser->layout != 'phone'))
|
||||
{
|
||||
$tmparray = getAdvancedPreviewUrl($modulepart, $relativepath, 1);
|
||||
$tmparray = getAdvancedPreviewUrl($modulepart, $relativepath, 1, '&entity='.$entity);
|
||||
if ($tmparray && $tmparray['url']) $tmpout.= '<li><a href="'.$tmparray['url'].'"'.($tmparray['css']?' class="'.$tmparray['css'].'"':'').($tmparray['mime']?' mime="'.$tmparray['mime'].'"':'').($tmparray['target']?' target="'.$tmparray['target'].'"':'').'>'.img_picto('','detail').' '.$langs->trans("Preview").' '.$ext.'</a></li>';
|
||||
}
|
||||
|
||||
@ -1161,7 +1161,7 @@ class FormFile
|
||||
if (! dol_is_file($file['path'].'/'.$minifile)) $minifile=getImageFileNameForSize($file['name'], '_mini', '.png'); // For backward compatibility of old thumbs that were created with filename in lower case and with .png extension
|
||||
//print $file['path'].'/'.$minifile.'<br>';
|
||||
|
||||
$urlforhref=getAdvancedPreviewUrl($modulepart, $relativepath.$fileinfo['filename'].'.'.strtolower($fileinfo['extension']));
|
||||
$urlforhref=getAdvancedPreviewUrl($modulepart, $relativepath.$fileinfo['filename'].'.'.strtolower($fileinfo['extension']), 0, '&entity='.(!empty($object->entity)?$object->entity:$conf->entity));
|
||||
if (empty($urlforhref)) $urlforhref=DOL_URL_ROOT.'/viewimage.php?modulepart='.$modulepart.'&entity='.(!empty($object->entity)?$object->entity:$conf->entity).'&file='.urlencode($relativepath.$fileinfo['filename'].'.'.strtolower($fileinfo['extension']));
|
||||
print '<a href="'.$urlforhref.'" class="aphoto" target="_blank">';
|
||||
print '<img border="0" height="'.$maxheightmini.'" src="'.DOL_URL_ROOT.'/viewimage.php?modulepart='.$modulepart.'&entity='.(!empty($object->entity)?$object->entity:$conf->entity).'&file='.urlencode($relativepath.$minifile).'" title="">';
|
||||
@ -1677,16 +1677,17 @@ class FormFile
|
||||
* @param string $modulepart propal, facture, facture_fourn, ...
|
||||
* @param string $relativepath Relative path of docs
|
||||
* @param string $ruleforpicto Rule for picto: 0=Preview picto, 1=Use picto of mime type of file)
|
||||
* @param string $param More param on http links
|
||||
* @return string $out Output string with HTML
|
||||
*/
|
||||
public function showPreview($file, $modulepart, $relativepath, $ruleforpicto=0)
|
||||
public function showPreview($file, $modulepart, $relativepath, $ruleforpicto=0, $param='')
|
||||
{
|
||||
global $langs, $conf;
|
||||
|
||||
$out='';
|
||||
if ($conf->browser->layout != 'phone')
|
||||
{
|
||||
$urladvancedpreview=getAdvancedPreviewUrl($modulepart, $relativepath, 1); // Return if a file is qualified for preview.
|
||||
$urladvancedpreview=getAdvancedPreviewUrl($modulepart, $relativepath, 1, $param); // Return if a file is qualified for preview.
|
||||
if (count($urladvancedpreview))
|
||||
{
|
||||
$out.= '<a class="pictopreview '.$urladvancedpreview['css'].'" href="'.$urladvancedpreview['url'].'"'.(empty($urladvancedpreview['mime'])?'':' mime="'.$urladvancedpreview['mime'].'"').' '.(empty($urladvancedpreview['target'])?'':' target="'.$urladvancedpreview['target'].'"').'>';
|
||||
|
||||
@ -467,7 +467,7 @@ class Translate
|
||||
if (! $found && ! empty($conf->global->MAIN_ENABLE_OVERWRITE_TRANSLATION))
|
||||
{
|
||||
// Overwrite translation with database read
|
||||
$sql="SELECT transkey, transvalue FROM ".MAIN_DB_PREFIX."overwrite_trans where lang='".$this->defaultlang."'";
|
||||
$sql="SELECT transkey, transvalue FROM ".MAIN_DB_PREFIX."overwrite_trans where lang='".$db->escape($this->defaultlang)."'";
|
||||
$resql=$db->query($sql);
|
||||
|
||||
if ($resql)
|
||||
|
||||
@ -6047,9 +6047,10 @@ function getImageFileNameForSize($file, $extName, $extImgTarget='')
|
||||
* @param string $modulepart propal, facture, facture_fourn, ...
|
||||
* @param string $relativepath Relative path of docs.
|
||||
* @param int $alldata Return array with all components (1 is recommended, then use a simple a href link with the class, target and mime attribute added. 'documentpreview' css class is handled by jquery code into main.inc.php)
|
||||
* @param string $param More param on http links
|
||||
* @return string|array Output string with href link or array with all components of link
|
||||
*/
|
||||
function getAdvancedPreviewUrl($modulepart, $relativepath, $alldata=0)
|
||||
function getAdvancedPreviewUrl($modulepart, $relativepath, $alldata=0, $param='')
|
||||
{
|
||||
global $conf, $langs;
|
||||
|
||||
@ -6067,7 +6068,7 @@ function getAdvancedPreviewUrl($modulepart, $relativepath, $alldata=0)
|
||||
}
|
||||
|
||||
// old behavior
|
||||
if ($num_mime !== false) return 'javascript:document_preview(\''.dol_escape_js(DOL_URL_ROOT.'/document.php?modulepart='.$modulepart.'&attachment=0&file='.urlencode($relativepath)).'\', \''.dol_mimetype($relativepath).'\', \''.dol_escape_js($langs->trans('Preview')).'\')';
|
||||
if ($num_mime !== false) return 'javascript:document_preview(\''.dol_escape_js(DOL_URL_ROOT.'/document.php?modulepart='.$modulepart.'&attachment=0&file='.urlencode($relativepath).($param?'&'.$param:'')).'\', \''.dol_mimetype($relativepath).'\', \''.dol_escape_js($langs->trans('Preview')).'\')';
|
||||
else return '';
|
||||
}
|
||||
|
||||
|
||||
@ -30,7 +30,7 @@ require_once DOL_DOCUMENT_ROOT.'/core/lib/date.lib.php';
|
||||
|
||||
|
||||
/**
|
||||
* Classe permettant de generer les projets au modele Baleine
|
||||
* Classe permettant de generer les projets au modele SEPAMandate
|
||||
*/
|
||||
|
||||
class pdf_sepamandate extends ModeleBankAccountDoc
|
||||
|
||||
@ -33,6 +33,8 @@ UPDATE llx_const SET name = __ENCRYPT('THIRDPARTY_DEFAULT_CREATE_CONTACT')__ WHE
|
||||
ALTER TABLE llx_product_lot MODIFY COLUMN entity integer DEFAULT 1;
|
||||
UPDATE llx_product_lot SET entity = 1 WHERE entity IS NULL;
|
||||
|
||||
ALTER TABLE llx_bank_account ADD COLUMN extraparams varchar(255);
|
||||
|
||||
ALTER TABLE llx_societe ALTER COLUMN fk_stcomm SET DEFAULT 0;
|
||||
|
||||
ALTER TABLE llx_c_actioncomm ADD COLUMN picto varchar(48);
|
||||
@ -162,6 +164,7 @@ ALTER TABLE llx_c_payment_term change fdm type_cdr tinyint;
|
||||
|
||||
|
||||
ALTER TABLE llx_facturedet ADD COLUMN vat_src_code varchar(10) DEFAULT '' AFTER tva_tx;
|
||||
ALTER TABLE llx_facturedet_rec ADD COLUMN vat_src_code varchar(10) DEFAULT '' AFTER tva_tx;
|
||||
ALTER TABLE llx_facture_fourn_det ADD COLUMN vat_src_code varchar(10) DEFAULT '' AFTER tva_tx;
|
||||
ALTER TABLE llx_commandedet ADD COLUMN vat_src_code varchar(10) DEFAULT '' AFTER tva_tx;
|
||||
ALTER TABLE llx_commande_fournisseurdet ADD COLUMN vat_src_code varchar(10) DEFAULT '' AFTER tva_tx;
|
||||
|
||||
@ -58,5 +58,6 @@ create table llx_bank_account
|
||||
comment text, -- TODO rename in note_private
|
||||
note_public text,
|
||||
model_pdf varchar(255),
|
||||
import_key varchar(14)
|
||||
import_key varchar(14),
|
||||
extraparams varchar(255) -- for other parameters with json format
|
||||
)ENGINE=innodb;
|
||||
|
||||
@ -29,6 +29,7 @@ create table llx_facturedet_rec
|
||||
product_type integer DEFAULT 0,
|
||||
label varchar(255) DEFAULT NULL,
|
||||
description text,
|
||||
vat_src_code varchar(10) DEFAULT '', -- Vat code used as source of vat fields. Not strict foreign key here.
|
||||
tva_tx double(6,3), -- taux tva
|
||||
localtax1_tx double(6,3) DEFAULT 0, -- localtax1 rate
|
||||
localtax1_type varchar(10) NULL, -- localtax1 type
|
||||
|
||||
@ -4062,7 +4062,7 @@ class Product extends CommonObject
|
||||
$relativefile=preg_replace('/^\//', '', $pdir.$photo);
|
||||
if (empty($nolink))
|
||||
{
|
||||
$urladvanced=getAdvancedPreviewUrl('product', $relativefile);
|
||||
$urladvanced=getAdvancedPreviewUrl('product', $relativefile, 0, 'entity='.$this->entity);
|
||||
if ($urladvanced) $return.='<a href="'.$urladvanced.'">';
|
||||
else $return.= '<a href="'.DOL_URL_ROOT.'/viewimage.php?modulepart=product&entity='.$this->entity.'&file='.urlencode($pdir.$photo).'" class="aphoto" target="_blank">';
|
||||
}
|
||||
|
||||
@ -26,7 +26,7 @@ if (! defined('NOTOKENRENEWAL')) define('NOTOKENRENEWAL','1'); // Disables token
|
||||
if (! defined('NOREQUIREMENU')) define('NOREQUIREMENU','1');
|
||||
if (! defined('NOREQUIREHTML')) define('NOREQUIREHTML','1');
|
||||
if (! defined('NOREQUIREAJAX')) define('NOREQUIREAJAX','1');
|
||||
if (! defined('NOREQUIRESOC')) define('NOREQUIRESOC','1');
|
||||
//if (! defined('NOREQUIRESOC')) define('NOREQUIRESOC','1');
|
||||
if (! defined('NOLOGIN')) define('NOLOGIN','1');
|
||||
//if (! defined('NOREQUIRETRAN')) define('NOREQUIRETRAN','1');
|
||||
|
||||
|
||||
@ -294,13 +294,13 @@ if (empty($reshook))
|
||||
$action = 'builddoc';
|
||||
$moreparams = array(
|
||||
'use_companybankid'=>GETPOST('companybankid'),
|
||||
'force_dir_output'=>$conf->societe->dir_output.'/'.dol_sanitizeFileName($object->id)
|
||||
'force_dir_output'=>$conf->societe->multidir_output[$object->entity].'/'.dol_sanitizeFileName($object->id)
|
||||
);
|
||||
$_POST['lang_id'] = GETPOST('lang_idrib'.GETPOST('companybankid'));
|
||||
$_POST['model'] = GETPOST('modelrib'.GETPOST('companybankid'));
|
||||
}
|
||||
$id = $socid;
|
||||
$upload_dir = $conf->societe->dir_output;
|
||||
$upload_dir = $conf->societe->multidir_output[$object->entity];
|
||||
$permissioncreate=$user->rights->societe->creer;
|
||||
include DOL_DOCUMENT_ROOT.'/core/actions_builddoc.inc.php';
|
||||
|
||||
@ -658,7 +658,7 @@ if ($socid && $action != 'edit' && $action != "create")
|
||||
|
||||
$var=true;
|
||||
|
||||
print $formfile->showdocuments('company', $object->id, $filedir, $urlsource, $genallowed, $delallowed, $object->modelpdf, 0, 0, 0, 28, 0, '', 0, '', $object->default_lang);
|
||||
print $formfile->showdocuments('company', $object->id, $filedir, $urlsource, $genallowed, $delallowed, $object->modelpdf, 0, 0, 0, 28, 0, 'entity='.$object->entity, 0, '', $object->default_lang);
|
||||
|
||||
print '</div><div class="fichehalfright"><div class="ficheaddleft">';
|
||||
|
||||
|
||||
Loading…
Reference in New Issue
Block a user