Merge branch '5.0' of git@github.com:Dolibarr/dolibarr.git into develop

Conflicts:
	htdocs/accountancy/journal/bankjournal.php
	htdocs/accountancy/journal/expensereportsjournal.php
	htdocs/accountancy/journal/purchasesjournal.php
	htdocs/accountancy/journal/sellsjournal.php
	htdocs/comm/propal/class/api_proposals.class.php
	htdocs/comm/propal/class/propal.class.php
	htdocs/compta/bank/index.php
	htdocs/compta/facture.php
	htdocs/core/class/html.form.class.php
	htdocs/includes/odtphp/Segment.php
	htdocs/langs/en_US/admin.lang
	htdocs/societe/soc.php
This commit is contained in:
Laurent Destailleur 2017-05-05 14:49:25 +02:00
commit 11b1a2adac
33 changed files with 228 additions and 107 deletions

View File

@ -695,7 +695,6 @@ if ($action == 'export_csv') {
*/
/*
* View
*/
@ -749,7 +748,7 @@ if (empty($action) || $action == 'view') {
/*
* Show result array
*/
print '<br><br>';
print '<br>';
$i = 0;
print "<table class=\"noborder\" width=\"100%\">";

View File

@ -477,7 +477,7 @@ if (empty($action) || $action == 'view') {
/*
* Show result array
*/
print '<br><br>';
print '<br>';
$i = 0;
print "<table class=\"noborder\" width=\"100%\">";

View File

@ -500,6 +500,7 @@ $form = new Form($db);
}
*/
if (empty($action) || $action == 'view') {
llxHeader('', $langs->trans("SellsJournal"));

View File

@ -497,7 +497,10 @@ if (empty($reshook))
$array_options = $lines[$i]->array_options;
}
$result = $object->addline($desc, $lines[$i]->subprice, $lines[$i]->qty, $lines[$i]->tva_tx, $lines[$i]->localtax1_tx, $lines[$i]->localtax2_tx, $lines[$i]->fk_product, $lines[$i]->remise_percent, 'HT', 0, $lines[$i]->info_bits, $product_type, $lines[$i]->rang, $lines[$i]->special_code, $fk_parent_line, $lines[$i]->fk_fournprice, $lines[$i]->pa_ht, $label, $date_start, $date_end, $array_options, $lines[$i]->fk_unit);
$tva_tx = $lines[$i]->tva_tx;
if (! empty($lines[$i]->vat_src_code) && ! preg_match('/\(/', $tva_tx)) $tva_tx .= ' ('.$lines[$i]->vat_src_code.')';
$result = $object->addline($desc, $lines[$i]->subprice, $lines[$i]->qty, $tva_tx, $lines[$i]->localtax1_tx, $lines[$i]->localtax2_tx, $lines[$i]->fk_product, $lines[$i]->remise_percent, 'HT', 0, $lines[$i]->info_bits, $product_type, $lines[$i]->rang, $lines[$i]->special_code, $fk_parent_line, $lines[$i]->fk_fournprice, $lines[$i]->pa_ht, $label, $date_start, $date_end, $array_options, $lines[$i]->fk_unit);
if ($result > 0) {
$lineid = $result;

View File

@ -16,9 +16,10 @@
* along with this program. If not, see <http://www.gnu.org/licenses/>.
*/
use Luracast\Restler\RestException;
use Luracast\Restler\RestException;
require_once DOL_DOCUMENT_ROOT.'/comm/propal/class/propal.class.php';
require_once DOL_DOCUMENT_ROOT.'/comm/propal/class/propal.class.php';
/**
* API class for orders
@ -275,9 +276,9 @@ class Proposals extends DolibarrApi
$request_data->array_options,
$request_data->fk_unit,
$this->element,
$request_data->id
// not used anymore ?
// $request_data->fk_remise_except
$request_data->id,
$request_data->pu_ht_devise,
$request_data->fk_remise_except
);
if ($updateRes > 0) {

View File

@ -253,6 +253,8 @@ class Propal extends CommonObject
$tva_tx = get_default_tva($mysoc,$this->thirdparty,$prod->id);
$tva_npr = get_default_npr($mysoc,$this->thirdparty,$prod->id);
if (empty($tva_tx)) $tva_npr=0;
$vat_src_code = ''; // May be defined into tva_tx
$localtax1_tx = get_localtax($tva_tx,1,$mysoc,$this->thirdparty,$tva_npr);
$localtax2_tx = get_localtax($tva_tx,2,$mysoc,$this->thirdparty,$tva_npr);
@ -273,6 +275,7 @@ class Propal extends CommonObject
$line->qty=$qty;
$line->subprice=$price;
$line->remise_percent=$remise_percent;
$line->vat_src_code=$vat_src_code;
$line->tva_tx=$tva_tx;
$line->fk_unit=$prod->fk_unit;
if ($tva_npr) $line->info_bits = 1;
@ -315,6 +318,7 @@ class Propal extends CommonObject
$line->fk_propal=$this->id;
$line->fk_remise_except=$remise->id;
$line->desc=$remise->description; // Description ligne
$line->vat_src_code=$remise->vat_src_code;
$line->tva_tx=$remise->tva_tx;
$line->subprice=-$remise->amount_ht;
$line->fk_product=0; // Id produit predefined
@ -391,15 +395,16 @@ class Propal extends CommonObject
* @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
* @return int >0 if OK, <0 if KO
* @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)
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;
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");
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
@ -515,6 +520,8 @@ class Propal extends CommonObject
$this->line->localtax1_type = $localtaxes_type[0];
$this->line->localtax2_type = $localtaxes_type[2];
$this->line->fk_product=$fk_product;
$this->line->product_type=$type;
$this->line->fk_remise_except=$fk_remise_except;
$this->line->remise_percent=$remise_percent;
$this->line->subprice=$pu_ht;
$this->line->rang=$rangtouse;
@ -524,7 +531,6 @@ class Propal extends CommonObject
$this->line->total_localtax1=$total_localtax1;
$this->line->total_localtax2=$total_localtax2;
$this->line->total_ttc=$total_ttc;
$this->line->product_type=$type;
$this->line->special_code=$special_code;
$this->line->fk_parent_line=$fk_parent_line;
$this->line->fk_unit=$fk_unit;
@ -698,7 +704,8 @@ class Propal extends CommonObject
$this->line->label = $label;
$this->line->desc = $desc;
$this->line->qty = $qty;
$this->line->product_type = $type;
$this->line->product_type = $type;
$this->line->vat_src_code = $vat_src_code;
$this->line->tva_tx = $txtva;
$this->line->localtax1_tx = $txlocaltax1;
$this->line->localtax2_tx = $txlocaltax2;
@ -708,7 +715,6 @@ class Propal extends CommonObject
$this->line->subprice = $pu_ht;
$this->line->info_bits = $info_bits;
$this->line->vat_src_code = $vat_src_code;
$this->line->total_ht = $total_ht;
$this->line->total_tva = $total_tva;
$this->line->total_localtax1 = $total_localtax1;
@ -1397,7 +1403,7 @@ class Propal extends CommonObject
{
$this->lines=array();
$sql = 'SELECT d.rowid, d.fk_propal, d.fk_parent_line, d.label as custom_label, d.description, d.price, d.tva_tx, d.localtax1_tx, d.localtax2_tx, d.qty, d.fk_remise_except, d.remise_percent, d.subprice, d.fk_product,';
$sql = 'SELECT d.rowid, d.fk_propal, d.fk_parent_line, d.label as custom_label, d.description, d.price, d.vat_src_code, d.tva_tx, d.localtax1_tx, d.localtax2_tx, d.qty, d.fk_remise_except, d.remise_percent, d.subprice, d.fk_product,';
$sql.= ' d.info_bits, d.total_ht, d.total_tva, d.total_localtax1, d.total_localtax2, d.total_ttc, d.fk_product_fournisseur_price as fk_fournprice, d.buy_price_ht as pa_ht, d.special_code, d.rang, d.product_type,';
$sql.= ' d.fk_unit,';
$sql.= ' p.ref as product_ref, p.description as product_desc, p.fk_product_type, p.label as product_label,';
@ -1432,6 +1438,7 @@ class Propal extends CommonObject
$line->label = $objp->custom_label;
$line->desc = $objp->description; // Description ligne
$line->qty = $objp->qty;
$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;
@ -3344,8 +3351,10 @@ class Propal extends CommonObject
*/
function getLinesArray()
{
// For other object, here we call fetch_lines. But fetch_lines does not exists on proposal
// TODO Duplicate with fetch_lines ? Wich one to keep ?
$this->lines = array();
$sql = 'SELECT pt.rowid, pt.label as custom_label, pt.description, pt.fk_product, pt.fk_remise_except,';
$sql.= ' pt.qty, pt.vat_src_code, pt.tva_tx, pt.remise_percent, pt.subprice, pt.info_bits,';
$sql.= ' pt.total_ht, pt.total_tva, pt.total_ttc, pt.fk_product_fournisseur_price as fk_fournprice, pt.buy_price_ht as pa_ht, pt.special_code, pt.localtax1_tx, pt.localtax2_tx,';
@ -3609,7 +3618,7 @@ class PropaleLigne extends CommonObjectLine
*/
function fetch($rowid)
{
$sql = 'SELECT pd.rowid, pd.fk_propal, pd.fk_parent_line, pd.fk_product, pd.label as custom_label, pd.description, pd.price, pd.qty, pd.tva_tx,';
$sql = 'SELECT pd.rowid, pd.fk_propal, pd.fk_parent_line, pd.fk_product, pd.label as custom_label, pd.description, pd.price, pd.qty, pd.vat_src_code, pd.tva_tx,';
$sql.= ' pd.remise, pd.remise_percent, pd.fk_remise_except, pd.subprice,';
$sql.= ' pd.info_bits, pd.total_ht, pd.total_tva, pd.total_ttc, pd.fk_product_fournisseur_price as fk_fournprice, pd.buy_price_ht as pa_ht, pd.special_code, pd.rang,';
$sql.= ' pd.fk_unit,';
@ -3635,6 +3644,7 @@ class PropaleLigne extends CommonObjectLine
$this->qty = $objp->qty;
$this->price = $objp->price; // deprecated
$this->subprice = $objp->subprice;
$this->vat_src_code = $objp->vat_src_code;
$this->tva_tx = $objp->tva_tx;
$this->remise = $objp->remise; // deprecated
$this->remise_percent = $objp->remise_percent;

View File

@ -377,7 +377,10 @@ if (empty($reshook))
$array_options = $lines[$i]->array_options;
}
$result = $object->addline($desc, $lines[$i]->subprice, $lines[$i]->qty, $lines[$i]->tva_tx, $lines[$i]->localtax1_tx, $lines[$i]->localtax2_tx, $lines[$i]->fk_product, $lines[$i]->remise_percent, $lines[$i]->info_bits, $lines[$i]->fk_remise_except, 'HT', 0, $date_start, $date_end, $product_type, $lines[$i]->rang, $lines[$i]->special_code, $fk_parent_line, $lines[$i]->fk_fournprice, $lines[$i]->pa_ht, $label, $array_options, $lines[$i]->fk_unit, $object->origin, $lines[$i]->rowid);
$tva_tx = $lines[$i]->tva_tx;
if (! empty($lines[$i]->vat_src_code) && ! preg_match('/\(/', $tva_tx)) $tva_tx .= ' ('.$lines[$i]->vat_src_code.')';
$result = $object->addline($desc, $lines[$i]->subprice, $lines[$i]->qty, $tva_tx, $lines[$i]->localtax1_tx, $lines[$i]->localtax2_tx, $lines[$i]->fk_product, $lines[$i]->remise_percent, $lines[$i]->info_bits, $lines[$i]->fk_remise_except, 'HT', 0, $date_start, $date_end, $product_type, $lines[$i]->rang, $lines[$i]->special_code, $fk_parent_line, $lines[$i]->fk_fournprice, $lines[$i]->pa_ht, $label, $array_options, $lines[$i]->fk_unit, $object->origin, $lines[$i]->rowid);
if ($result < 0) {
$error++;

View File

@ -1103,6 +1103,7 @@ class Commande extends CommonOrder
$line->desc = $object->lines[$i]->desc;
$line->price = $object->lines[$i]->price;
$line->subprice = $object->lines[$i]->subprice;
$line->vat_src_code = $object->lines[$i]->vat_src_code;
$line->tva_tx = $object->lines[$i]->tva_tx;
$line->localtax1_tx = $object->lines[$i]->localtax1_tx;
$line->localtax2_tx = $object->lines[$i]->localtax2_tx;
@ -1466,7 +1467,8 @@ class Commande extends CommonOrder
$tva_tx = get_default_tva($mysoc,$this->thirdparty,$prod->id);
$tva_npr = get_default_npr($mysoc,$this->thirdparty,$prod->id);
if (empty($tva_tx)) $tva_npr=0;
$vat_src_code = ''; // May be defined into tva_tx
$localtax1_tx=get_localtax($tva_tx,1,$this->thirdparty,$mysoc,$tva_npr);
$localtax2_tx=get_localtax($tva_tx,2,$this->thirdparty,$mysoc,$tva_npr);
@ -1485,6 +1487,7 @@ class Commande extends CommonOrder
$line->qty=$qty;
$line->subprice=$price;
$line->remise_percent=$remise_percent;
$line->vat_src_code=$vat_src_code;
$line->tva_tx=$tva_tx;
$line->localtax1_tx=$localtax1_tx;
$line->localtax2_tx=$localtax2_tx;
@ -1703,6 +1706,7 @@ class Commande extends CommonOrder
$line->fk_commande=$this->id;
$line->fk_remise_except=$remise->id;
$line->desc=$remise->description; // Description ligne
$line->vat_src_code=$remise->vat_src_code;
$line->tva_tx=$remise->tva_tx;
$line->subprice=-$remise->amount_ht;
$line->price=-$remise->amount_ht;
@ -1758,7 +1762,7 @@ class Commande extends CommonOrder
$this->lines=array();
$sql = 'SELECT l.rowid, l.fk_product, l.fk_parent_line, l.product_type, l.fk_commande, l.label as custom_label, l.description, l.price, l.qty, l.vat_src_code, l.tva_tx,';
$sql.= ' l.localtax1_tx, l.localtax2_tx, l.fk_remise_except, l.remise_percent, l.subprice, l.fk_product_fournisseur_price as fk_fournprice, l.buy_price_ht as pa_ht, l.rang, l.info_bits, l.special_code,';
$sql.= ' l.localtax1_tx, l.localtax2_tx, l.localtax1_type, l.localtax2_type, l.fk_remise_except, l.remise_percent, l.subprice, l.fk_product_fournisseur_price as fk_fournprice, l.buy_price_ht as pa_ht, l.rang, l.info_bits, l.special_code,';
$sql.= ' l.total_ht, l.total_ttc, l.total_tva, l.total_localtax1, l.total_localtax2, l.date_start, l.date_end,';
$sql.= ' l.fk_unit,';
$sql.= ' l.fk_multicurrency, l.multicurrency_code, l.multicurrency_subprice, l.multicurrency_total_ht, l.multicurrency_total_tva, l.multicurrency_total_ttc,';
@ -1795,9 +1799,11 @@ class Commande extends CommonOrder
$line->vat_src_code = $objp->vat_src_code;
$line->tva_tx = $objp->tva_tx;
$line->localtax1_tx = $objp->localtax1_tx;
$line->localtax1_tx = $objp->localtax1_tx;
$line->localtax2_tx = $objp->localtax2_tx;
$line->total_ht = $objp->total_ht;
$line->localtax1_type = $objp->localtax1_type;
$line->localtax2_type = $objp->localtax2_type;
$line->total_ht = $objp->total_ht;
$line->total_ttc = $objp->total_ttc;
$line->total_tva = $objp->total_tva;
$line->total_localtax1 = $objp->total_localtax1;
@ -3806,6 +3812,7 @@ class OrderLine extends CommonOrderLine
$this->qty = $objp->qty;
$this->price = $objp->price;
$this->subprice = $objp->subprice;
$this->vat_src_code = $objp->vat_src_code;
$this->tva_tx = $objp->tva_tx;
$this->localtax1_tx = $objp->localtax1_tx;
$this->localtax2_tx = $objp->localtax2_tx;
@ -4117,6 +4124,7 @@ class OrderLine extends CommonOrderLine
$sql = "UPDATE ".MAIN_DB_PREFIX."commandedet SET";
$sql.= " description='".$this->db->escape($this->desc)."'";
$sql.= " , label=".(! empty($this->label)?"'".$this->db->escape($this->label)."'":"null");
$sql.= " , vat_src_code=".(! empty($this->vat_src_code)?"'".$this->db->escape($this->vat_src_code)."'":"''");
$sql.= " , tva_tx=".price2num($this->tva_tx);
$sql.= " , localtax1_tx=".price2num($this->localtax1_tx);
$sql.= " , localtax2_tx=".price2num($this->localtax2_tx);

View File

@ -33,6 +33,7 @@ require_once DOL_DOCUMENT_ROOT.'/compta/bank/class/account.class.php';
$langs->load("banks");
$langs->load("categories");
$langs->load("accountancy");
$langs->load("compta");
$action=GETPOST('action','alpha');
$massaction=GETPOST('massaction','alpha');
@ -87,6 +88,7 @@ $arrayfields=array(
'b.label'=>array('label'=>$langs->trans("Label"), 'checked'=>1),
'b.number'=>array('label'=>$langs->trans("AccountIdShort"), 'checked'=>1),
'b.account_number'=>array('label'=>$langs->trans("AccountAccounting"), 'checked'=>$conf->accountancy->enabled),
'b.accountancy_journal'=>array('label'=>$langs->trans("AccountancyJournal"), 'checked'=>$conf->accountancy->enabled),
'toreconcile'=>array('label'=>$langs->trans("TransactionsToConciliate"), 'checked'=>1),
'b.datec'=>array('label'=>$langs->trans("DateCreation"), 'checked'=>0, 'position'=>500),
'b.tms'=>array('label'=>$langs->trans("DateModificationShort"), 'checked'=>0, 'position'=>500),
@ -139,7 +141,7 @@ $title=$langs->trans('BankAccounts');
// Load array of financial accounts (opened by default)
$accounts = array();
$sql = "SELECT rowid, label, courant, rappro, account_number, datec as date_creation, tms as date_update";
$sql = "SELECT rowid, label, courant, rappro, account_number, accountancy_journal, datec as date_creation, tms as date_update";
// Add fields from extrafields
foreach ($extrafields->attribute_label as $key => $val) $sql.=($extrafields->attribute_type[$key] != 'separate' ? ",ef.".$key.' as options_'.$key : '');
// Add fields from hooks
@ -286,6 +288,7 @@ print '<div class="div-table-responsive">';
print '<table class="tagtable liste'.($moreforfilter?" listwithfilterbefore":"").'">'."\n";
print '<tr class="liste_titre_filter">';
// Ref
if (! empty($arrayfields['b.ref']['checked']))
{
@ -306,19 +309,25 @@ if (! empty($arrayfields['accountype']['checked']))
print '<td class="liste_titre">';
print '</td>';
}
// Number
// Bank number
if (! empty($arrayfields['b.number']['checked']))
{
print '<td class="liste_titre">';
print '<input class="flat" size="6" type="text" name="search_number" value="'.$search_number.'">';
print '</td>';
}
// Number
// Account number
if (! empty($arrayfields['b.account_number']['checked']))
{
print '<td class="liste_titre">';
print '</td>';
}
// Accountancy journal
if (! empty($arrayfields['b.accountancy_journal']['checked']))
{
print '<td class="liste_titre">';
print '</td>';
}
// Transactions to reconcile
if (! empty($arrayfields['toreconcile']['checked']))
{
@ -394,6 +403,7 @@ if (! empty($arrayfields['b.label']['checked'])) print_liste_field_titr
if (! empty($arrayfields['accountype']['checked'])) print_liste_field_titre($arrayfields['accountype']['label'],$_SERVER["PHP_SELF"],'','',$param,'',$sortfield,$sortorder);
if (! empty($arrayfields['b.number']['checked'])) print_liste_field_titre($arrayfields['b.number']['label'],$_SERVER["PHP_SELF"],'b.number','',$param,'',$sortfield,$sortorder);
if (! empty($arrayfields['b.account_number']['checked'])) print_liste_field_titre($arrayfields['b.account_number']['label'],$_SERVER["PHP_SELF"],'b.account_number','',$param,'',$sortfield,$sortorder);
if (! empty($arrayfields['b.accountancy_journal']['checked'])) print_liste_field_titre($arrayfields['b.accountancy_journal']['label'],$_SERVER["PHP_SELF"],'b.accountancy_journal','',$param,'',$sortfield,$sortorder);
if (! empty($arrayfields['toreconcile']['checked'])) print_liste_field_titre($arrayfields['toreconcile']['label'],$_SERVER["PHP_SELF"],'','',$param,'align="center"',$sortfield,$sortorder);
// Extra fields
if (is_array($extrafields->attribute_label) && count($extrafields->attribute_label))
@ -482,6 +492,14 @@ foreach ($accounts as $key=>$type)
if (! $i) $totalarray['nbfield']++;
}
// Accountancy journal
if (! empty($arrayfields['b.accountancy_journal']['checked']))
{
include_once DOL_DOCUMENT_ROOT.'/core/lib/accounting.lib.php';
print '<td>'.length_accountg($acc->accountancy_journal).'</td>';
if (! $i) $totalarray['nbfield']++;
}
// Transactions to reconcile
if (! empty($arrayfields['toreconcile']['checked']))
{

View File

@ -1066,7 +1066,7 @@ if (empty($reshook))
{
if ($typeamount == 'amount')
{
$amountdeposit[] = $valuedeposit;
$amountdeposit[0] = $valuedeposit;
}
else
{
@ -1084,9 +1084,11 @@ if (empty($reshook))
}
if ($totalamount != 0) {
$amountdeposit[$lines[$i]->tva] = ($totalamount * $valuedeposit) / 100;
$tva_tx = $lines[$i]->tva_tx;
if (! empty($lines[$i]->vat_src_code) && ! preg_match('/\(/', $tva_tx)) $tva_tx .= ' ('.$lines[$i]->vat_src_code.')';
$amountdeposit[$tva_tx] = ($totalamount * $valuedeposit) / 100;
} else {
$amountdeposit[] = 0;
$amountdeposit[0] = 0;
}
} else {
setEventMessages($srcobject->error, $srcobject->errors, 'errors');
@ -1211,11 +1213,15 @@ if (empty($reshook))
$array_options = $lines[$i]->array_options;
}
// View third's localtaxes for now
$localtax1_tx = get_localtax($lines[$i]->tva_tx, 1, $object->thirdparty);
$localtax2_tx = get_localtax($lines[$i]->tva_tx, 2, $object->thirdparty);
$tva_tx = $lines[$i]->tva_tx;
if (! empty($lines[$i]->vat_src_code) && ! preg_match('/\(/', $tva_tx)) $tva_tx .= ' ('.$lines[$i]->vat_src_code.')';
// View third's localtaxes for NOW and do not use value from origin.
// TODO Is this really what we want ? Yes if source if template invoice but what if proposal or order ?
$localtax1_tx = get_localtax($tva_tx, 1, $object->thirdparty);
$localtax2_tx = get_localtax($tva_tx, 2, $object->thirdparty);
$result = $object->addline($desc, $lines[$i]->subprice, $lines[$i]->qty, $lines[$i]->tva_tx, $localtax1_tx, $localtax2_tx, $lines[$i]->fk_product, $lines[$i]->remise_percent, $date_start, $date_end, 0, $lines[$i]->info_bits, $lines[$i]->fk_remise_except, 'HT', 0, $product_type, $lines[$i]->rang, $lines[$i]->special_code, $object->origin, $lines[$i]->rowid, $fk_parent_line, $lines[$i]->fk_fournprice, $lines[$i]->pa_ht, $label, $array_options, $lines[$i]->situation_percent, $lines[$i]->fk_prev_id, $lines[$i]->fk_unit);
$result = $object->addline($desc, $lines[$i]->subprice, $lines[$i]->qty, $tva_tx, $localtax1_tx, $localtax2_tx, $lines[$i]->fk_product, $lines[$i]->remise_percent, $date_start, $date_end, 0, $lines[$i]->info_bits, $lines[$i]->fk_remise_except, 'HT', 0, $product_type, $lines[$i]->rang, $lines[$i]->special_code, $object->origin, $lines[$i]->rowid, $fk_parent_line, $lines[$i]->fk_fournprice, $lines[$i]->pa_ht, $label, $array_options, $lines[$i]->situation_percent, $lines[$i]->fk_prev_id, $lines[$i]->fk_unit);
if ($result > 0) {
$lineid = $result;
@ -3623,8 +3629,7 @@ else if ($id > 0 || ! empty($ref))
print '<tr class="liste_titre">';
print '<td>' . $langs->trans('ListOfNextSituationInvoices') . '</td>';
print '<td></td>';
if (! empty($conf->banque->enabled))
print '<td align="right"></td>';
if (! empty($conf->banque->enabled)) print '<td align="right"></td>';
print '<td align="right">' . $langs->trans('AmountHT') . '</td>';
print '<td align="right">' . $langs->trans('AmountTTC') . '</td>';
print '<td width="18">&nbsp;</td>';
@ -3640,8 +3645,7 @@ else if ($id > 0 || ! empty($ref))
print '<tr ' . $bc[$var] . '>';
print '<td>' . $next_invoice->getNomUrl(1) . '</td>';
print '<td></td>';
if (! empty($conf->banque->enabled))
print '<td align="right"></td>';
if (! empty($conf->banque->enabled)) print '<td align="right"></td>';
print '<td align="right">' . price($next_invoice->total_ht) . '</td>';
print '<td align="right">' . price($next_invoice->total_ttc) . '</td>';
print '<td align="right">' . $next_invoice->getLibStatut(3, $totalpaye) . '</td>';
@ -3652,8 +3656,7 @@ else if ($id > 0 || ! empty($ref))
print '<tr ' . $bc[$var] . '>';
print '<td colspan="2" align="right"></td>';
if (! empty($conf->banque->enabled))
print '<td align="right"></td>';
if (! empty($conf->banque->enabled)) print '<td align="right"></td>';
print '<td align="right"><b>' . price($total_next_ht) . '</b></td>';
print '<td align="right"><b>' . price($total_next_ttc) . '</b></td>';

View File

@ -951,6 +951,7 @@ class Facture extends CommonInvoice
$line->total_ht = $object->lines[$i]->total_ht;
$line->total_tva = $object->lines[$i]->total_tva;
$line->total_ttc = $object->lines[$i]->total_ttc;
$line->vat_src_code = $object->lines[$i]->vat_src_code;
$line->tva_tx = $object->lines[$i]->tva_tx;
$line->localtax1_tx = $object->lines[$i]->localtax1_tx;
$line->localtax2_tx = $object->lines[$i]->localtax2_tx;
@ -1550,6 +1551,7 @@ class Facture extends CommonInvoice
$facligne->fk_facture=$this->id;
$facligne->fk_remise_except=$remise->id;
$facligne->desc=$remise->description; // Description ligne
$facligne->vat_src_code=$remise->vat_src_code;
$facligne->tva_tx=$remise->tva_tx;
$facligne->subprice=-$remise->amount_ht;
$facligne->fk_product=0; // Id produit predefini
@ -2398,7 +2400,7 @@ class Facture extends CommonInvoice
* @param string $desc Description of line
* @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
* @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 int $fk_product Id of predefined product/service
@ -4225,7 +4227,7 @@ class FactureLigne extends CommonInvoiceLine
*/
function fetch($rowid)
{
$sql = 'SELECT fd.rowid, fd.fk_facture, fd.fk_parent_line, fd.fk_product, fd.product_type, fd.label as custom_label, fd.description, fd.price, fd.qty, fd.tva_tx,';
$sql = 'SELECT fd.rowid, fd.fk_facture, fd.fk_parent_line, fd.fk_product, fd.product_type, fd.label as custom_label, fd.description, fd.price, fd.qty, fd.vat_src_code, fd.tva_tx,';
$sql.= ' fd.localtax1_tx, fd. localtax2_tx, fd.remise, fd.remise_percent, fd.fk_remise_except, fd.subprice,';
$sql.= ' fd.date_start as date_start, fd.date_end as date_end, fd.fk_product_fournisseur_price as fk_fournprice, fd.buy_price_ht as pa_ht,';
$sql.= ' fd.info_bits, fd.special_code, fd.total_ht, fd.total_tva, fd.total_ttc, fd.total_localtax1, fd.total_localtax2, fd.rang,';
@ -4253,6 +4255,7 @@ class FactureLigne extends CommonInvoiceLine
$this->desc = $objp->description;
$this->qty = $objp->qty;
$this->subprice = $objp->subprice;
$this->vat_src_code = $objp->vat_src_code;
$this->tva_tx = $objp->tva_tx;
$this->localtax1_tx = $objp->localtax1_tx;
$this->localtax2_tx = $objp->localtax2_tx;

View File

@ -892,7 +892,6 @@ if ($action == 'create')
$object = new Facture($db); // Source invoice
$product_static = new Product($db);
$formproject = new FormProjets($db);
if ($object->fetch($id, $ref) > 0)
{

View File

@ -332,14 +332,20 @@ if (empty($reshook))
else {
$desc = dol_htmlentitiesbr($lines[$i]->desc);
}
$txtva = $lines[$i]->vat_src_code ? $lines[$i]->tva_tx . ' (' . $lines[$i]->vat_src_code . ')' : $lines[$i]->tva_tx;
// View third's localtaxes for now
$localtax1_tx = get_localtax($txtva, 1, $object->thirdparty);
$localtax2_tx = get_localtax($txtva, 2, $object->thirdparty);
$result = $object->addline(
$desc,
$lines[$i]->subprice,
$lines[$i]->qty,
$lines[$i]->tva_tx,
$lines[$i]->localtax1_tx,
$lines[$i]->localtax2_tx,
$txtva,
$localtax1_tx,
$localtax2_tx,
$lines[$i]->fk_product,
$lines[$i]->remise_percent,
$lines[$i]->date_start,

View File

@ -616,7 +616,7 @@ class Contrat extends CommonObject
// Selectionne les lignes contrats liees a un produit
$sql = "SELECT p.label as product_label, p.description as product_desc, p.ref as product_ref,";
$sql.= " d.rowid, d.fk_contrat, d.statut, d.description, d.price_ht, d.tva_tx, d.localtax1_tx, d.localtax2_tx, d.qty, d.remise_percent, d.subprice, d.fk_product_fournisseur_price as fk_fournprice, d.buy_price_ht as pa_ht,";
$sql.= " d.rowid, d.fk_contrat, d.statut, d.description, d.price_ht, d.vat_src_code, d.tva_tx, d.localtax1_tx, d.localtax2_tx, d.localtax1_type, d.localtax2_type, d.qty, d.remise_percent, d.subprice, d.fk_product_fournisseur_price as fk_fournprice, d.buy_price_ht as pa_ht,";
$sql.= " d.total_ht,";
$sql.= " d.total_tva,";
$sql.= " d.total_localtax1,";
@ -650,9 +650,12 @@ class Contrat extends CommonObject
$line->fk_contrat = $objp->fk_contrat;
$line->desc = $objp->description; // Description ligne
$line->qty = $objp->qty;
$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->subprice = $objp->subprice;
$line->statut = $objp->statut;
$line->remise_percent = $objp->remise_percent;
@ -2722,6 +2725,7 @@ class ContratLigne extends CommonObjectLine
$this->statut=(int) $this->statut;
$this->label=trim($this->label);
$this->description=trim($this->description);
$this->vat_src_code=trim($this->vat_src_code);
$this->tva_tx=trim($this->tva_tx);
$this->localtax1_tx=trim($this->localtax1_tx);
$this->localtax2_tx=trim($this->localtax2_tx);
@ -2793,6 +2797,7 @@ class ContratLigne extends CommonObjectLine
$sql.= " date_ouverture=".($this->date_ouverture!=''?"'".$this->db->idate($this->date_ouverture)."'":"null").",";
$sql.= " date_fin_validite=".($this->date_fin_validite!=''?"'".$this->db->idate($this->date_fin_validite)."'":"null").",";
$sql.= " date_cloture=".($this->date_cloture!=''?"'".$this->db->idate($this->date_cloture)."'":"null").",";
$sql.= " vat_src_code='".$this->vat_src_code."',";
$sql.= " tva_tx='".$this->tva_tx."',";
$sql.= " localtax1_tx='".$this->localtax1_tx."',";
$sql.= " localtax2_tx='".$this->localtax2_tx."',";
@ -2921,6 +2926,7 @@ class ContratLigne extends CommonObjectLine
$sql.= ") VALUES ($this->fk_contrat, '', '" . $this->db->escape($this->description) . "',";
$sql.= ($this->fk_product>0 ? $this->fk_product : "null").",";
$sql.= " '".$this->qty."',";
$sql.= " '".$this->vat_src_code."',";
$sql.= " '".$this->tva_tx."',";
$sql.= " '".$this->localtax1_tx."',";
$sql.= " '".$this->localtax2_tx."',";

View File

@ -549,6 +549,12 @@ abstract class CommonInvoiceLine extends CommonObjectLine
*/
public $fk_product;
/**
* VAT code
* @var string
*/
public $vat_src_code;
/**
* VAT %
* @var float

View File

@ -3040,12 +3040,12 @@ abstract class CommonObject
*/
function getTotalWeightVolume()
{
$weightUnit=0;
$volumeUnit=0;
$totalWeight = '';
$totalVolume = '';
$totalOrdered = ''; // defined for shipment only
$totalToShip = ''; // defined for shipment only
$totalWeight = 0;
$totalVolume = 0;
// defined for shipment only
$totalOrdered = '';
// defined for shipment only
$totalToShip = '';
foreach ($this->lines as $line)
{
@ -3060,11 +3060,18 @@ abstract class CommonObject
$totalToShip+=$line->qty_shipped; // defined for shipment only
}
// Define qty, weight, volume, weight_units, volume_units
if ($this->element == 'shipping') $qty=$line->qty_shipped; // for shipments
else $qty=$line->qty;
$weight=$line->weight;
$volume=$line->volume;
// Define qty, weight, volume, weight_units, volume_units
if ($this->element == 'shipping') {
// for shipments
$qty = $line->qty_shipped ? $line->qty_shipped : 0;
}
else {
$qty = $line->qty ? $line->qty : 0;
}
$weight = $line->weight ? $line->weight : 0;
$volume = $line->volume ? $line->volume : 0;
$weight_units=$line->weight_units;
$volume_units=$line->volume_units;
@ -3566,7 +3573,7 @@ abstract class CommonObject
print '<tr class="liste_titre">';
print '<td>'.$langs->trans('Ref').'</td>';
print '<td>'.$langs->trans('Description').'</td>';
print '<td align="right">'.$langs->trans('VAT').'</td>';
print '<td align="right">'.$langs->trans('VATRate').'</td>';
print '<td align="right">'.$langs->trans('PriceUHT').'</td>';
if (!empty($conf->multicurrency->enabled)) print '<td align="right">'.$langs->trans('PriceUHTCurrency').'</td>';
print '<td align="right">'.$langs->trans('Qty').'</td>';
@ -3703,7 +3710,10 @@ abstract class CommonObject
$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.')';
$this->tpl['price'] = price($line->subprice);
$this->tpl['multicurrency_price'] = price($line->multicurrency_subprice);
$this->tpl['qty'] = (($line->info_bits & 2) != 2) ? $line->qty : '&nbsp;';

View File

@ -986,18 +986,23 @@ class Form
}
// mode 1
$urloption='htmlname='.$htmlname.'&outjson=1&filter='.$filter;
print ajax_autocompleter($selected, $htmlname, DOL_URL_ROOT.'/societe/ajax/company.php', $urloption, $conf->global->COMPANY_USE_SEARCH_TO_SELECT, 0, $ajaxoptions);
$out.= ajax_autocompleter($selected, $htmlname, DOL_URL_ROOT.'/societe/ajax/company.php', $urloption, $conf->global->COMPANY_USE_SEARCH_TO_SELECT, 0, $ajaxoptions);
$out.='<style type="text/css">
.ui-autocomplete {
z-index: 150;
}
</style>';
if (empty($hidelabel)) print $langs->trans("RefOrLabel").' : ';
else if ($hidelabel > 1) {
if (! empty($conf->global->MAIN_HTML5_PLACEHOLDER)) $placeholder=' placeholder="'.$langs->trans("RefOrLabel").'"';
else $placeholder=' title="'.$langs->trans("RefOrLabel").'"';
if ($hidelabel == 2) {
print img_picto($langs->trans("Search"), 'search');
$out.= img_picto($langs->trans("Search"), 'search');
}
}
print '<input type="text" class="'.$morecss.'" name="search_'.$htmlname.'" id="search_'.$htmlname.'" value="'.$selected_input_value.'"'.$placeholder.' '.(!empty($conf->global->THIRDPARTY_SEARCH_AUTOFOCUS) ? 'autofocus' : '').' />';
$out.= '<input type="text" class="'.$morecss.'" name="search_'.$htmlname.'" id="search_'.$htmlname.'" value="'.$selected_input_value.'"'.$placeholder.' '.(!empty($conf->global->THIRDPARTY_SEARCH_AUTOFOCUS) ? 'autofocus' : '').' />';
if ($hidelabel == 3) {
print img_picto($langs->trans("Search"), 'search');
$out.= img_picto($langs->trans("Search"), 'search');
}
}
else

View File

@ -180,7 +180,7 @@ function length_accounta($accounta)
if ($accounta < 0 || empty($accounta)) return '';
if (! empty($conf->global->ACCOUNTING_MANAGE_ZERO)) return $account;
if (! empty($conf->global->ACCOUNTING_MANAGE_ZERO)) return $accounta;
$a = $conf->global->ACCOUNTING_LENGTH_AACCOUNT;
if (! empty($a)) {

View File

@ -181,10 +181,12 @@ function ajax_autocompleter($selected, $htmlname, $url, $urloption='', $minLengt
});
}
console.log("ajax_autocompleter new value selected, we trigger change on original component so field #search_'.$htmlname.'");
$("#search_'.$htmlname.'").trigger("change"); // We have changed value of the combo select, we must be sure to trigger all js hook binded on this event. This is required to trigger other javascript change method binded on original field by other code.
}
,delay: 500
}).data("ui-autocomplete")._renderItem = function( ul, item ) {
return $("<li>")
.data( "ui-autocomplete-item", item ) // jQuery UI > 1.10.0
.append( \'<a><span class="tag">\' + item.label + "</span></a>" )

View File

@ -2058,7 +2058,7 @@ function dol_check_secure_access_document($modulepart,$original_file,$entity,$fu
}
// Wrapping pour les dons
else if ($modulepart == 'donation' && !empty($conf->donation->dir_output))
else if ($modulepart == 'donation' && !empty($conf->don->dir_output))
{
if ($fuser->rights->don->lire || preg_match('/^specimen/i',$original_file))
{

View File

@ -1161,7 +1161,7 @@ function check_value($mask,$value)
// If an offset is asked
if (! empty($reg[2]) && preg_match('/^\+/',$reg[2])) $maskoffset=preg_replace('/^\+/','',$reg[2]);
if (! empty($reg[3]) && preg_match('^\+',$reg[3])) $maskoffset=preg_replace('/^\+/','',$reg[3]);
if (! empty($reg[3]) && preg_match('/^\+/',$reg[3])) $maskoffset=preg_replace('/^\+/','',$reg[3]);
// Define $sqlwhere

View File

@ -1487,6 +1487,9 @@ class CommandeFournisseur extends CommonOrder
$localtax2_type=$localtaxes_type[2];
$subprice = price2num($pu,'MU');
$rangmax = $this->line_max();
$rang = $rangmax + 1;
// Insert line
$this->line=new CommandeFournisseurLigne($this->db);

View File

@ -1,14 +1,16 @@
<?php
require 'SegmentIterator.php';
class SegmentException extends Exception
{}
{
}
/**
* Class for handling templating segments with odt files
* You need PHP 5.2 at least
* You need Zip Extension or PclZip library
*
* @copyright GPL License 2008 - Julien Pauli - Cyril PIERRE de GEYER - Anaska (http://www.anaska.com)
* @copyright GPL License 2012 - Stephen Larroque - lrq3000@gmail.com
* @copyright 2008 - Julien Pauli - Cyril PIERRE de GEYER - Anaska (http://www.anaska.com)
* @copyright 2012 - Stephen Larroque - lrq3000@gmail.com
* @license http://www.gnu.org/copyleft/gpl.html GPL License
* @version 1.4.5 (last update 2013-04-07)
*/
@ -22,11 +24,13 @@ class Segment implements IteratorAggregate, Countable
protected $images = array();
protected $odf;
protected $file;
/**
* Constructor
*
* @param string $name name of the segment to construct
* @param string $xml XML tree of the segment
* @param string $name name of the segment to construct
* @param string $xml XML tree of the segment
* @param string $odf odf
*/
public function __construct($name, $xml, $odf)
{
@ -154,6 +158,7 @@ class Segment implements IteratorAggregate, Countable
return $this->xmlParsed;
}
/**
* Function to replace macros for invoice short and long month, invoice year
*
@ -177,10 +182,11 @@ class Segment implements IteratorAggregate, Countable
return $text;
}
/**
* Analyse the XML code in order to find children
*
* @param string $xml
* @param string $xml Xml
* @return Segment
*/
protected function _analyseChildren($xml)
@ -197,11 +203,14 @@ class Segment implements IteratorAggregate, Countable
}
return $this;
}
/**
* Assign a template variable to replace
*
* @param string $key
* @param string $value
* @param string $key Key
* @param string $value Value
* @param string $encode Encode
* @param string $charset Charset
* @throws SegmentException
* @return Segment
*/
@ -255,7 +264,7 @@ IMG;
/**
* Shortcut to retrieve a child
*
* @param string $prop
* @param string $prop Prop
* @return Segment
* @throws SegmentException
*/
@ -270,8 +279,8 @@ IMG;
/**
* Proxy for setVars
*
* @param string $meth
* @param array $args
* @param string $meth Meth
* @param array $args Args
* @return Segment
*/
public function __call($meth, $args)

View File

@ -1,16 +1,20 @@
<?php
require 'Segment.php';
class OdfException extends Exception
{}
{
}
/**
* Templating class for odt file
* You need PHP 5.2 at least
* You need Zip Extension or PclZip library
*
* @copyright GPL License 2008 - Julien Pauli - Cyril PIERRE de GEYER - Anaska (http://www.anaska.com)
* @copyright GPL License 2010-2015 - Laurent Destailleur - eldy@users.sourceforge.net
* @copyright GPL License 2010 - Vikas Mahajan - http://vikasmahajan.wordpress.com
* @copyright GPL License 2012 - Stephen Larroque - lrq3000@gmail.com
* @copyright 2008 - Julien Pauli - Cyril PIERRE de GEYER - Anaska (http://www.anaska.com)
* @copyright 2010-2015 - Laurent Destailleur - eldy@users.sourceforge.net
* @copyright 2010 - Vikas Mahajan - http://vikasmahajan.wordpress.com
* @copyright 2012 - Stephen Larroque - lrq3000@gmail.com
* @license http://www.gnu.org/copyleft/gpl.html GPL License
* @version 1.5.0
*/
@ -43,7 +47,8 @@ class Odf
/**
* Class constructor
*
* @param string $filename the name of the odt file
* @param string $filename The name of the odt file
* @param string $config Array of config data
* @throws OdfException
*/
public function __construct($filename, $config = array())
@ -116,9 +121,10 @@ class Odf
/**
* Assing a template variable
*
* @param string $key name of the variable within the template
* @param string $value replacement value
* @param bool $encode if true, special XML characters are encoded
* @param string $key Name of the variable within the template
* @param string $value Replacement value
* @param bool $encode If true, special XML characters are encoded
* @param string $charset Charset
* @throws OdfException
* @return odf
*/
@ -129,7 +135,7 @@ class Odf
// <text:span text:style-name="T13">{</text:span><text:span text:style-name="T12">aaa</text:span><text:span text:style-name="T13">}</text:span>
// instead of {aaa} so we should enhance this function.
//print $key.'-'.$value.'-'.strpos($this->contentXml, $this->config['DELIMITER_LEFT'] . $key . $this->config['DELIMITER_RIGHT']).'<br>';
if (strpos($this->contentXml, $tag) === false && strpos($this->stylesXml , $tag) === false) {
if (strpos($this->contentXml, $tag) === false && strpos($this->stylesXml, $tag) === false) {
//if (strpos($this->contentXml, '">'. $key . '</text;span>') === false) {
throw new OdfException("var $key not found in the document");
//}
@ -577,6 +583,7 @@ IMG;
}
else
{
dol_syslog(get_class($this).'::exportAsAttachedPDF is used but the constant MAIN_DOL_SCRIPTS_ROOT with path to script directory was not defined.', LOG_WARNING);
$command = '../../scripts/odt2pdf/odt2pdf.sh '.escapeshellcmd($name).' '.(is_numeric($conf->global->MAIN_ODT_AS_PDF)?'jodconverter':$conf->global->MAIN_ODT_AS_PDF);
}
@ -642,7 +649,8 @@ IMG;
/**
* Returns a variable of configuration
*
* @return string The requested variable of configuration
* @param string $configKey Config key
* @return string The requested variable of configuration
*/
public function getConfig($configKey)
{
@ -678,7 +686,8 @@ IMG;
/**
* Empty the temporary working directory recursively
* @param $dir the temporary working directory
*
* @param string $dir The temporary working directory
* @return void
*/
private function _rrmdir($dir)
@ -701,8 +710,8 @@ IMG;
/**
* return the value present on odt in [valuename][/valuename]
*
* @param string $value name balise in the template
* @return string the value inside the balise
* @param string $valuename Balise in the template
* @return string The value inside the balise
*/
public function getvalue($valuename)
{

View File

@ -263,3 +263,4 @@ ALTER TABLE llx_product_price ALTER COLUMN date_price SET DEFAULT NULL;
ALTER TABLE llx_product_price ADD COLUMN default_vat_code varchar(10) after tva_tx;
ALTER TABLE llx_product_fournisseur_price ADD COLUMN default_vat_code varchar(10) after tva_tx;
ALTER TABLE llx_events MODIFY COLUMN ip varchar(250);

View File

@ -306,6 +306,18 @@ DELETE FROM llx_c_shipment_mode where code IN (select code from tmp_c_shipment_m
drop table tmp_c_shipment_mode;
-- Clean product prices
--delete from llx_product_price where date_price between '2017-04-20 06:51:00' and '2017-04-20 06:51:05';
-- Set product prices into llx_product with last price into llx_product_prices
--update llx_product as p set
-- p.price = (select pp.price from llx_product_price as pp where pp.price_level = 1 and pp.fk_product = p.rowid order by pp.tms desc limit 1),
-- p.price_ttc = (select pp.price_ttc from llx_product_price as pp where pp.price_level = 1 and pp.fk_product = p.rowid order by pp.tms desc limit 1),
-- p.price_min = (select pp.price_min from llx_product_price as pp where pp.price_level = 1 and pp.fk_product = p.rowid order by pp.tms desc limit 1),
-- p.price_min_ttc = (select pp.price_min_ttc from llx_product_price as pp where pp.price_level = 1 and pp.fk_product = p.rowid order by pp.tms desc limit 1),
-- p.tva_tx = 0
-- where price = 17.5
-- VMYSQL4.1 SET sql_mode = 'ALLOW_INVALID_DATES';
-- VMYSQL4.1 update llx_expensereport set date_debut = date_create where DATE(STR_TO_DATE(date_debut, '%Y-%m-%d')) IS NULL;
-- VMYSQL4.1 SET sql_mode = 'NO_ZERO_DATE';
@ -324,3 +336,4 @@ drop table tmp_c_shipment_mode;
-- VMYSQL4.1 SET sql_mode = 'ALLOW_INVALID_DATES';
-- VMYSQL4.1 update llx_expensereport_det as ed set date = (select date_debut from llx_expensereport as e where ed.fk_expensereport = e.rowid) where DATE(STR_TO_DATE(date, '%Y-%m-%d')) < '1000-00-00';
-- VMYSQL4.1 SET sql_mode = 'NO_ZERO_DATE';

View File

@ -30,7 +30,7 @@ create table llx_events
dateevent datetime, -- date event
fk_user integer, -- id user
description varchar(250) NOT NULL, -- full description of action
ip varchar(32) NOT NULL, -- ip
ip varchar(250) NOT NULL, -- ip (must contains ip v4 and v6 or dns names)
user_agent varchar(255) NULL, -- user agent
fk_object integer -- id of related object
) ENGINE=innodb;

View File

@ -172,7 +172,7 @@ SearchOf=Search
Valid=Valid
Approve=Approve
Disapprove=Disapprove
ReOpen=Re-Opened
ReOpen=Re-Open
Upload=Send file
ToLink=Link
Select=Select

View File

@ -42,8 +42,6 @@ $oldvatrate=GETPOST('oldvatrate');
$newvatrate=GETPOST('newvatrate');
//$price_base_type=GETPOST('price_base_type');
$objectstatic = new Product($db);
$objectstatic2 = new ProductFournisseur($db);
/*
@ -87,6 +85,7 @@ if ($action == 'convert')
{
$obj = $db->fetch_object($resql);
$objectstatic = new Product($db); // Object init must be into loop to avoid to get value of previous step
$ret=$objectstatic->fetch($obj->rowid);
if ($ret > 0)
{
@ -150,7 +149,8 @@ if ($action == 'convert')
if ($ret < 0 || $retm < 0) $error++;
else $nbrecordsmodified++;
}
unset($objectstatic);
$i++;
}
}
@ -176,6 +176,7 @@ if ($action == 'convert')
{
$obj = $db->fetch_object($resql);
$objectstatic2 = new ProductFournisseur($db); // Object init must be into loop to avoid to get value of previous step
$ret=$objectstatic2->fetch_product_fournisseur_price($obj->rowid);
if ($ret > 0)
{
@ -207,6 +208,8 @@ if ($action == 'convert')
if ($ret < 0 || $retm < 0) $error++;
else $nbrecordsmodified++;
}
unset($objectstatic2);
$i++;
}
}

View File

@ -1743,7 +1743,7 @@ else
//TODO: Place into a function to control showing by country or study better option
if($mysoc->localtax1_assuj=="1" && $mysoc->localtax2_assuj=="1")
{
print '<tr><td>'.fieldLabel($langs->transcountry("LocalTax1IsUsed",$mysoc->country_code),'localtax1assuj_value').'</td><td colspan="3">';
print '<tr><td>'.fieldLabel($langs->transcountry("LocalTax1IsUsed",$mysoc->country_code),'localtax1assuj_value').'</td><td>';
print $form->selectyesno('localtax1assuj_value',$object->localtax1_assuj,1);
if(! isOnlyOneLocalTax(1))
{
@ -1752,7 +1752,7 @@ else
print '</span>';
}
print '</td><td>'.fieldLabel($langs->transcountry("LocalTax2IsUsed",$mysoc->country_code),'localtax2assuj_value').'</td><td colspan="3">';
print '</td><td>'.fieldLabel($langs->transcountry("LocalTax2IsUsed",$mysoc->country_code),'localtax2assuj_value').'</td><td>';
print $form->selectyesno('localtax2assuj_value',$object->localtax2_assuj,1);
if (! isOnlyOneLocalTax(2))
{

View File

@ -2835,7 +2835,7 @@ class SupplierProposalLine extends CommonObjectLine
$sql.= " ".price2num($this->localtax2_tx).",";
$sql.= " '".$this->localtax1_type."',";
$sql.= " '".$this->localtax2_type."',";
$sql.= " ".($this->subprice?price2num($this->subprice):"null").",";
$sql.= " ".price2num($this->subprice).",";
$sql.= " ".price2num($this->remise_percent).",";
$sql.= " ".(isset($this->info_bits)?"'".$this->info_bits."'":"null").",";
$sql.= " ".price2num($this->total_ht).",";

View File

@ -155,25 +155,25 @@ if (! empty($user->conf->THEME_ELDY_ENABLE_PERSONALIZED))
// Set text color to black or white
$tmppart=explode(',',$colorbackhmenu1);
$tmpval=(! empty($tmppart[0]) ? $tmppart[0] : '')+(! empty($tmppart[1]) ? $tmppart[1] : '')+(! empty($tmppart[2]) ? $tmppart[2] : '');
$tmpval=(! empty($tmppart[0]) ? $tmppart[0] : 0)+(! empty($tmppart[1]) ? $tmppart[1] : 0)+(! empty($tmppart[2]) ? $tmppart[2] : 0);
if ($tmpval <= 460) $colortextbackhmenu='FFFFFF';
else $colortextbackhmenu='000000';
$tmppart=explode(',',$colorbackvmenu1);
$tmpval=(! empty($tmppart[0]) ? $tmppart[0] : '')+(! empty($tmppart[1]) ? $tmppart[1] : '')+(! empty($tmppart[2]) ? $tmppart[2] : '');
$tmpval=(! empty($tmppart[0]) ? $tmppart[0] : 0)+(! empty($tmppart[1]) ? $tmppart[1] : 0)+(! empty($tmppart[2]) ? $tmppart[2] : 0);
if ($tmpval <= 460) { $colortextbackvmenu='FFFFFF'; }
else { $colortextbackvmenu='000000'; }
$tmppart=explode(',',$colorbacktitle1);
if ($colortexttitle == '')
{
$tmpval=(! empty($tmppart[0]) ? $tmppart[0] : '')+(! empty($tmppart[1]) ? $tmppart[1] : '')+(! empty($tmppart[2]) ? $tmppart[2] : '');
$tmpval=(! empty($tmppart[0]) ? $tmppart[0] : 0)+(! empty($tmppart[1]) ? $tmppart[1] : 0)+(! empty($tmppart[2]) ? $tmppart[2] : 0);
if ($tmpval <= 460) { $colortexttitle='FFFFFF'; $colorshadowtitle='888888'; }
else { $colortexttitle='000000'; $colorshadowtitle='FFFFFF'; }
}
$tmppart=explode(',',$colorbacktabcard1);
$tmpval=(! empty($tmppart[0]) ? $tmppart[0] : '')+(! empty($tmppart[1]) ? $tmppart[1] : '')+(! empty($tmppart[2]) ? $tmppart[2] : '');
$tmpval=(! empty($tmppart[0]) ? $tmppart[0] : 0)+(! empty($tmppart[1]) ? $tmppart[1] : 0)+(! empty($tmppart[2]) ? $tmppart[2] : 0);
if ($tmpval <= 460) { $colortextbacktab='FFFFFF'; }
else { $colortextbacktab='111111'; }

View File

@ -159,25 +159,25 @@ if (empty($colortopbordertitle1)) $colortopbordertitle1=$colorbackhmenu1;
// Set text color to black or white
$tmppart=explode(',',$colorbackhmenu1);
$tmpval=(! empty($tmppart[0]) ? $tmppart[0] : '')+(! empty($tmppart[1]) ? $tmppart[1] : '')+(! empty($tmppart[2]) ? $tmppart[2] : '');
$tmpval=(! empty($tmppart[0]) ? $tmppart[0] : 0)+(! empty($tmppart[1]) ? $tmppart[1] : 0)+(! empty($tmppart[2]) ? $tmppart[2] : 0);
if ($tmpval <= 460) $colortextbackhmenu='FFFFFF';
else $colortextbackhmenu='000000';
$tmppart=explode(',',$colorbackvmenu1);
$tmpval=(! empty($tmppart[0]) ? $tmppart[0] : '')+(! empty($tmppart[1]) ? $tmppart[1] : '')+(! empty($tmppart[2]) ? $tmppart[2] : '');
$tmpval=(! empty($tmppart[0]) ? $tmppart[0] : 0)+(! empty($tmppart[1]) ? $tmppart[1] : 0)+(! empty($tmppart[2]) ? $tmppart[2] : 0);
if ($tmpval <= 460) { $colortextbackvmenu='FFFFFF'; }
else { $colortextbackvmenu='000000'; }
$tmppart=explode(',',$colorbacktitle1);
if ($colortexttitle == '')
{
$tmpval=(! empty($tmppart[0]) ? $tmppart[0] : '')+(! empty($tmppart[1]) ? $tmppart[1] : '')+(! empty($tmppart[2]) ? $tmppart[2] : '');
$tmpval=(! empty($tmppart[0]) ? $tmppart[0] : 0)+(! empty($tmppart[1]) ? $tmppart[1] : 0)+(! empty($tmppart[2]) ? $tmppart[2] : 0);
if ($tmpval <= 460) { $colortexttitle='FFFFFF'; $colorshadowtitle='888888'; }
else { $colortexttitle='101010'; $colorshadowtitle='FFFFFF'; }
}
$tmppart=explode(',',$colorbacktabcard1);
$tmpval=(! empty($tmppart[0]) ? $tmppart[0] : '')+(! empty($tmppart[1]) ? $tmppart[1] : '')+(! empty($tmppart[2]) ? $tmppart[2] : '');
$tmpval=(! empty($tmppart[0]) ? $tmppart[0] : 0)+(! empty($tmppart[1]) ? $tmppart[1] : 0)+(! empty($tmppart[2]) ? $tmppart[2] : 0);
if ($tmpval <= 460) { $colortextbacktab='FFFFFF'; }
else { $colortextbacktab='111111'; }