Skip to content

Commit

Permalink
Merge branch '6.0' of git@github.com:Dolibarr/dolibarr.git into develop
Browse files Browse the repository at this point in the history
Conflicts:
	htdocs/comm/propal/class/propal.class.php
	htdocs/compta/facture/fiche-rec.php
	htdocs/core/class/commonobject.class.php
	htdocs/core/modules/import/import_xlsx.modules.php
	htdocs/install/repair.php
  • Loading branch information
eldy committed Nov 14, 2017
2 parents 366ade4 + 77b6ef7 commit c85acbf
Show file tree
Hide file tree
Showing 22 changed files with 158 additions and 85 deletions.
2 changes: 1 addition & 1 deletion dev/dolibarr_changes.txt
Expand Up @@ -105,7 +105,7 @@ JQUERYFILETREE:
RESTLER:
--------

* Add 2 lines into function
* Add 2 lines into file AutoLoader.php to complete function
private function alias($className, $currentClass)
{
...
Expand Down
11 changes: 7 additions & 4 deletions htdocs/cashdesk/facturation_verif.php
Expand Up @@ -114,10 +114,13 @@
{
if (count($prodcustprice->lines) > 0)
{
$pu_ht = price($prodcustprice->lines [0]->price);
$pu_ttc = price($prodcustprice->lines [0]->price_ttc);
$price_base_type = $prodcustprice->lines [0]->price_base_type;
$tva_tx = $prodcustprice->lines [0]->tva_tx;
$pu_ht = price($prodcustprice->lines[0]->price);
$pu_ttc = price($prodcustprice->lines[0]->price_ttc);
$price_base_type = $prodcustprice->lines[0]->price_base_type;
$tva_tx = $prodcustprice->lines[0]->tva_tx;
if ($prodcustprice->lines[0]->default_vat_code && ! preg_match('/\(.*\)/', $tva_tx)) $tva_tx.= ' ('.$prodcustprice->lines[0]->default_vat_code.')';
$tva_npr = $prodcustprice->lines[0]->recuperableonly;
if (empty($tva_tx)) $tva_npr=0;
}
}
else
Expand Down
2 changes: 2 additions & 0 deletions htdocs/comm/action/card.php
Expand Up @@ -1324,6 +1324,8 @@ function init_repeat()
print '</div>';
if ($object->datep != $object->datef && in_array($user->id,array_keys($listofuserid)))
{
//var_dump($object->userassigned);
//var_dump($listofuserid);
print '<div class="myavailability">';
print $langs->trans("MyAvailability").': '.(($object->userassigned[$user->id]['transparency'] > 0)?$langs->trans("Busy"):$langs->trans("Available")); // We show nothing if event is assigned to nobody
print '</div>';
Expand Down
6 changes: 3 additions & 3 deletions htdocs/comm/action/class/actioncomm.class.php
Expand Up @@ -225,11 +225,11 @@ public function create(User $user, $notrigger = 0)
if ($this->elementtype=='commande') $this->elementtype='order';
if ($this->elementtype=='contrat') $this->elementtype='contract';

if (! is_array($this->userassigned) && ! empty($this->userassigned)) // For backward compatibility
if (! is_array($this->userassigned) && ! empty($this->userassigned)) // For backward compatibility when userassigned was an int instead fo array
{
$tmpid=$this->userassigned;
$this->userassigned=array();
$this->userassigned[$tmpid]=array('id'=>$tmpid);
$this->userassigned[$tmpid]=array('id'=>$tmpid, 'transparency'=>$this->transparency);
}

if (is_object($this->contact) && isset($this->contact->id) && $this->contact->id > 0 && ! ($this->contactid > 0)) $this->contactid = $this->contact->id; // For backward compatibility. Using this->contact->xx is deprecated
Expand All @@ -240,7 +240,7 @@ public function create(User $user, $notrigger = 0)

// Be sure assigned user is defined as an array of array('id'=>,'mandatory'=>,...).
if (empty($this->userassigned) || count($this->userassigned) == 0 || ! is_array($this->userassigned))
$this->userassigned = array($userownerid=>array('id'=>$userownerid));
$this->userassigned = array($userownerid=>array('id'=>$userownerid, 'transparency'=>$this->transparency));

if (! $this->type_id || ! $this->type_code)
{
Expand Down
3 changes: 3 additions & 0 deletions htdocs/comm/propal/card.php
Expand Up @@ -808,6 +808,9 @@
$pu_ttc = price($prodcustprice->lines[0]->price_ttc);
$price_base_type = $prodcustprice->lines[0]->price_base_type;
$tva_tx = ($prodcustprice->lines[0]->default_vat_code ? $prodcustprice->lines[0]->tva_tx . ' ('.$prodcustprice->lines[0]->default_vat_code.' )' : $prodcustprice->lines[0]->tva_tx);
if ($prodcustprice->lines[0]->default_vat_code && ! preg_match('/\(.*\)/', $tva_tx)) $tva_tx.= ' ('.$prodcustprice->lines[0]->default_vat_code.')';
$tva_npr = $prodcustprice->lines[0]->recuperableonly;
if (empty($tva_tx)) $tva_npr=0;
}
}
}
Expand Down
79 changes: 41 additions & 38 deletions htdocs/comm/propal/class/propal.class.php
Expand Up @@ -364,42 +364,42 @@ function insert_discount($idremise)
}
}

