Skip to content

Commit

Permalink
Merge branch '7.0' of https://github.com/Dolibarr/dolibarr into 7.0
Browse files Browse the repository at this point in the history
  • Loading branch information
atm-gauthier committed Dec 5, 2018
2 parents c5f1f68 + 779d33c commit e150d85
Show file tree
Hide file tree
Showing 29 changed files with 476 additions and 362 deletions.
64 changes: 46 additions & 18 deletions htdocs/admin/barcode.php
Original file line number Diff line number Diff line change
Expand Up @@ -70,18 +70,8 @@
$res = dolibarr_set_const($db, "PRODUIT_DEFAULT_BARCODE_TYPE", $coder_id,'chaine',0,'',$conf->entity);
$coder_id = GETPOST('GENBARCODE_BARCODETYPE_THIRDPARTY','alpha');
$res = dolibarr_set_const($db, "GENBARCODE_BARCODETYPE_THIRDPARTY", $coder_id,'chaine',0,'',$conf->entity);
}
else if ($action == 'updateengine')
{
// TODO Update engines.

}

if ($action && $action != 'setcoder' && $action != 'setModuleOptions')
{
if (! $res > 0) $error++;

if (! $error)

if ($res > 0)
{
setEventMessages($langs->trans("SetupSaved"), null, 'mesgs');
}
Expand All @@ -90,6 +80,42 @@
setEventMessages($langs->trans("Error"), null, 'errors');
}
}
else if ($action == 'updateengine')
{
$sql = "SELECT rowid, coder";
$sql.= " FROM ".MAIN_DB_PREFIX."c_barcode_type";
$sql.= " WHERE entity = ".$conf->entity;
$sql.= " ORDER BY code";

$resql=$db->query($sql);
if ($resql)
{
$num = $db->num_rows($resql);
$i = 0;

while ($i < $num)
{
$obj = $db->fetch_object($resql);

if (GETPOST('coder'.$obj->rowid, 'alpha'))
{
$coder = GETPOST('coder'.$obj->rowid,'alpha');
$code_id = $obj->rowid;

$sqlp = "UPDATE ".MAIN_DB_PREFIX."c_barcode_type";
$sqlp.= " SET coder = '" . $coder."'";
$sqlp.= " WHERE rowid = ". $code_id;
$sqlp.= " AND entity = ".$conf->entity;

$upsql=$db->query($sqlp);
if (! $upsql) dol_print_error($db);
}

$i++;
}
}

}