/**
* Add a proposal line into database (linked to product/service or not)
* The parameters are already supposed to be appropriate and with final values to the call
* of this method. Also, for the VAT rate, it must have already been defined
* by whose calling the method get_default_tva (societe_vendeuse, societe_acheteuse, '' product)
* and desc must already have the right value (it's up to the caller to manage multilanguage)
*
* @param string $desc Description de la ligne
* @param float $pu_ht Prix unitaire
* @param float $qty Quantite
* @param float $txtva Taux de tva
* @param float $txlocaltax1 Local tax 1 rate
* @param float $txlocaltax2 Local tax 2 rate
* @param int $fk_product Id du produit/service predefini
* @param float $remise_percent Pourcentage de remise de la ligne
* @param string $price_base_type HT or TTC
* @param float $pu_ttc Prix unitaire TTC
* @param int $info_bits Bits de type de lignes
* @param int $type Type of line (0=product, 1=service). Not used if fk_product is defined, the type of product is used.
* @param int $rang Position of line
* @param int $special_code Special code (also used by externals modules!)
* @param int $fk_parent_line Id of parent line
* @param int $fk_fournprice Id supplier price
* @param int $pa_ht Buying price without tax
* @param string $label ???
* @param int $date_start Start date of the line
* @param int $date_end End date of the line
* @param array $array_options extrafields array
* @param string $fk_unit Code of the unit to use. Null to use the default one
* @param string $origin 'order', ...
* @param int $origin_id Id of origin object
* @param double $pu_ht_devise Unit price in currency
* @param int $fk_remise_except Id discount if line is from a discount
* @return int >0 if OK, <0 if KO
* @see add_product
*/
/**
* Add a proposal line into database (linked to product/service or not)
* The parameters are already supposed to be appropriate and with final values to the call
* of this method. Also, for the VAT rate, it must have already been defined
* by whose calling the method get_default_tva (societe_vendeuse, societe_acheteuse, '' product)
* and desc must already have the right value (it's up to the caller to manage multilanguage)
*
* @param string $desc Description of line
* @param float $pu_ht Unit price
* @param float $qty Quantity
* @param float $txtva Force Vat rate, -1 for auto (Can contain the vat_src_code too with syntax '9.9 (CODE)')
* @param float $txlocaltax1 Local tax 1 rate (deprecated, use instead txtva with code inside)
* @param float $txlocaltax2 Local tax 2 rate (deprecated, use instead txtva with code inside)
* @param int $fk_product Id du produit/service predefini
* @param float $remise_percent Pourcentage de remise de la ligne
* @param string $price_base_type HT or TTC
* @param float $pu_ttc Prix unitaire TTC
* @param int $info_bits Bits de type de lignes
* @param int $type Type of line (0=product, 1=service). Not used if fk_product is defined, the type of product is used.
* @param int $rang Position of line
* @param int $special_code Special code (also used by externals modules!)
* @param int $fk_parent_line Id of parent line
* @param int $fk_fournprice Id supplier price
* @param int $pa_ht Buying price without tax
* @param string $label ???
* @param int $date_start Start date of the line
* @param int $date_end End date of the line
* @param array $array_options extrafields array
* @param string $fk_unit Code of the unit to use. Null to use the default one
* @param string $origin 'order', ...
* @param int $origin_id Id of origin object
* @param double $pu_ht_devise Unit price in currency
* @param int $fk_remise_except Id discount if line is from a discount
* @return int >0 if OK, <0 if KO
* @see add_product
*/
function addline($desc, $pu_ht, $qty, $txtva, $txlocaltax1=0.0, $txlocaltax2=0.0, $fk_product=0, $remise_percent=0.0, $price_base_type='HT', $pu_ttc=0.0, $info_bits=0, $type=0, $rang=-1, $special_code=0, $fk_parent_line=0, $fk_fournprice=0, $pa_ht=0, $label='',$date_start='', $date_end='',$array_options=0, $fk_unit=null, $origin='', $origin_id=0, $pu_ht_devise=0, $fk_remise_except=0)
{
global $mysoc, $conf, $langs;
Expand Down Expand Up @@ -1018,11 +1018,15 @@ function create($user, $notrigger=0)
$fk_parent_line = 0;
}

// Complete vat rate with code
$vatrate = $this->lines[$i]->tva_tx;
if ($this->lines[$i]->vat_src_code && ! preg_match('/\(.*\)/', $vatrate)) $vatrate.=' ('.$this->lines[$i]->vat_src_code.')';

$result = $this->addline(
$this->lines[$i]->desc,
$this->lines[$i]->subprice,
$this->lines[$i]->qty,
$this->lines[$i]->tva_tx,
$vatrate,
$this->lines[$i]->localtax1_tx,
$this->lines[$i]->localtax2_tx,
$this->lines[$i]->fk_product,
Expand Down Expand Up @@ -1234,7 +1238,6 @@ function createFromClone($socid=0)
if (empty($conf->global->MAIN_KEEP_REF_CUSTOMER_ON_CLONING)) $clonedObj->ref_client = '';

// Create clone

$result=$clonedObj->create($user);
if ($result < 0) $error++;
else
Expand Down
11 changes: 7 additions & 4 deletions htdocs/commande/card.php
Expand Up @@ -761,10 +761,13 @@
{
if (count($prodcustprice->lines) > 0)
{
$pu_ht = price($prodcustprice->lines [0]->price);
$pu_ttc = price($prodcustprice->lines [0]->price_ttc);
$price_base_type = $prodcustprice->lines [0]->price_base_type;
$tva_tx = $prodcustprice->lines [0]->tva_tx;
$pu_ht = price($prodcustprice->lines[0]->price);
$pu_ttc = price($prodcustprice->lines[0]->price_ttc);
$price_base_type = $prodcustprice->lines[0]->price_base_type;
$tva_tx = $prodcustprice->lines[0]->tva_tx;
if ($prodcustprice->lines[0]->default_vat_code && ! preg_match('/\(.*\)/', $tva_tx)) $tva_tx.= ' ('.$prodcustprice->lines[0]->default_vat_code.')';
$tva_npr = $prodcustprice->lines[0]->recuperableonly;
if (empty($tva_tx)) $tva_npr=0;
}
}
else
Expand Down
12 changes: 8 additions & 4 deletions htdocs/commande/class/commande.class.php
Expand Up @@ -824,11 +824,15 @@ function create($user, $notrigger=0)
$fk_parent_line = 0;
}