/*
* View
Expand Down Expand Up @@ -162,9 +188,12 @@
print '<br>';
print load_fiche_titre($langs->trans("BarcodeEncodeModule"),'','');

//print "<form method=\"post\" action=\"".$_SERVER["PHP_SELF"]."\">";
//print '<input type="hidden" name="token" value="'.$_SESSION['newtoken'].'">';
//print "<input type=\"hidden\" name=\"action\" value=\"updateengine\">";
if (empty($conf->use_javascript_ajax))
{
print '<form action="'.$_SERVER["PHP_SELF"].'" method="POST" id="form_engine">';
print '<input type="hidden" name="token" value="'.$_SESSION['newtoken'].'">';
print '<input type="hidden" name="action" value="updateengine">';
}

print '<table class="noborder" width="100%">';
print '<tr class="liste_titre">';
Expand Down Expand Up @@ -260,10 +289,9 @@

if (empty($conf->use_javascript_ajax))
{
// TODO Implement code behind action updateengine
//print '<div class="center"><input type="submit" class="button" name="save" value="'.$langs->trans("Save").'"></div>';
print '<div class="center"><input type="submit" class="button" name="save" value="'.$langs->trans("Save").'"></div>';
print '</form>';
}
//print '</form>';

print "<br>";

Expand Down
61 changes: 32 additions & 29 deletions htdocs/comm/propal/class/propal.class.php
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,7 @@
* Copyright (C) 2013 Florian Henry <[email protected]>
* Copyright (C) 2014-2015 Marcos García <[email protected]>
* Copyright (C) 2018 Frédéric France <[email protected]>
* Copyright (C) 2018 Ferran Marcet <[email protected]>
*
* 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
Expand Down Expand Up @@ -415,38 +416,40 @@ function addline($desc, $pu_ht, $qty, $txtva, $txlocaltax1=0.0, $txlocaltax2=0.0
global $mysoc, $conf, $langs;

dol_syslog(get_class($this)."::addline propalid=$this->id, desc=$desc, pu_ht=$pu_ht, qty=$qty, txtva=$txtva, fk_product=$fk_product, remise_except=$remise_percent, price_base_type=$price_base_type, pu_ttc=$pu_ttc, info_bits=$info_bits, type=$type, fk_remise_except=".$fk_remise_except);
include_once DOL_DOCUMENT_ROOT.'/core/lib/price.lib.php';

// Clean parameters
if (empty($remise_percent)) $remise_percent=0;
if (empty($qty)) $qty=0;
if (empty($info_bits)) $info_bits=0;
if (empty($rang)) $rang=0;
if (empty($fk_parent_line) || $fk_parent_line < 0) $fk_parent_line=0;

$remise_percent=price2num($remise_percent);
$qty=price2num($qty);
$pu_ht=price2num($pu_ht);
$pu_ht_devise=price2num($pu_ht_devise);
$pu_ttc=price2num($pu_ttc);
$txtva=price2num($txtva); // $txtva can have format '5.0(XXX)' or '5'
$txlocaltax1=price2num($txlocaltax1);
$txlocaltax2=price2num($txlocaltax2);
$pa_ht=price2num($pa_ht);
if ($price_base_type=='HT')
{
$pu=$pu_ht;
}
else
if ($this->statut == self::STATUS_DRAFT)
{
$pu=$pu_ttc;
}
include_once DOL_DOCUMENT_ROOT.'/core/lib/price.lib.php';

// Clean parameters
if (empty($remise_percent)) $remise_percent=0;
if (empty($qty)) $qty=0;
if (empty($info_bits)) $info_bits=0;
if (empty($rang)) $rang=0;
if (empty($fk_parent_line) || $fk_parent_line < 0) $fk_parent_line=0;

$remise_percent=price2num($remise_percent);
$qty=price2num($qty);
$pu_ht=price2num($pu_ht);
$pu_ht_devise=price2num($pu_ht_devise);
$pu_ttc=price2num($pu_ttc);
if (!preg_match('/\((.*)\)/', $txtva)) {
$txtva = price2num($txtva); // $txtva can have format '5.0(XXX)' or '5'
}
$txlocaltax1=price2num($txlocaltax1);
$txlocaltax2=price2num($txlocaltax2);
$pa_ht=price2num($pa_ht);
if ($price_base_type=='HT')
{
$pu=$pu_ht;
}
else
{
$pu=$pu_ttc;
}

// Check parameters
if ($type < 0) return -1;
// Check parameters
if ($type < 0) return -1;

if ($this->statut == self::STATUS_DRAFT)
{
$this->db->begin();

$product_type=$type;
Expand Down
76 changes: 39 additions & 37 deletions htdocs/commande/class/commande.class.php
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@
* Copyright (C) 2012 Cedric Salvador <[email protected]>
* Copyright (C) 2013 Florian Henry <[email protected]>
* Copyright (C) 2014-2015 Marcos García <[email protected]>
* Copyright (C) 2016-2017 Ferran Marcet <[email protected]>
* Copyright (C) 2016-2018 Ferran Marcet <[email protected]>
*
* 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
Expand Down Expand Up @@ -1270,44 +1270,46 @@ function addline($desc, $pu_ht, $qty, $txtva, $txlocaltax1=0, $txlocaltax2=0, $f

dol_syslog(get_class($this)."::addline commandeid=$this->id, 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, date_start=$date_start, date_end=$date_end, type=$type special_code=$special_code, fk_unit=$fk_unit, origin=$origin, origin_id=$origin_id, pu_ht_devise=$pu_ht_devise", LOG_DEBUG);

include_once DOL_DOCUMENT_ROOT.'/core/lib/price.lib.php';

// Clean parameters
if (empty($remise_percent)) $remise_percent=0;
if (empty($qty)) $qty=0;
if (empty($info_bits)) $info_bits=0;
if (empty($rang)) $rang=0;
if (empty($txtva)) $txtva=0;
if (empty($txlocaltax1)) $txlocaltax1=0;
if (empty($txlocaltax2)) $txlocaltax2=0;
if (empty($fk_parent_line) || $fk_parent_line < 0) $fk_parent_line=0;
if (empty($this->fk_multicurrency)) $this->fk_multicurrency=0;

$remise_percent=price2num($remise_percent);
$qty=price2num($qty);
$pu_ht=price2num($pu_ht);
$pu_ht_devise=price2num($pu_ht_devise);
$pu_ttc=price2num($pu_ttc);
$pa_ht=price2num($pa_ht);
$txtva = price2num($txtva);
$txlocaltax1 = price2num($txlocaltax1);
$txlocaltax2 = price2num($txlocaltax2);
if ($price_base_type=='HT')
{
$pu=$pu_ht;
}
else
{
$pu=$pu_ttc;
}
$label=trim($label);
$desc=trim($desc);
if ($this->statut == self::STATUS_DRAFT)
{
include_once DOL_DOCUMENT_ROOT.'/core/lib/price.lib.php';

// Clean parameters
if (empty($remise_percent)) $remise_percent=0;
if (empty($qty)) $qty=0;
if (empty($info_bits)) $info_bits=0;
if (empty($rang)) $rang=0;
if (empty($txtva)) $txtva=0;
if (empty($txlocaltax1)) $txlocaltax1=0;
if (empty($txlocaltax2)) $txlocaltax2=0;
if (empty($fk_parent_line) || $fk_parent_line < 0) $fk_parent_line=0;
if (empty($this->fk_multicurrency)) $this->fk_multicurrency=0;

$remise_percent=price2num($remise_percent);
$qty=price2num($qty);
$pu_ht=price2num($pu_ht);
$pu_ht_devise=price2num($pu_ht_devise);
$pu_ttc=price2num($pu_ttc);
$pa_ht=price2num($pa_ht);
if (!preg_match('/\((.*)\)/', $txtva)) {
$txtva = price2num($txtva); // $txtva can have format '5.0(XXX)' or '5'
}
$txlocaltax1 = price2num($txlocaltax1);
$txlocaltax2 = price2num($txlocaltax2);
if ($price_base_type=='HT')
{
$pu=$pu_ht;
}
else
{
$pu=$pu_ttc;
}
$label=trim($label);
$desc=trim($desc);

// Check parameters
if ($type < 0) return -1;
// Check parameters
if ($type < 0) return -1;

if ($this->statut == self::STATUS_DRAFT)
{
$this->db->begin();

$product_type=$type;
Expand Down
92 changes: 47 additions & 45 deletions htdocs/compta/facture/class/facture.class.php
Original file line number Diff line number Diff line change
Expand Up @@ -2580,55 +2580,47 @@ function addline($desc, $pu_ht, $qty, $txtva, $txlocaltax1=0, $txlocaltax2=0, $f
global $mysoc, $conf, $langs;

dol_syslog(get_class($this)."::addline id=$this->id,desc=$desc,pu_ht=$pu_ht,qty=$qty,txtva=$txtva, txlocaltax1=$txlocaltax1, txlocaltax2=$txlocaltax2, fk_product=$fk_product,remise_percent=$remise_percent,date_start=$date_start,date_end=$date_end,ventil=$ventil,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';

// Clean parameters
if (empty($remise_percent)) $remise_percent=0;
if (empty($qty)) $qty=0;
if (empty($info_bits)) $info_bits=0;
if (empty($rang)) $rang=0;
if (empty($ventil)) $ventil=0;
if (empty($txtva)) $txtva=0;
if (empty($txlocaltax1)) $txlocaltax1=0;
if (empty($txlocaltax2)) $txlocaltax2=0;
if (empty($fk_parent_line) || $fk_parent_line < 0) $fk_parent_line=0;
if (empty($fk_prev_id)) $fk_prev_id = 'null';
if (! isset($situation_percent) || $situation_percent > 100 || (string) $situation_percent == '') $situation_percent = 100;

$localtaxes_type=getLocalTaxesFromRate($txtva, 0, $this->thirdparty, $mysoc);

// Clean vat code
$vat_src_code='';
if (preg_match('/\((.*)\)/', $txtva, $reg))
if (! empty($this->brouillon))
{
$vat_src_code = $reg[1];
$txtva = preg_replace('/\s*\(.*\)/', '', $txtva); // Remove code into vatrate.
}
include_once DOL_DOCUMENT_ROOT.'/core/lib/price.lib.php';

$remise_percent=price2num($remise_percent);
$qty=price2num($qty);
$pu_ht=price2num($pu_ht);
$pu_ht_devise=price2num($pu_ht_devise);
$pu_ttc=price2num($pu_ttc);
$pa_ht=price2num($pa_ht);
$txtva=price2num($txtva);
$txlocaltax1=price2num($txlocaltax1);
$txlocaltax2=price2num($txlocaltax2);

if ($price_base_type=='HT')
{
$pu=$pu_ht;
}
else
{
$pu=$pu_ttc;
}
// Clean parameters
if (empty($remise_percent)) $remise_percent=0;
if (empty($qty)) $qty=0;
if (empty($info_bits)) $info_bits=0;
if (empty($rang)) $rang=0;
if (empty($ventil)) $ventil=0;
if (empty($txtva)) $txtva=0;
if (empty($txlocaltax1)) $txlocaltax1=0;
if (empty($txlocaltax2)) $txlocaltax2=0;
if (empty($fk_parent_line) || $fk_parent_line < 0) $fk_parent_line=0;
if (empty($fk_prev_id)) $fk_prev_id = 'null';
if (! isset($situation_percent) || $situation_percent > 100 || (string) $situation_percent == '') $situation_percent = 100;

// Check parameters
if ($type < 0) return -1;
$remise_percent=price2num($remise_percent);
$qty=price2num($qty);
$pu_ht=price2num($pu_ht);
$pu_ht_devise=price2num($pu_ht_devise);
$pu_ttc=price2num($pu_ttc);
$pa_ht=price2num($pa_ht);
if (!preg_match('/\((.*)\)/', $txtva)) {
$txtva = price2num($txtva); // $txtva can have format '5.0(XXX)' or '5'
}
$txlocaltax1=price2num($txlocaltax1);
$txlocaltax2=price2num($txlocaltax2);

if ($price_base_type=='HT')
{
$pu=$pu_ht;
}
else
{
$pu=$pu_ttc;
}

// Check parameters
if ($type < 0) return -1;

if (! empty($this->brouillon))
{
$this->db->begin();

$product_type=$type;
Expand All @@ -2651,6 +2643,16 @@ function addline($desc, $pu_ht, $qty, $txtva, $txlocaltax1=0, $txlocaltax2=0, $f
// 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.

$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.
}

$tabprice = calcul_price_total($qty, $pu, $remise_percent, $txtva, $txlocaltax1, $txlocaltax2, 0, $price_base_type, $info_bits, $product_type, $mysoc, $localtaxes_type, $situation_percent, $this->multicurrency_tx, $pu_ht_devise);

$total_ht = $tabprice[0];
Expand Down
2 changes: 2 additions & 0 deletions htdocs/contact/list.php
Original file line number Diff line number Diff line change
Expand Up @@ -302,6 +302,8 @@
if (strlen($search_skype)) $sql.= natural_search('p.skype', $search_skype);
if (strlen($search_email)) $sql.= natural_search('p.email', $search_email);
if (strlen($search_zip)) $sql.= natural_search("p.zip",$search_zip);
if (strlen($search_town)) $sql.= natural_search("p.town",$search_town);

if ($search_status != '' && $search_status >= 0) $sql.= " AND p.statut = ".$db->escape($search_status);
if ($search_import_key) $sql.= natural_search("p.import_key",$search_import_key);
if ($type == "o") // filtre sur type
Expand Down
Loading

0 comments on commit e150d85

Please sign in to comment.