// Complete vat rate with code
$vatrate = $line->tva_tx;
if ($line->vat_src_code && ! preg_match('/\(.*\)/', $vatrate)) $vatrate.=' ('.$line->vat_src_code.')';

$result = $this->addline(
$line->desc,
$line->subprice,
$line->qty,
$line->tva_tx,
$vatrate,
$line->localtax1_tx,
$line->localtax2_tx,
$line->fk_product,
Expand Down Expand Up @@ -1215,9 +1219,9 @@ function createFromProposal($object, User $user)
* @param string $desc Description of line
* @param float $pu_ht Unit price (without tax)
* @param float $qty Quantite
* @param float $txtva Taux de tva force, sinon -1
* @param float $txlocaltax1 Local tax 1 rate
* @param float $txlocaltax2 Local tax 2 rate
* @param float $txtva Force Vat rate, -1 for auto (Can contain the vat_src_code too with syntax '9.9 (CODE)')
* @param float $txlocaltax1 Local tax 1 rate (deprecated, use instead txtva with code inside)
* @param float $txlocaltax2 Local tax 2 rate (deprecated, use instead txtva with code inside)
* @param int $fk_product Id of product
* @param float $remise_percent Pourcentage de remise de la ligne
* @param int $info_bits Bits de type de lignes
Expand Down
3 changes: 3 additions & 0 deletions htdocs/compta/facture/card.php
Expand Up @@ -1655,6 +1655,9 @@
$pu_ttc = price($prodcustprice->lines[0]->price_ttc);
$price_base_type = $prodcustprice->lines[0]->price_base_type;
$tva_tx = $prodcustprice->lines[0]->tva_tx;
if ($prodcustprice->lines[0]->default_vat_code && ! preg_match('/\(.*\)/', $tva_tx)) $tva_tx.= ' ('.$prodcustprice->lines[0]->default_vat_code.')';
$tva_npr = $prodcustprice->lines[0]->recuperableonly;
if (empty($tva_tx)) $tva_npr=0;
}
}
}
Expand Down
10 changes: 7 additions & 3 deletions htdocs/compta/facture/class/facture.class.php
Expand Up @@ -583,11 +583,15 @@ function create($user,$notrigger=0,$forceduedate=0)
$fk_parent_line = 0;
}

// Complete vat rate with code
$vatrate = $line->tva_tx;
if ($line->vat_src_code && ! preg_match('/\(.*\)/', $vatrate)) $vatrate.=' ('.$line->vat_src_code.')';

$result = $this->addline(
$line->desc,
$line->subprice,
$line->qty,
$line->tva_tx,
$vatrate,
$line->localtax1_tx,
$line->localtax2_tx,
$line->fk_product,
Expand Down Expand Up @@ -2486,8 +2490,8 @@ function set_draft($user,$idwarehouse=-1)
* @param double $pu_ht Unit price without tax (> 0 even for credit note)
* @param double $qty Quantity
* @param double $txtva Force Vat rate, -1 for auto (Can contain the vat_src_code too with syntax '9.9 (CODE)')
* @param double $txlocaltax1 Local tax 1 rate (deprecated)
* @param double $txlocaltax2 Local tax 2 rate (deprecated)
* @param double $txlocaltax1 Local tax 1 rate (deprecated, use instead txtva with code inside)
* @param double $txlocaltax2 Local tax 2 rate (deprecated, use instead txtva with code inside)
* @param int $fk_product Id of predefined product/service
* @param double $remise_percent Percent of discount on line
* @param int $date_start Date start of service
Expand Down
3 changes: 3 additions & 0 deletions htdocs/compta/facture/fiche-rec.php
Expand Up @@ -545,6 +545,9 @@
$pu_ttc = price($prodcustprice->lines[0]->price_ttc);
$price_base_type = $prodcustprice->lines[0]->price_base_type;
$tva_tx = $prodcustprice->lines[0]->tva_tx;
if ($prodcustprice->lines[0]->default_vat_code && ! preg_match('/\(.*\)/', $tva_tx)) $tva_tx.= ' ('.$prodcustprice->lines[0]->default_vat_code.')';
$tva_npr = $prodcustprice->lines[0]->recuperableonly;
if (empty($tva_tx)) $tva_npr=0;
}
}
}
Expand Down
3 changes: 3 additions & 0 deletions htdocs/contrat/card.php
Expand Up @@ -517,6 +517,9 @@
$pu_ttc = price($prodcustprice->lines [0]->price_ttc);
$price_base_type = $prodcustprice->lines [0]->price_base_type;
$tva_tx = $prodcustprice->lines [0]->tva_tx;
if ($prodcustprice->lines[0]->default_vat_code && ! preg_match('/\(.*\)/', $tva_tx)) $tva_tx.= ' ('.$prodcustprice->lines[0]->default_vat_code.')';
$tva_npr = $prodcustprice->lines[0]->recuperableonly;
if (empty($tva_tx)) $tva_npr=0;
}
}
}
Expand Down
7 changes: 4 additions & 3 deletions htdocs/core/class/commonobject.class.php
Expand Up @@ -3878,9 +3878,10 @@ function printOriginLine($line, $var, $restrictlist='')
$this->tpl['description'] = '&nbsp;';
}

// VAT Rate
$this->tpl['vat_rate'] = vatrate($line->tva_tx, true);
if (! empty($line->vat_src_code) && ! preg_match('/\(/', $this->tpl['vat_rate'])) $this->tpl['vat_rate'].=' ('.$line->vat_src_code.')';
// VAT Rate
$this->tpl['vat_rate'] = vatrate($line->tva_tx, true);
$this->tpl['vat_rate'] .= (($line->info_bits & 1) == 1) ? '*' : '';
if (! empty($line->vat_src_code) && ! preg_match('/\(/', $this->tpl['vat_rate'])) $this->tpl['vat_rate'].=' ('.$line->vat_src_code.')';

$this->tpl['price'] = price($line->subprice);
$this->tpl['multicurrency_price'] = price($line->multicurrency_subprice);
Expand Down
4 changes: 2 additions & 2 deletions htdocs/core/modules/import/import_xlsx.modules.php
Expand Up @@ -20,9 +20,9 @@
*/

/**
* \file htdocs/core/modules/import/import_csv.modules.php
* \file htdocs/core/modules/import/import_xlsx.modules.php
* \ingroup import
* \brief File to load import files with CSV format
* \brief File to load import files with Excel format
*/

require_once DOL_DOCUMENT_ROOT .'/core/modules/import/modules_import.php';
Expand Down
3 changes: 2 additions & 1 deletion htdocs/expedition/class/expedition.class.php
Expand Up @@ -1291,7 +1291,7 @@ function fetch_lines()

$sql = "SELECT cd.rowid, cd.fk_product, cd.label as custom_label, cd.description, cd.qty as qty_asked, cd.product_type";
$sql.= ", cd.total_ht, cd.total_localtax1, cd.total_localtax2, cd.total_ttc, cd.total_tva";
$sql.= ", cd.vat_src_code, cd.tva_tx, cd.localtax1_tx, cd.localtax2_tx, cd.localtax1_type, cd.localtax2_type, cd.price, cd.subprice, cd.remise_percent,cd.buy_price_ht as pa_ht";
$sql.= ", cd.vat_src_code, cd.tva_tx, cd.localtax1_tx, cd.localtax2_tx, cd.localtax1_type, cd.localtax2_type, cd.info_bits, cd.price, cd.subprice, cd.remise_percent,cd.buy_price_ht as pa_ht";
$sql.= ", cd.fk_multicurrency, cd.multicurrency_code, cd.multicurrency_subprice, cd.multicurrency_total_ht, cd.multicurrency_total_tva, cd.multicurrency_total_ttc";
$sql.= ", ed.rowid as line_id, ed.qty as qty_shipped, ed.fk_origin_line, ed.fk_entrepot";
$sql.= ", p.ref as product_ref, p.label as product_label, p.fk_product_type";
Expand Down Expand Up @@ -1389,6 +1389,7 @@ function fetch_lines()
$line->tva_tx = $obj->tva_tx;
$line->localtax1_tx = $obj->localtax1_tx;
$line->localtax2_tx = $obj->localtax2_tx;
$line->info_bits = $obj->info_bits;
$line->price = $obj->price;
$line->subprice = $obj->subprice;
$line->remise_percent = $obj->remise_percent;
Expand Down
2 changes: 2 additions & 0 deletions htdocs/install/mysql/migration/5.0.0-6.0.0.sql
Expand Up @@ -382,6 +382,8 @@ ALTER TABLE llx_product_fournisseur_price_log ADD COLUMN multicurrency_tx d
ALTER TABLE llx_product_fournisseur_price_log ADD COLUMN multicurrency_price double(24,8) DEFAULT NULL;
ALTER TABLE llx_product_fournisseur_price_log ADD COLUMN multicurrency_price_ttc double(24,8) DEFAULT NULL;

ALTER TABLE llx_product_customer_price_log ADD COLUMN default_vat_code varchar(10);

UPDATE llx_contrat SET ref = rowid WHERE ref IS NULL OR ref = '';
ALTER TABLE llx_contratdet ADD COLUMN vat_src_code varchar(10) DEFAULT '';

Expand Down
2 changes: 1 addition & 1 deletion htdocs/install/repair.php
Expand Up @@ -920,7 +920,7 @@
{
print '<tr><td colspan="2"><br>*** Force page code and collation of tables into utf8/utf8_unicode_ci (for mysql/mariadb only)</td></tr>';

if ($db->type == "mysql")
if ($db->type == "mysql" || $db->type == "mysqli")
{
$listoftables = $db->DDLListTables($db->database_name);

Expand Down
2 changes: 1 addition & 1 deletion htdocs/langs/en_US/boxes.lang
Expand Up @@ -77,7 +77,7 @@ BoxTitleLastModifiedSupplierBills=Latest %s modified supplier bills
BoxTitleLatestModifiedSupplierOrders=Latest %s modified supplier orders
BoxTitleLastModifiedCustomerBills=Latest %s modified customer bills
BoxTitleLastModifiedCustomerOrders=Latest %s modified customer orders
BoxTitleLastModifiedPropals=Latest %s modified propals
BoxTitleLastModifiedPropals=Latest %s modified proposals
ForCustomersInvoices=Customers invoices
ForCustomersOrders=Customers orders
ForProposals=Proposals
Expand Down
1 change: 1 addition & 0 deletions htdocs/langs/en_US/main.lang
Expand Up @@ -374,6 +374,7 @@ TotalLT1IN=Total CGST
TotalLT2IN=Total SGST
HT=Net of tax
TTC=Inc. tax
INCVATONLY=Inc. VAT
INCT=Inc. all taxes
VAT=Sales tax
VATIN=IGST
Expand Down
2 changes: 1 addition & 1 deletion htdocs/langs/en_US/stocks.lang
Expand Up @@ -135,7 +135,7 @@ DateMovement=Date of movement
InventoryCode=Movement or inventory code
IsInPackage=Contained into package
WarehouseAllowNegativeTransfer=Stock can be negative
qtyToTranferIsNotEnough=You don't have enough stock from your source warehouse
qtyToTranferIsNotEnough=You don't have enough stock from your source warehouse and your setup does not allow negative stocks.
ShowWarehouse=Show warehouse
MovementCorrectStock=Stock correction for product %s
MovementTransferStock=Stock transfer of product %s into another warehouse
Expand Down

0 comments on commit c85acbf

Please sign in to comment.