Merge branch '6.0' of github.com:Dolibarr/dolibarr into FIX_replenish_stock_line_0
This commit is contained in:
commit
8866683a72
@ -78,34 +78,54 @@ if (preg_match('/del_(.*)/',$action,$reg))
|
||||
|
||||
if ($action == 'add_currency')
|
||||
{
|
||||
$error=0;
|
||||
|
||||
$langs->loadCacheCurrencies('');
|
||||
|
||||
$code = GETPOST('code', 'alpha');
|
||||
$rate = GETPOST('rate', 'alpha');
|
||||
$rate = price2num(GETPOST('rate', 'alpha'));
|
||||
$currency = new MultiCurrency($db);
|
||||
$currency->code = $code;
|
||||
$currency->name = !empty($langs->cache_currencies[$code]['label']) ? $langs->cache_currencies[$code]['label'].' ('.$langs->getCurrencySymbol($code).')' : $code;
|
||||
|
||||
if ($currency->create($user) > 0)
|
||||
if (empty($rate))
|
||||
{
|
||||
if ($currency->addRate($rate)) setEventMessages($langs->trans('RecordSaved'), array());
|
||||
else setEventMessages($langs->trans('ErrorAddRateFail'), array(), 'errors');
|
||||
setEventMessages($langs->trans('ErrorFieldRequired', $langs->transnoentitiesnoconv("Rate")), null, 'errors');
|
||||
$error++;
|
||||
}
|
||||
if (! $error)
|
||||
{
|
||||
if ($currency->create($user) > 0)
|
||||
{
|
||||
if ($currency->addRate($rate)) setEventMessages($langs->trans('RecordSaved'), array());
|
||||
else setEventMessages($langs->trans('ErrorAddRateFail'), array(), 'errors');
|
||||
}
|
||||
else setEventMessages($langs->trans('ErrorAddCurrencyFail'), $currency->errors, 'errors');
|
||||
}
|
||||
else setEventMessages($langs->trans('ErrorAddCurrencyFail'), $currency->errors, 'errors');
|
||||
}
|
||||
elseif ($action == 'update_currency')
|
||||
{
|
||||
$error = 0;
|
||||
|
||||
$submit = GETPOST('submit', 'alpha');
|
||||
|
||||
if ($submit == $langs->trans('Modify'))
|
||||
{
|
||||
$fk_multicurrency = GETPOST('fk_multicurrency', 'int');
|
||||
$rate = GETPOST('rate', 'float');
|
||||
$rate = price2num(GETPOST('rate', 'alpha'));
|
||||
$currency = new MultiCurrency($db);
|
||||
|
||||
if ($currency->fetch($fk_multicurrency) > 0)
|
||||
if (empty($rate))
|
||||
{
|
||||
$currency->updateRate($rate);
|
||||
setEventMessages($langs->trans('ErrorFieldRequired', $langs->transnoentitiesnoconv("Rate")), null, 'errors');
|
||||
$error++;
|
||||
}
|
||||
if (! $error)
|
||||
{
|
||||
if ($currency->fetch($fk_multicurrency) > 0)
|
||||
{
|
||||
$currency->updateRate($rate);
|
||||
}
|
||||
}
|
||||
}
|
||||
elseif ($submit == $langs->trans('Delete'))
|
||||
@ -235,7 +255,7 @@ print '</td></tr>';
|
||||
*/
|
||||
|
||||
print '</table>';
|
||||
print '<br />';
|
||||
print '<br>';
|
||||
|
||||
if (!empty($conf->global->MAIN_MULTICURRENCY_ALLOW_SYNCHRONIZATION))
|
||||
{
|
||||
@ -279,7 +299,6 @@ if (!empty($conf->global->MAIN_MULTICURRENCY_ALLOW_SYNCHRONIZATION))
|
||||
print '</form>';
|
||||
print '</td></tr>';
|
||||
|
||||
|
||||
print '<tr class="oddeven">';
|
||||
print '<td>'.$langs->transnoentitiesnoconv("multicurrency_alternateCurrencySource").'</td>';
|
||||
print '<td align="center" width="20"> </td>';
|
||||
@ -325,8 +344,7 @@ print '</td></form></tr>';
|
||||
|
||||
foreach ($TCurrency as &$currency)
|
||||
{
|
||||
if($currency->code == $conf->currency) continue;
|
||||
|
||||
if ($currency->code == $conf->currency) continue;
|
||||
|
||||
print '<tr class="oddeven">';
|
||||
print '<td>'.$currency->code.' - '.$currency->name.'</td>';
|
||||
|
||||
@ -2497,7 +2497,7 @@ if ($action == 'create' && $user->rights->commande->creer)
|
||||
if (! empty($conf->expedition->enabled)) {
|
||||
$numshipping = $object->nb_expedition();
|
||||
|
||||
if ($object->statut > Commande::STATUS_DRAFT && $object->statut < Commande::STATUS_CLOSED && $object->getNbOfProductsLines() > 0) {
|
||||
if ($object->statut > Commande::STATUS_DRAFT && $object->statut < Commande::STATUS_CLOSED && ($object->getNbOfProductsLines() > 0 || !empty($conf->global->STOCK_SUPPORTS_SERVICES))) {
|
||||
if (($conf->expedition_bon->enabled && $user->rights->expedition->creer) || ($conf->livraison_bon->enabled && $user->rights->expedition->livraison->creer)) {
|
||||
if ($user->rights->expedition->creer) {
|
||||
print '<div class="inline-block divButAction"><a class="butAction" href="' . DOL_URL_ROOT . '/expedition/shipment.php?id=' . $object->id . '">' . $langs->trans('CreateShipment') . '</a></div>';
|
||||
|
||||
@ -95,8 +95,10 @@ $month_lim = GETPOST('month_lim','int');
|
||||
$year_lim = GETPOST('year_lim','int');
|
||||
|
||||
$option = GETPOST('option');
|
||||
if ($option == 'late') $filter = 'paye:0';
|
||||
$filtre = GETPOST('filtre');
|
||||
if ($option == 'late') {
|
||||
$search_status = '1';
|
||||
}
|
||||
$filtre = GETPOST('filtre','alpha');
|
||||
|
||||
$limit = GETPOST('limit')?GETPOST('limit','int'):$conf->liste_limit;
|
||||
$sortfield = GETPOST("sortfield",'alpha');
|
||||
@ -386,7 +388,7 @@ if ($search_user > 0)
|
||||
$sql.= ' WHERE f.fk_soc = s.rowid';
|
||||
$sql.= ' AND f.entity IN ('.getEntity('facture').')';
|
||||
if (! $user->rights->societe->client->voir && ! $socid) $sql.= " AND s.rowid = sc.fk_soc AND sc.fk_user = " .$user->id;
|
||||
if ($search_product_category > 0) $sql.=" AND cp.fk_categorie = ".$search_product_category;
|
||||
if ($search_product_category > 0) $sql.=" AND cp.fk_categorie = ".$db->escape($search_product_category);
|
||||
if ($socid > 0) $sql.= ' AND s.rowid = '.$socid;
|
||||
if ($userid)
|
||||
{
|
||||
@ -399,7 +401,7 @@ if ($filtre)
|
||||
foreach ($aFilter as $filter)
|
||||
{
|
||||
$filt = explode(':', $filter);
|
||||
$sql .= ' AND ' . trim($filt[0]) . ' = ' . trim($filt[1]);
|
||||
$sql .= ' AND ' . $db->escape(trim($filt[0])) . ' = ' . $db->escape(trim($filt[1]));
|
||||
}
|
||||
}
|
||||
if ($search_ref) $sql .= natural_search('f.facnumber', $search_ref);
|
||||
@ -433,7 +435,7 @@ if ($search_status != '' && $search_status >= 0)
|
||||
if ($search_status == '2') $sql.=" AND f.fk_statut = 2"; // payed Not that some corrupted data may contains f.fk_statut = 1 AND f.paye = 1 (it means payed too but should not happend. If yes, reopen and reclassify billed)
|
||||
if ($search_status == '3') $sql.=" AND f.fk_statut = 3"; // abandonned
|
||||
}
|
||||
if ($search_paymentmode > 0) $sql .= " AND f.fk_mode_reglement = ".$search_paymentmode;
|
||||
if ($search_paymentmode > 0) $sql .= " AND f.fk_mode_reglement = ".$db->escape($search_paymentmode);
|
||||
if ($month > 0)
|
||||
{
|
||||
if ($year > 0 && empty($day))
|
||||
@ -461,7 +463,6 @@ else if ($year_lim > 0)
|
||||
$sql.= " AND f.date_lim_reglement BETWEEN '".$db->idate(dol_get_first_day($year_lim,1,false))."' AND '".$db->idate(dol_get_last_day($year_lim,12,false))."'";
|
||||
}
|
||||
if ($option == 'late') $sql.=" AND f.date_lim_reglement < '".$db->idate(dol_now() - $conf->facture->client->warning_delay)."'";
|
||||
if ($filter == 'paye:0') $sql.= " AND f.fk_statut = 1";
|
||||
if ($search_sale > 0) $sql.= " AND s.rowid = sc.fk_soc AND sc.fk_user = " .$search_sale;
|
||||
if ($search_user > 0)
|
||||
{
|
||||
|
||||
@ -115,6 +115,11 @@ $companystatic=new Societe($db);
|
||||
$arrayfields=array(
|
||||
'c.ref'=>array('label'=>$langs->trans("Contract"), 'checked'=>1, 'position'=>80),
|
||||
'p.description'=>array('label'=>$langs->trans("Service"), 'checked'=>1, 'position'=>80),
|
||||
'cd.qty'=>array('label'=>$langs->trans("Qty"), 'checked'=>0, 'position'=>100),
|
||||
'cd.total_ht'=>array('label'=>$langs->trans("TotalHT"), 'checked'=>0, 'position'=>100),
|
||||
'cd.total_tva'=>array('label'=>$langs->trans("TotalVAT"), 'checked'=>0, 'position'=>100),
|
||||
'cd.tva_tx'=>array('label'=>$langs->trans("VAT"), 'checked'=>0, 'position'=>100),
|
||||
'cd.subprice'=>array('label'=>$langs->trans("PriceUHT"), 'checked'=>0, 'position'=>100),
|
||||
's.nom'=>array('label'=>$langs->trans("ThirdParty"), 'checked'=>1, 'position'=>100),
|
||||
'cd.date_ouverture_prevue'=>array('label'=>$langs->trans("DateStartPlannedShort"), 'checked'=>(($mode == "" || $mode == -1) || $mode == "0")),
|
||||
'cd.date_ouverture'=>array('label'=>$langs->trans("DateStartRealShort"), 'checked'=>(($mode == "" || $mode == -1) || $mode > 0)),
|
||||
@ -199,7 +204,11 @@ if (!$user->rights->societe->client->voir && !$socid) $sql .= " sc.fk_soc, sc.fk
|
||||
$sql.= " cd.date_ouverture_prevue,";
|
||||
$sql.= " cd.date_ouverture,";
|
||||
$sql.= " cd.date_fin_validite,";
|
||||
$sql.= " cd.date_cloture,";
|
||||
$sql.= " cd.qty,";
|
||||
$sql.= " cd.total_ht,";
|
||||
$sql.= " cd.total_tva,";
|
||||
$sql.= " cd.tva_tx,";
|
||||
$sql.= " cd.subprice,";
|
||||
//$sql.= " cd.date_c as date_creation,";
|
||||
$sql.= " cd.tms as date_update";
|
||||
// Add fields from extrafields
|
||||
@ -362,6 +371,11 @@ print '<table class="tagtable liste'.($moreforfilter?" listwithfilterbefore":"")
|
||||
print '<tr class="liste_titre">';
|
||||
if (! empty($arrayfields['c.ref']['checked'])) print_liste_field_titre($arrayfields['c.ref']['label'],$_SERVER["PHP_SELF"],"c.ref","",$param,"",$sortfield,$sortorder);
|
||||
if (! empty($arrayfields['p.description']['checked'])) print_liste_field_titre($arrayfields['p.description']['label'],$_SERVER["PHP_SELF"],"p.description","",$param,"",$sortfield,$sortorder);
|
||||
if (! empty($arrayfields['cd.qty']['checked'])) print_liste_field_titre($arrayfields['cd.qty']['label'],$_SERVER["PHP_SELF"],"cd.qty","",$param,'align="center" class="nowrap"',$sortfield,$sortorder);
|
||||
if (! empty($arrayfields['cd.total_ht']['checked'])) print_liste_field_titre($arrayfields['cd.total_ht']['label'],$_SERVER["PHP_SELF"],"cd.total_ht","",$param,'align="center" class="nowrap"',$sortfield,$sortorder);
|
||||
if (! empty($arrayfields['cd.total_tva']['checked'])) print_liste_field_titre($arrayfields['cd.total_tva']['label'],$_SERVER["PHP_SELF"],"cd.total_tva","",$param,'align="center" class="nowrap"',$sortfield,$sortorder);
|
||||
if (! empty($arrayfields['cd.tva_tx']['checked'])) print_liste_field_titre($arrayfields['cd.tva_tx']['label'],$_SERVER["PHP_SELF"],"cd.tva_tx","",$param,'align="center" class="nowrap"',$sortfield,$sortorder);
|
||||
if (! empty($arrayfields['cd.subprice']['checked'])) print_liste_field_titre($arrayfields['cd.subprice']['label'],$_SERVER["PHP_SELF"],"cd.subprice","",$param,'align="center" class="nowrap"',$sortfield,$sortorder);
|
||||
if (! empty($arrayfields['s.nom']['checked'])) print_liste_field_titre($arrayfields['s.nom']['label'],$_SERVER["PHP_SELF"],"s.nom","",$param,"",$sortfield,$sortorder);
|
||||
if (! empty($arrayfields['cd.date_ouverture_prevue']['checked'])) print_liste_field_titre($arrayfields['cd.date_ouverture_prevue']['label'],$_SERVER["PHP_SELF"],"cd.date_ouverture_prevue","",$param,'align="center"',$sortfield,$sortorder);
|
||||
if (! empty($arrayfields['cd.date_ouverture']['checked'])) print_liste_field_titre($arrayfields['cd.date_ouverture']['label'],$_SERVER["PHP_SELF"],"cd.date_ouverture","",$param,'align="center"',$sortfield,$sortorder);
|
||||
@ -407,6 +421,32 @@ if (! empty($arrayfields['p.description']['checked']))
|
||||
print '<input type="text" class="flat maxwidth100" name="search_service" value="'.dol_escape_htmltag($search_service).'">';
|
||||
print '</td>';
|
||||
}
|
||||
// detail lines
|
||||
if (! empty($arrayfields['cd.qty']['checked']))
|
||||
{
|
||||
print '<td class="liste_titre">';
|
||||
print '</td>';
|
||||
}
|
||||
if (! empty($arrayfields['cd.total_ht']['checked']))
|
||||
{
|
||||
print '<td class="liste_titre">';
|
||||
print '</td>';
|
||||
}
|
||||
if (! empty($arrayfields['cd.total_tva']['checked']))
|
||||
{
|
||||
print '<td class="liste_titre">';
|
||||
print '</td>';
|
||||
}
|
||||
if (! empty($arrayfields['cd.tva_tx']['checked']))
|
||||
{
|
||||
print '<td class="liste_titre">';
|
||||
print '</td>';
|
||||
}
|
||||
if (! empty($arrayfields['cd.subprice']['checked']))
|
||||
{
|
||||
print '<td class="liste_titre">';
|
||||
print '</td>';
|
||||
}
|
||||
// Third party
|
||||
if (! empty($arrayfields['s.nom']['checked']))
|
||||
{
|
||||
@ -414,6 +454,8 @@ if (! empty($arrayfields['s.nom']['checked']))
|
||||
print '<input type="text" class="flat maxwidth100" name="search_name" value="'.dol_escape_htmltag($search_name).'">';
|
||||
print '</td>';
|
||||
}
|
||||
|
||||
|
||||
if (! empty($arrayfields['cd.date_ouverture_prevue']['checked']))
|
||||
{
|
||||
print '<td class="liste_titre" align="center">';
|
||||
@ -557,6 +599,38 @@ while ($i < min($num,$limit))
|
||||
print '</td>';
|
||||
}
|
||||
|
||||
if (! empty($arrayfields['cd.qty']['checked']))
|
||||
{
|
||||
print '<td>';
|
||||
print $obj->qty;
|
||||
print '</td>';
|
||||
}
|
||||
if (! empty($arrayfields['cd.total_ht']['checked']))
|
||||
{
|
||||
print '<td>';
|
||||
print price($obj->total_ht);
|
||||
print '</td>';
|
||||
}
|
||||
if (! empty($arrayfields['cd.total_tva']['checked']))
|
||||
{
|
||||
print '<td>';
|
||||
print price($obj->total_tva);
|
||||
print '</td>';
|
||||
}
|
||||
if (! empty($arrayfields['cd.tva_tx']['checked']))
|
||||
{
|
||||
print '<td>';
|
||||
print price2num($obj->tva_tx).'%';
|
||||
print '</td>';
|
||||
}
|
||||
if (! empty($arrayfields['cd.subprice']['checked']))
|
||||
{
|
||||
print '<td>';
|
||||
print price($obj->subprice);
|
||||
print '</td>';
|
||||
}
|
||||
|
||||
|
||||
// Third party
|
||||
if (! empty($arrayfields['s.nom']['checked']))
|
||||
{
|
||||
|
||||
@ -463,22 +463,23 @@ if (! $error && $massaction == "builddoc" && $permtoread && ! GETPOST('button_se
|
||||
$outputlangs->setDefaultLang($newlang);
|
||||
}
|
||||
|
||||
if(!empty($conf->global->USE_PDFTK_FOR_PDF_CONCAT)) {
|
||||
if(!empty($conf->global->USE_PDFTK_FOR_PDF_CONCAT))
|
||||
{
|
||||
// Create output dir if not exists
|
||||
dol_mkdir($diroutputmassaction);
|
||||
dol_mkdir($diroutputmassaction);
|
||||
|
||||
// Defined name of merged file
|
||||
$filename=strtolower(dol_sanitizeFileName($langs->transnoentities($objectlabel)));
|
||||
$filename=preg_replace('/\s/','_',$filename);
|
||||
// Defined name of merged file
|
||||
$filename=strtolower(dol_sanitizeFileName($langs->transnoentities($objectlabel)));
|
||||
$filename=preg_replace('/\s/','_',$filename);
|
||||
|
||||
// Save merged file
|
||||
if ($filter=='paye:0')
|
||||
{
|
||||
if ($option=='late') $filename.='_'.strtolower(dol_sanitizeFileName($langs->transnoentities("Unpaid"))).'_'.strtolower(dol_sanitizeFileName($langs->transnoentities("Late")));
|
||||
else $filename.='_'.strtolower(dol_sanitizeFileName($langs->transnoentities("Unpaid")));
|
||||
}
|
||||
if ($year) $filename.='_'.$year;
|
||||
if ($month) $filename.='_'.$month;
|
||||
// Save merged file
|
||||
if (in_array($object->element, array('facture', 'facture_fournisseur')) && $search_status == Facture::STATUS_VALIDATED)
|
||||
{
|
||||
if ($option=='late') $filename.='_'.strtolower(dol_sanitizeFileName($langs->transnoentities("Unpaid"))).'_'.strtolower(dol_sanitizeFileName($langs->transnoentities("Late")));
|
||||
else $filename.='_'.strtolower(dol_sanitizeFileName($langs->transnoentities("Unpaid")));
|
||||
}
|
||||
if ($year) $filename.='_'.$year;
|
||||
if ($month) $filename.='_'.$month;
|
||||
|
||||
if (count($files)>0)
|
||||
{
|
||||
@ -546,7 +547,7 @@ if (! $error && $massaction == "builddoc" && $permtoread && ! GETPOST('button_se
|
||||
$filename=preg_replace('/\s/','_',$filename);
|
||||
|
||||
// Save merged file
|
||||
if ($filter=='paye:0')
|
||||
if (in_array($object->element, array('facture', 'facture_fournisseur')) && $search_status == Facture::STATUS_VALIDATED)
|
||||
{
|
||||
if ($option=='late') $filename.='_'.strtolower(dol_sanitizeFileName($langs->transnoentities("Unpaid"))).'_'.strtolower(dol_sanitizeFileName($langs->transnoentities("Late")));
|
||||
else $filename.='_'.strtolower(dol_sanitizeFileName($langs->transnoentities("Unpaid")));
|
||||
|
||||
@ -2,6 +2,7 @@
|
||||
/* Copyright (C) 2003 Rodolphe Quiedeville <rodolphe@quiedeville.org>
|
||||
* Copyright (C) 2005-2017 Laurent Destailleur <eldy@users.sourceforge.net>
|
||||
* Copyright (C) 2005-2011 Regis Houssin <regis.houssin@capnetworks.com>
|
||||
* Copyright (C) 2017 Nicolas Zabouri <info@inovea-conseil.com>
|
||||
*
|
||||
* 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
|
||||
@ -91,7 +92,7 @@ class box_services_contracts extends ModeleBoxes
|
||||
$sql.= " INNER JOIN ".MAIN_DB_PREFIX."contrat as c ON s.rowid = c.fk_soc";
|
||||
$sql.= " INNER JOIN ".MAIN_DB_PREFIX."contratdet as cd ON c.rowid = cd.fk_contrat";
|
||||
$sql.= " LEFT JOIN ".MAIN_DB_PREFIX."product as p ON cd.fk_product = p.rowid";
|
||||
if (!$user->rights->societe->client->voir && !$user->societe_id) $sql.= "INNER JOIN ".MAIN_DB_PREFIX."societe_commerciaux as sc ON s.rowid = sc.fk_soc AND sc.fk_user = " .$user->id;
|
||||
if (!$user->rights->societe->client->voir && !$user->societe_id) $sql.= " INNER JOIN ".MAIN_DB_PREFIX."societe_commerciaux as sc ON s.rowid = sc.fk_soc AND sc.fk_user = " .$user->id;
|
||||
$sql.= ")";
|
||||
$sql.= " WHERE c.entity = ".$conf->entity;
|
||||
if($user->societe_id) $sql.= " AND s.rowid = ".$user->societe_id;
|
||||
|
||||
@ -1562,22 +1562,22 @@ abstract class CommonObject
|
||||
|
||||
switch ($this->element) {
|
||||
case 'propal':
|
||||
$this->updateline($line->id, $line->subprice, $line->qty, $line->remise_percent, $line->tva_tx, $line->localtax1_tx, $line->localtax2_tx, $line->desc, 'HT', $line->info_bits, $line->special_code, $line->fk_parent_line, $line->skip_update_total, $line->fk_fournprice, $line->pa_ht, $line->label, $line->product_type, $line->date_start, $line->date_end, $line->array_options, $line->fk_unit, $line->multicurrency_subprice);
|
||||
$this->updateline($line->id, $line->subprice, $line->qty, $line->remise_percent, $line->tva_tx, $line->localtax1_tx, $line->localtax2_tx, ($line->description?$line->description:$line->desc), 'HT', $line->info_bits, $line->special_code, $line->fk_parent_line, $line->skip_update_total, $line->fk_fournprice, $line->pa_ht, $line->label, $line->product_type, $line->date_start, $line->date_end, $line->array_options, $line->fk_unit, $line->multicurrency_subprice);
|
||||
break;
|
||||
case 'commande':
|
||||
$this->updateline($line->id, $line->desc, $line->subprice, $line->qty, $line->remise_percent, $line->tva_tx, $line->localtax1_tx, $line->localtax2_tx, 'HT', $line->info_bits, $line->date_start, $line->date_end, $line->product_type, $line->fk_parent_line, $line->skip_update_total, $line->fk_fournprice, $line->pa_ht, $line->label, $line->special_code, $line->array_options, $line->fk_unit, $line->multicurrency_subprice);
|
||||
$this->updateline($line->id, ($line->description?$line->description:$line->desc), $line->subprice, $line->qty, $line->remise_percent, $line->tva_tx, $line->localtax1_tx, $line->localtax2_tx, 'HT', $line->info_bits, $line->date_start, $line->date_end, $line->product_type, $line->fk_parent_line, $line->skip_update_total, $line->fk_fournprice, $line->pa_ht, $line->label, $line->special_code, $line->array_options, $line->fk_unit, $line->multicurrency_subprice);
|
||||
break;
|
||||
case 'facture':
|
||||
$this->updateline($line->id, $line->desc, $line->subprice, $line->qty, $line->remise_percent, $line->date_start, $line->date_end, $line->tva_tx, $line->localtax1_tx, $line->localtax2_tx, 'HT', $line->info_bits, $line->product_type, $line->fk_parent_line, $line->skip_update_total, $line->fk_fournprice, $line->pa_ht, $line->label, $line->special_code, $line->array_options, $line->situation_percent, $line->fk_unit, $line->multicurrency_subprice);
|
||||
$this->updateline($line->id, ($line->description?$line->description:$line->desc), $line->subprice, $line->qty, $line->remise_percent, $line->date_start, $line->date_end, $line->tva_tx, $line->localtax1_tx, $line->localtax2_tx, 'HT', $line->info_bits, $line->product_type, $line->fk_parent_line, $line->skip_update_total, $line->fk_fournprice, $line->pa_ht, $line->label, $line->special_code, $line->array_options, $line->situation_percent, $line->fk_unit, $line->multicurrency_subprice);
|
||||
break;
|
||||
case 'supplier_proposal':
|
||||
$this->updateline($line->id, $line->subprice, $line->qty, $line->remise_percent, $line->tva_tx, $line->localtax1_tx, $line->localtax2_tx, $line->desc, 'HT', $line->info_bits, $line->special_code, $line->fk_parent_line, $line->skip_update_total, $line->fk_fournprice, $line->pa_ht, $line->label, $line->product_type, $line->array_options, $line->ref_fourn, $line->multicurrency_subprice);
|
||||
$this->updateline($line->id, $line->subprice, $line->qty, $line->remise_percent, $line->tva_tx, $line->localtax1_tx, $line->localtax2_tx, ($line->description?$line->description:$line->desc), 'HT', $line->info_bits, $line->special_code, $line->fk_parent_line, $line->skip_update_total, $line->fk_fournprice, $line->pa_ht, $line->label, $line->product_type, $line->array_options, $line->ref_fourn, $line->multicurrency_subprice);
|
||||
break;
|
||||
case 'order_supplier':
|
||||
$this->updateline($line->id, $line->desc, $line->subprice, $line->qty, $line->remise_percent, $line->tva_tx, $line->localtax1_tx, $line->localtax2_tx, 'HT', $line->info_bits, $line->product_type, false, $line->date_start, $line->date_end, $line->array_options, $line->fk_unit, $line->multicurrency_subprice);
|
||||
$this->updateline($line->id, ($line->description?$line->description:$line->desc), $line->subprice, $line->qty, $line->remise_percent, $line->tva_tx, $line->localtax1_tx, $line->localtax2_tx, 'HT', $line->info_bits, $line->product_type, false, $line->date_start, $line->date_end, $line->array_options, $line->fk_unit, $line->multicurrency_subprice);
|
||||
break;
|
||||
case 'invoice_supplier':
|
||||
$this->updateline($line->id, $line->desc, $line->subprice, $line->tva_tx, $line->localtax1_tx, $line->localtax2_tx, $line->qty, 0, 'HT', $line->info_bits, $line->product_type, $line->remise_percent, false, $line->date_start, $line->date_end, $line->array_options, $line->fk_unit, $line->multicurrency_subprice);
|
||||
$this->updateline($line->id, ($line->description?$line->description:$line->desc), $line->subprice, $line->tva_tx, $line->localtax1_tx, $line->localtax2_tx, $line->qty, 0, 'HT', $line->info_bits, $line->product_type, $line->remise_percent, false, $line->date_start, $line->date_end, $line->array_options, $line->fk_unit, $line->multicurrency_subprice);
|
||||
break;
|
||||
default:
|
||||
dol_syslog(get_class($this).'::setMulticurrencyRate no updateline defined', LOG_DEBUG);
|
||||
|
||||
@ -8,6 +8,7 @@
|
||||
* Copyright (C) 2013 Florian Henry <forian.henry@open-concept.pro>
|
||||
* Copyright (C) 2015 Charles-Fr BENKE <charles.fr@benke.fr>
|
||||
* Copyright (C) 2016 Raphaël Doursenaud <rdoursenaud@gpcsolutions.fr>
|
||||
* Copyright (C) 2017 Nicolas ZABOURI <info@inovea-conseil.com>
|
||||
*
|
||||
* 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
|
||||
@ -832,7 +833,7 @@ class ExtraFields
|
||||
{
|
||||
$tmp=explode(',',$size);
|
||||
$newsize=$tmp[0];
|
||||
$out='<input type="text" class="flat '.$showsize.' maxwidthonsmartphone" name="'.$keysuffix.'options_'.$key.$keyprefix.'" " maxlength="'.$newsize.'" value="'.$value.'"'.($moreparam?$moreparam:'').'>';
|
||||
$out='<input type="text" class="flat '.$showsize.' maxwidthonsmartphone" name="'.$keysuffix.'options_'.$key.$keyprefix.'" maxlength="'.$newsize.'" value="'.$value.'"'.($moreparam?$moreparam:'').'>';
|
||||
}
|
||||
elseif ($type == 'varchar')
|
||||
{
|
||||
|
||||
@ -3711,7 +3711,7 @@ function vatrate($rate, $addpercent=false, $info_bits=0, $usestarfornpr=0)
|
||||
if (! preg_match('/\//', $rate)) $ret=price($rate,0,'',0,0).($addpercent?'%':'');
|
||||
else
|
||||
{
|
||||
// TODO Split on / and output with a price2num to have clean numbers with ton of 000.
|
||||
// TODO Split on / and output with a price2num to have clean numbers without ton of 000.
|
||||
$ret=$rate.($addpercent?'%':'');
|
||||
}
|
||||
if ($info_bits & 1) $ret.=' *';
|
||||
|
||||
@ -20,7 +20,7 @@
|
||||
/**
|
||||
* \defgroup api Module Api
|
||||
* \brief Descriptor file for Api modulee
|
||||
* \file htdocs/api/core/modules/modApi.class.php
|
||||
* \file htdocs/core/modules/modApi.class.php
|
||||
* \ingroup api
|
||||
* \brief Description and activation file for module Api
|
||||
*/
|
||||
@ -67,7 +67,7 @@ class modApi extends DolibarrModules
|
||||
// If file is in module/img directory under name object_pictovalue.png, use this->picto='pictovalue@module'
|
||||
$this->picto='technic';
|
||||
|
||||
|
||||
|
||||
$this->module_parts = array();
|
||||
|
||||
// Data directories to create when module is enabled.
|
||||
|
||||
@ -145,7 +145,7 @@ if (empty($outputalsopricetotalwithtax)) $outputalsopricetotalwithtax=0;
|
||||
<td align="right" class="linecolvat nowrap"><?php $coldisplay++; ?><?php
|
||||
//var_dump($line);
|
||||
$positiverates='';
|
||||
if (price2num($line->tva_tx)) $positiverates.=($positiverates?'/':'').price2num($line->tva_tx);
|
||||
if (price2num($line->tva_tx)) $positiverates.=($positiverates?'/':'').price2num($line->tva_tx);
|
||||
if (price2num($line->total_localtax1)) $positiverates.=($positiverates?'/':'').price2num($line->localtax1_tx);
|
||||
if (price2num($line->total_localtax2)) $positiverates.=($positiverates?'/':'').price2num($line->localtax2_tx);
|
||||
if (empty($positiverates)) $positiverates='0';
|
||||
|
||||
@ -1685,18 +1685,11 @@ else if ($id > 0 || ! empty($ref))
|
||||
* Built documents
|
||||
*/
|
||||
$filename=dol_sanitizeFileName($object->ref);
|
||||
$filedir=$conf->ficheinter->dir_output . "/".$object->ref;
|
||||
$filedir=$conf->ficheinter->dir_output . "/".$filename;
|
||||
$urlsource=$_SERVER["PHP_SELF"]."?id=".$object->id;
|
||||
$genallowed=$user->rights->ficheinter->creer;
|
||||
$delallowed=$user->rights->ficheinter->supprimer;
|
||||
$genallowed=1;
|
||||
$delallowed=1;
|
||||
|
||||
$var=true;
|
||||
|
||||
//print "<br>\n";
|
||||
print $somethingshown=$formfile->showdocuments('ficheinter',$filename,$filedir,$urlsource,$genallowed,$delallowed,$object->modelpdf,1,0,0,28,0,'','','',$soc->default_lang);
|
||||
|
||||
print $formfile->showdocuments('ficheinter',$filename,$filedir,$urlsource,$genallowed,$delallowed,$object->modelpdf,1,0,0,28,0,'','','',$soc->default_lang);
|
||||
|
||||
// Show links to link elements
|
||||
$linktoelem = $form->showLinkToObjectBlock($object, null, array('fichinter'));
|
||||
|
||||
@ -1799,7 +1799,7 @@ class FactureFournisseur extends CommonInvoice
|
||||
$response->warning_delay=$conf->facture->fournisseur->warning_delay/60/60/24;
|
||||
$response->label=$langs->trans("SupplierBillsToPay");
|
||||
|
||||
$response->url=DOL_URL_ROOT.'/fourn/facture/list.php?filtre=fac.fk_statut:1,paye:0&mainmenu=accountancy&leftmenu=suppliers_bills';
|
||||
$response->url=DOL_URL_ROOT.'/fourn/facture/list.php?search_status=1&mainmenu=accountancy&leftmenu=suppliers_bills';
|
||||
$response->img=img_object($langs->trans("Bills"),"bill");
|
||||
|
||||
$facturestatic = new FactureFournisseur($this->db);
|
||||
|
||||
@ -180,16 +180,18 @@ class ProductFournisseur extends Product
|
||||
* @param Societe $fourn Supplier
|
||||
* @param int $availability Product availability
|
||||
* @param string $ref_fourn Supplier ref
|
||||
* @param float $tva_tx VAT rate
|
||||
* @param float $tva_tx New VAT Rate (For example 8.5. Should not be a string)
|
||||
* @param string $charges costs affering to product
|
||||
* @param float $remise_percent Discount regarding qty (percent)
|
||||
* @param float $remise Discount regarding qty (amount)
|
||||
* @param int $newnpr Set NPR or not
|
||||
* @param int $delivery_time_days Delay in days for delivery (max). May be '' if not defined.
|
||||
* @param string $supplier_reputation Reputation with this product to the defined supplier (empty, FAVORITE, DONOTORDER)
|
||||
* @param array $localtaxes_array Array with localtaxes info array('0'=>type1,'1'=>rate1,'2'=>type2,'3'=>rate2) (loaded by getLocalTaxesFromRate(vatrate, 0, ...) function).
|
||||
* @param string $newdefaultvatcode Default vat code
|
||||
* @return int <0 if KO, >=0 if OK
|
||||
*/
|
||||
function update_buyprice($qty, $buyprice, $user, $price_base_type, $fourn, $availability, $ref_fourn, $tva_tx, $charges=0, $remise_percent=0, $remise=0, $newnpr=0, $delivery_time_days=0, $supplier_reputation='')
|
||||
function update_buyprice($qty, $buyprice, $user, $price_base_type, $fourn, $availability, $ref_fourn, $tva_tx, $charges=0, $remise_percent=0, $remise=0, $newnpr=0, $delivery_time_days=0, $supplier_reputation='', $localtaxes_array=array(), $newdefaultvatcode='')
|
||||
{
|
||||
global $conf, $langs;
|
||||
//global $mysoc;
|
||||
@ -217,6 +219,25 @@ class ProductFournisseur extends Product
|
||||
|
||||
$now=dol_now();
|
||||
|
||||
$newvat = $tva_tx;
|
||||
|
||||
if (count($localtaxes_array) > 0)
|
||||
{
|
||||
$localtaxtype1=$localtaxes_array['0'];
|
||||
$localtax1=$localtaxes_array['1'];
|
||||
$localtaxtype2=$localtaxes_array['2'];
|
||||
$localtax2=$localtaxes_array['3'];
|
||||
}
|
||||
else // old method. deprecated because ot can't retreive type
|
||||
{
|
||||
$localtaxtype1='0';
|
||||
$localtax1=get_localtax($newvat,1);
|
||||
$localtaxtype2='0';
|
||||
$localtax2=get_localtax($newvat,2);
|
||||
}
|
||||
if (empty($localtax1)) $localtax1=0; // If = '' then = 0
|
||||
if (empty($localtax2)) $localtax2=0; // If = '' then = 0
|
||||
|
||||
$this->db->begin();
|
||||
|
||||
if ($this->product_fourn_price_id > 0)
|
||||
@ -230,9 +251,15 @@ class ProductFournisseur extends Product
|
||||
$sql.= " remise = ".$remise.",";
|
||||
$sql.= " unitprice = ".$unitBuyPrice.",";
|
||||
$sql.= " unitcharges = ".$unitCharges.","; // deprecated
|
||||
$sql.= " tva_tx = ".$tva_tx.",";
|
||||
$sql.= " fk_availability = ".$availability.",";
|
||||
$sql.= " entity = ".$conf->entity.",";
|
||||
$sql.= " tva_tx = ".price2num($tva_tx).",";
|
||||
// TODO Add localtax1 and localtax2
|
||||
//$sql.= " localtax1_tx=".($localtax1>=0?$localtax1:'NULL').",";
|
||||
//$sql.= " localtax2_tx=".($localtax2>=0?$localtax2:'NULL').",";
|
||||
//$sql.= " localtax1_type=".($localtaxtype1!=''?"'".$localtaxtype1."'":"'0'").",";
|
||||
//$sql.= " localtax2_type=".($localtaxtype2!=''?"'".$localtaxtype2."'":"'0'").",";
|
||||
$sql.= " default_vat_code=".($newdefaultvatcode?"'".$this->db->escape($newdefaultvatcode)."'":"null").",";
|
||||
$sql.= " info_bits = ".$newnpr.",";
|
||||
$sql.= " charges = ".$charges.","; // deprecated
|
||||
$sql.= " delivery_time_days = ".($delivery_time_days != '' ? $delivery_time_days : 'null').",";
|
||||
@ -279,7 +306,7 @@ class ProductFournisseur extends Product
|
||||
if ($resql) {
|
||||
// Add price for this quantity to supplier
|
||||
$sql = "INSERT INTO " . MAIN_DB_PREFIX . "product_fournisseur_price(";
|
||||
$sql .= "datec, fk_product, fk_soc, ref_fourn, fk_user, price, quantity, remise_percent, remise, unitprice, tva_tx, charges, unitcharges, fk_availability, info_bits, entity, delivery_time_days,supplier_reputation)";
|
||||
$sql .= "datec, fk_product, fk_soc, ref_fourn, fk_user, price, quantity, remise_percent, remise, unitprice, tva_tx, charges, unitcharges, fk_availability, default_vat_code, info_bits, entity, delivery_time_days, supplier_reputation)";
|
||||
$sql .= " values('" . $this->db->idate($now) . "',";
|
||||
$sql .= " " . $this->id . ",";
|
||||
$sql .= " " . $fourn->id . ",";
|
||||
@ -294,6 +321,7 @@ class ProductFournisseur extends Product
|
||||
$sql .= " " . $charges . ",";
|
||||
$sql .= " " . $unitCharges . ",";
|
||||
$sql .= " " . $availability . ",";
|
||||
$sql .= " ".($newdefaultvatcode?"'".$this->db->escape($newdefaultvatcode)."'":"null").",";
|
||||
$sql .= " " . $newnpr . ",";
|
||||
$sql .= $conf->entity . ",";
|
||||
$sql .= $delivery_time_days . ",";
|
||||
@ -364,9 +392,9 @@ class ProductFournisseur extends Product
|
||||
function fetch_product_fournisseur_price($rowid, $ignore_expression = 0)
|
||||
{
|
||||
global $conf;
|
||||
$sql = "SELECT pfp.rowid, pfp.price, pfp.quantity, pfp.unitprice, pfp.remise_percent, pfp.remise, pfp.tva_tx, pfp.fk_availability,";
|
||||
$sql = "SELECT pfp.rowid, pfp.price, pfp.quantity, pfp.unitprice, pfp.remise_percent, pfp.remise, pfp.tva_tx, pfp.default_vat_code, pfp.fk_availability,";
|
||||
$sql.= " pfp.fk_soc, pfp.ref_fourn, pfp.fk_product, pfp.charges, pfp.unitcharges, pfp.fk_supplier_price_expression, pfp.delivery_time_days,"; // , pfp.recuperableonly as fourn_tva_npr"; FIXME this field not exist in llx_product_fournisseur_price
|
||||
$sql.=" pfp.supplier_reputation";
|
||||
$sql.= " pfp.supplier_reputation";
|
||||
$sql.= " FROM ".MAIN_DB_PREFIX."product_fournisseur_price as pfp";
|
||||
$sql.= " WHERE pfp.rowid = ".$rowid;
|
||||
|
||||
@ -392,11 +420,14 @@ class ProductFournisseur extends Product
|
||||
$this->fourn_unitprice = $obj->unitprice;
|
||||
$this->fourn_unitcharges = $obj->unitcharges; // deprecated
|
||||
$this->fourn_tva_tx = $obj->tva_tx;
|
||||
//$this->fourn_tva_npr = $obj->fourn_tva_npr; // TODO this field not exist in llx_product_fournisseur_price. We should add it ?
|
||||
// TODO
|
||||
// $this->fourn_tva_npr = $obj->fourn_tva_npr; // TODO this field not exist in llx_product_fournisseur_price. We should add it ?
|
||||
// Add also localtaxes
|
||||
$this->fk_availability = $obj->fk_availability;
|
||||
$this->delivery_time_days = $obj->delivery_time_days;
|
||||
$this->fk_supplier_price_expression = $obj->fk_supplier_price_expression;
|
||||
$this->supplier_reputation = $obj->supplier_reputation;
|
||||
$this->supplier_reputation = $obj->supplier_reputation;
|
||||
$this->default_vat_code = $obj->default_vat_code;
|
||||
|
||||
if (empty($ignore_expression) && !empty($this->fk_supplier_price_expression))
|
||||
{
|
||||
|
||||
@ -320,7 +320,7 @@ if (empty($reshook))
|
||||
|
||||
// Multicurrency rate
|
||||
else if ($action == 'setmulticurrencyrate' && $user->rights->facture->creer) {
|
||||
$result = $object->setMulticurrencyRate(price2num(GETPOST('multicurrency_tx')));
|
||||
$result = $object->setMulticurrencyRate(price2num(GETPOST('multicurrency_tx', 'alpha')));
|
||||
}
|
||||
|
||||
// bank account
|
||||
|
||||
@ -54,6 +54,7 @@ $massaction=GETPOST('massaction','alpha');
|
||||
$show_files=GETPOST('show_files','int');
|
||||
$confirm=GETPOST('confirm','alpha');
|
||||
$toselect = GETPOST('toselect', 'array');
|
||||
$optioncss = GETPOST('optioncss','alpha');
|
||||
|
||||
$socid = GETPOST('socid','int');
|
||||
|
||||
@ -67,6 +68,11 @@ if ($user->societe_id > 0)
|
||||
|
||||
$mode=GETPOST("mode");
|
||||
|
||||
$search_all = GETPOST('sall', 'alphanohtml');
|
||||
$search_label = GETPOST("search_label","alpha");
|
||||
$search_company = GETPOST("search_company","alpha");
|
||||
$search_amount_no_tax = GETPOST("search_amount_no_tax","alpha");
|
||||
$search_amount_all_tax = GETPOST("search_amount_all_tax","alpha");
|
||||
$search_product_category=GETPOST('search_product_category','int');
|
||||
$search_ref=GETPOST('sf_ref')?GETPOST('sf_ref','alpha'):GETPOST('search_ref','alpha');
|
||||
$search_refsupplier=GETPOST('search_refsupplier','alpha');
|
||||
@ -93,20 +99,12 @@ $day_lim = GETPOST('day_lim','int');
|
||||
$month_lim = GETPOST('month_lim','int');
|
||||
$year_lim = GETPOST('year_lim','int');
|
||||
$toselect = GETPOST('toselect', 'array');
|
||||
$filter = GETPOST('filtre','alpha');
|
||||
|
||||
$option = GETPOST('option');
|
||||
if ($option == 'late') {
|
||||
$filter = 'paye:0';
|
||||
$search_status = '1';
|
||||
}
|
||||
|
||||
$search_all = GETPOST('sall', 'alphanohtml');
|
||||
$search_label = GETPOST("search_label","alpha");
|
||||
$search_company = GETPOST("search_company","alpha");
|
||||
$search_amount_no_tax = GETPOST("search_amount_no_tax","alpha");
|
||||
$search_amount_all_tax = GETPOST("search_amount_all_tax","alpha");
|
||||
$search_status=GETPOST('search_status','alpha');
|
||||
$optioncss = GETPOST('optioncss','alpha');
|
||||
$filter = GETPOST('filtre','alpha');
|
||||
|
||||
$limit = GETPOST('limit')?GETPOST('limit','int'):$conf->liste_limit;
|
||||
$sortfield = GETPOST("sortfield",'alpha');
|
||||
@ -348,7 +346,6 @@ else if ($year_lim > 0)
|
||||
$sql.= " AND f.date_lim_reglement BETWEEN '".$db->idate(dol_get_first_day($year_lim,1,false))."' AND '".$db->idate(dol_get_last_day($year_lim,12,false))."'";
|
||||
}
|
||||
if ($option == 'late') $sql.=" AND f.date_lim_reglement < '".$db->idate(dol_now() - $conf->facture->fournisseur->warning_delay)."'";
|
||||
if ($filter == 'paye:0') $sql.= " AND f.fk_statut = 1";
|
||||
if ($search_label) $sql .= natural_search('f.libelle', $search_label);
|
||||
if ($search_status != '' && $search_status >= 0)
|
||||
{
|
||||
@ -360,10 +357,10 @@ if ($filter && $filter != -1)
|
||||
foreach ($aFilter as $fil)
|
||||
{
|
||||
$filt = explode(':', $fil);
|
||||
$sql .= ' AND ' . trim($filt[0]) . ' = ' . trim($filt[1]);
|
||||
$sql .= ' AND ' . $db->escape(trim($filt[0])) . ' = ' . $db->escape(trim($filt[1]));
|
||||
}
|
||||
}
|
||||
if ($search_sale > 0) $sql.= " AND s.rowid = sc.fk_soc AND sc.fk_user = " .$search_sale;
|
||||
if ($search_sale > 0) $sql.= " AND s.rowid = sc.fk_soc AND sc.fk_user = " .$db->escape($search_sale);
|
||||
if ($search_user > 0)
|
||||
{
|
||||
$sql.= " AND ec.fk_c_type_contact = tc.rowid AND tc.element='invoice_supplier' AND tc.source='internal' AND ec.element_id = f.rowid AND ec.fk_socpeople = ".$search_user;
|
||||
|
||||
@ -41,6 +41,7 @@ require_once DOL_DOCUMENT_ROOT.'/holiday/common.inc.php';
|
||||
$myparam = GETPOST("myparam");
|
||||
$action=GETPOST('action', 'alpha');
|
||||
$id=GETPOST('id', 'int');
|
||||
$fuserid = (GETPOST('fuserid','int')?GETPOST('fuserid','int'):$user->id);
|
||||
|
||||
// Protection if external user
|
||||
if ($user->societe_id > 0) accessforbidden();
|
||||
|
||||
@ -135,13 +135,16 @@ insert into llx_c_tva(rowid,fk_pays,taux,recuperableonly,note,active) values ( 3
|
||||
insert into llx_c_tva(rowid,fk_pays,taux,recuperableonly,note,active) values ( 34, 3, '0','0','VAT Rate 0',1);
|
||||
|
||||
-- INDIA (id country=117)
|
||||
insert into llx_c_tva(rowid,fk_pays,taux,recuperableonly,note,active) values (1171, 117, '12.5','0','VAT standard rate', 0);
|
||||
insert into llx_c_tva(rowid,fk_pays,taux,recuperableonly,note,active) values (1172, 117, '4','0','VAT reduced rate', 0);
|
||||
insert into llx_c_tva(rowid,fk_pays,taux,recuperableonly,note,active) values (1173, 117, '1','0','VAT super-reduced rate',0);
|
||||
insert into llx_c_tva(rowid,fk_pays,taux,recuperableonly,note,active) values (1174, 117, '0','0','VAT Rate 0', 0);
|
||||
insert into llx_c_tva(rowid,fk_pays,taux,recuperableonly,note,active) values (1171, 117, '0','0','VAT Rate 0', 0);
|
||||
|
||||
insert into llx_c_tva(rowid,fk_pays,code,taux,localtax1,localtax1_type,localtax2,localtax2_type,recuperableonly,note,active) values (1176, 117, 'CGST+SGST', 0, 9, '1', 9, '1', 0, 'CGST+SGST - Same state sales', 1);
|
||||
insert into llx_c_tva(rowid,fk_pays,code,taux,localtax1,localtax1_type,localtax2,localtax2_type,recuperableonly,note,active) values (1177, 117, 'IGST' , 18, 0, '0', 0, '0', 0, 'IGST', 1);
|
||||
insert into llx_c_tva(rowid,fk_pays,code,taux,localtax1,localtax1_type,localtax2,localtax2_type,recuperableonly,note,active) values (1178, 117, 'C+S-5', 0, 2.5, '1', 2.5, '1', 0, 'CGST+SGST - Same state sales', 1);
|
||||
insert into llx_c_tva(rowid,fk_pays,code,taux,localtax1,localtax1_type,localtax2,localtax2_type,recuperableonly,note,active) values (1179, 117, 'I-5' , 5, 0, '0', 0, '0', 0, 'IGST', 1);
|
||||
insert into llx_c_tva(rowid,fk_pays,code,taux,localtax1,localtax1_type,localtax2,localtax2_type,recuperableonly,note,active) values (1180, 117, 'C+S-12', 0, 6, '1', 6, '1', 0, 'CGST+SGST - Same state sales', 1);
|
||||
insert into llx_c_tva(rowid,fk_pays,code,taux,localtax1,localtax1_type,localtax2,localtax2_type,recuperableonly,note,active) values (1181, 117, 'I-12' , 12, 0, '0', 0, '0', 0, 'IGST', 1);
|
||||
insert into llx_c_tva(rowid,fk_pays,code,taux,localtax1,localtax1_type,localtax2,localtax2_type,recuperableonly,note,active) values (1176, 117, 'C+S-18', 0, 9, '1', 9, '1', 0, 'CGST+SGST - Same state sales', 1);
|
||||
insert into llx_c_tva(rowid,fk_pays,code,taux,localtax1,localtax1_type,localtax2,localtax2_type,recuperableonly,note,active) values (1177, 117, 'I-18' , 18, 0, '0', 0, '0', 0, 'IGST', 1);
|
||||
insert into llx_c_tva(rowid,fk_pays,code,taux,localtax1,localtax1_type,localtax2,localtax2_type,recuperableonly,note,active) values (1182, 117, 'C+S-28', 0, 14, '1', 14, '1', 0, 'CGST+SGST - Same state sales', 1);
|
||||
insert into llx_c_tva(rowid,fk_pays,code,taux,localtax1,localtax1_type,localtax2,localtax2_type,recuperableonly,note,active) values (1183, 117, 'I-28' , 28, 0, '0', 0, '0', 0, 'IGST', 1);
|
||||
|
||||
-- IRELAND (id country=8)
|
||||
insert into llx_c_tva(rowid,fk_pays,taux,recuperableonly,note,active) values (81, 8, '0','0','VAT Rate 0',1);
|
||||
|
||||
@ -63,7 +63,7 @@ ALTER TABLE llx_facturedet ADD UNIQUE INDEX uk_fk_remise_except (fk_remise_excep
|
||||
|
||||
ALTER TABLE llx_societe ADD COLUMN fk_currency integer DEFAULT 0 AFTER fk_forme_juridique;
|
||||
ALTER TABLE llx_societe ADD COLUMN status tinyint DEFAULT 1;
|
||||
ALTER TABLE llx_societe ADD COLUMN logo varchar(255);
|
||||
ALTER TABLE llx_societe ADD COLUMN logo varchar(255) DEFAULT NULL;
|
||||
|
||||
ALTER TABLE llx_societe_remise MODIFY remise_client double(6,3) DEFAULT 0 NOT NULL;
|
||||
|
||||
|
||||
@ -4,6 +4,7 @@
|
||||
-- when current version is 5.0.0 or higher.
|
||||
--
|
||||
-- To rename a table: ALTER TABLE llx_table RENAME TO llx_table_new;
|
||||
-- -- VPGSQL8.2 ALTER SEQUENCE IF EXISTS llx_table_rowid_seq RENAME TO llx_table_new_rowid_seq;
|
||||
-- To add a column: ALTER TABLE llx_table ADD COLUMN newcol varchar(60) NOT NULL DEFAULT '0' AFTER existingcol;
|
||||
-- To rename a column: ALTER TABLE llx_table CHANGE COLUMN oldname newname varchar(60);
|
||||
-- To drop a column: ALTER TABLE llx_table DROP COLUMN oldname;
|
||||
@ -121,6 +122,8 @@ create table llx_expensereport_extrafields
|
||||
ALTER TABLE llx_expensereport_extrafields ADD INDEX idx_expensereport_extrafields (fk_object);
|
||||
|
||||
ALTER TABLE llx_cotisation RENAME TO llx_subscription;
|
||||
-- VPGSQL8.2 ALTER SEQUENCE IF EXISTS llx_cotisation_rowid_seq RENAME TO llx_subscription_rowid_seq;
|
||||
|
||||
ALTER TABLE llx_subscription ADD UNIQUE INDEX uk_subscription (fk_adherent,dateadh);
|
||||
ALTER TABLE llx_subscription CHANGE COLUMN cotisation subscription real;
|
||||
ALTER TABLE llx_adherent_type CHANGE COLUMN cotisation subscription varchar(3) NOT NULL DEFAULT '1';
|
||||
|
||||
@ -597,5 +597,11 @@ ALTER TABLE llx_mailing_cibles MODIFY COLUMN source_url varchar(255);
|
||||
-- VPGSQL8.2 CREATE TRIGGER update_customer_modtime BEFORE UPDATE ON llx_website FOR EACH ROW EXECUTE PROCEDURE update_modified_column_tms();
|
||||
-- VPGSQL8.2 CREATE TRIGGER update_customer_modtime BEFORE UPDATE ON llx_website_page FOR EACH ROW EXECUTE PROCEDURE update_modified_column_tms();
|
||||
|
||||
insert into llx_c_tva(rowid,fk_pays,code,taux,localtax1,localtax1_type,localtax2,localtax2_type,recuperableonly,note,active) values (1176, 117, 'CGST+SGST', 0, 9, '1', 9, '1', 0, 'CGST+SGST - Same state sales', 1);
|
||||
insert into llx_c_tva(rowid,fk_pays,code,taux,localtax1,localtax1_type,localtax2,localtax2_type,recuperableonly,note,active) values (1177, 117, 'IGST' , 18, 0, '0', 0, '0', 0, 'IGST', 1);
|
||||
insert into llx_c_tva(rowid,fk_pays,code,taux,localtax1,localtax1_type,localtax2,localtax2_type,recuperableonly,note,active) values (1178, 117, 'C+S-5', 0, 2.5, '1', 2.5, '1', 0, 'CGST+SGST - Same state sales', 1);
|
||||
insert into llx_c_tva(rowid,fk_pays,code,taux,localtax1,localtax1_type,localtax2,localtax2_type,recuperableonly,note,active) values (1179, 117, 'I-5' , 5, 0, '0', 0, '0', 0, 'IGST', 1);
|
||||
insert into llx_c_tva(rowid,fk_pays,code,taux,localtax1,localtax1_type,localtax2,localtax2_type,recuperableonly,note,active) values (1180, 117, 'C+S-12', 0, 6, '1', 6, '1', 0, 'CGST+SGST - Same state sales', 1);
|
||||
insert into llx_c_tva(rowid,fk_pays,code,taux,localtax1,localtax1_type,localtax2,localtax2_type,recuperableonly,note,active) values (1181, 117, 'I-12' , 12, 0, '0', 0, '0', 0, 'IGST', 1);
|
||||
insert into llx_c_tva(rowid,fk_pays,code,taux,localtax1,localtax1_type,localtax2,localtax2_type,recuperableonly,note,active) values (1176, 117, 'C+S-18', 0, 9, '1', 9, '1', 0, 'CGST+SGST - Same state sales', 1);
|
||||
insert into llx_c_tva(rowid,fk_pays,code,taux,localtax1,localtax1_type,localtax2,localtax2_type,recuperableonly,note,active) values (1177, 117, 'I-18' , 18, 0, '0', 0, '0', 0, 'IGST', 1);
|
||||
insert into llx_c_tva(rowid,fk_pays,code,taux,localtax1,localtax1_type,localtax2,localtax2_type,recuperableonly,note,active) values (1182, 117, 'C+S-28', 0, 14, '1', 14, '1', 0, 'CGST+SGST - Same state sales', 1);
|
||||
insert into llx_c_tva(rowid,fk_pays,code,taux,localtax1,localtax1_type,localtax2,localtax2_type,recuperableonly,note,active) values (1183, 117, 'I-28' , 28, 0, '0', 0, '0', 0, 'IGST', 1);
|
||||
|
||||
@ -95,13 +95,13 @@ create table llx_societe
|
||||
barcode varchar(255), -- barcode
|
||||
fk_barcode_type integer NULL DEFAULT 0, -- barcode type
|
||||
price_level integer NULL, -- level of price for multiprices
|
||||
outstanding_limit double(24,8) DEFAULT NULL, -- allowed outstanding limit
|
||||
outstanding_limit double(24,8) DEFAULT NULL, -- allowed outstanding limit
|
||||
default_lang varchar(6), -- default language
|
||||
logo varchar(255),
|
||||
canvas varchar(32), -- type of canvas if used (null by default)
|
||||
logo varchar(255) DEFAULT NULL,
|
||||
canvas varchar(32) DEFAULT NULL, -- type of canvas if used (null by default)
|
||||
import_key varchar(14), -- import key
|
||||
webservices_url varchar(255), -- supplier webservice url
|
||||
webservices_key varchar(128), -- supplier webservice key
|
||||
webservices_url varchar(255), -- supplier webservice url
|
||||
webservices_key varchar(128), -- supplier webservice key
|
||||
|
||||
fk_multicurrency integer,
|
||||
multicurrency_code varchar(255)
|
||||
|
||||
@ -38,8 +38,8 @@ $langs->load("products");
|
||||
if (! $user->admin) accessforbidden();
|
||||
|
||||
$action = GETPOST('action','alpha');
|
||||
$oldvatrate=GETPOST('oldvatrate');
|
||||
$newvatrate=GETPOST('newvatrate');
|
||||
$oldvatrate=GETPOST('oldvatrate', 'alpha');
|
||||
$newvatrate=GETPOST('newvatrate', 'alpha');
|
||||
//$price_base_type=GETPOST('price_base_type');
|
||||
|
||||
|
||||
@ -67,13 +67,31 @@ if ($action == 'convert')
|
||||
|
||||
$db->begin();
|
||||
|
||||
// Clean vat code old
|
||||
$vat_src_code_old='';
|
||||
if (preg_match('/\((.*)\)/', $oldvatrate, $reg))
|
||||
{
|
||||
$vat_src_code_old = $reg[1];
|
||||
$oldvatrateclean = preg_replace('/\s*\(.*\)/', '', $oldvatrate); // Remove code into vatrate.
|
||||
}
|
||||
|
||||
// Clean vat code new
|
||||
$vat_src_code_new='';
|
||||
if (preg_match('/\((.*)\)/', $newvatrate, $reg))
|
||||
{
|
||||
$vat_src_code_new = $reg[1];
|
||||
$newvatrateclean = preg_replace('/\s*\(.*\)/', '', $newvatrate); // Remove code into vatrate.
|
||||
}
|
||||
|
||||
// If country to edit is my country, so we change customer prices
|
||||
if ($country_id == $mysoc->country_id)
|
||||
{
|
||||
$sql = 'SELECT rowid';
|
||||
$sql.= ' FROM '.MAIN_DB_PREFIX.'product';
|
||||
$sql.= ' WHERE entity IN ('.getEntity('product').')';
|
||||
$sql.= " AND tva_tx = '".$db->escape($oldvatrate)."'";
|
||||
$sql.= " AND tva_tx = '".$db->escape($oldvatrateclean)."'";
|
||||
if ($vat_src_code_old) $sql.= " AND default_vat_code = '".$vat_src_code_old."'";
|
||||
else " AND default_vat_code = IS NULL";
|
||||
|
||||
$resql=$db->query($sql);
|
||||
if ($resql)
|
||||
@ -109,12 +127,15 @@ if ($action == 'convert')
|
||||
$newminprice=$objectstatic->multiprices_min[$level];
|
||||
}
|
||||
if ($newminprice > $newprice) $newminprice=$newprice;
|
||||
|
||||
$newvat=str_replace('*','',$newvatrate);
|
||||
$localtaxes_type=getLocalTaxesFromRate($newvat, 0, $mysoc, $mysoc);
|
||||
$newnpr=$objectstatic->multiprices_recuperableonly[$level];
|
||||
$newdefaultvatcode=$vat_src_code_new;
|
||||
$newlevel=$level;
|
||||
|
||||
//print "$objectstatic->id $newprice, $price_base_type, $newvat, $newminprice, $newlevel, $newnpr<br>\n";
|
||||
$retm=$objectstatic->updatePrice($newprice, $price_base_type, $user, $newvat, $newminprice, $newlevel, $newnpr);
|
||||
$retm=$objectstatic->updatePrice($newprice, $price_base_type, $user, $newvatratclean, $newminprice, $newlevel, $newnpr, 0, 0, $localtaxes_type, $newdefaultvatcode);
|
||||
if ($retm < 0)
|
||||
{
|
||||
$error++;
|
||||
@ -138,19 +159,21 @@ if ($action == 'convert')
|
||||
}
|
||||
if ($newminprice > $newprice) $newminprice=$newprice;
|
||||
$newvat=str_replace('*','',$newvatrate);
|
||||
$localtaxes_type=getLocalTaxesFromRate($newvat, 0, $mysoc, $mysoc);
|
||||
$newnpr=$objectstatic->recuperableonly;
|
||||
$newdefaultvatcode=$vat_src_code_new;
|
||||
$newlevel=0;
|
||||
if (! empty($price_base_type) && ! $updatelevel1)
|
||||
{
|
||||
//print "$objectstatic->id $newprice, $price_base_type, $newvat, $newminprice, $newlevel, $newnpr<br>\n";
|
||||
$ret=$objectstatic->updatePrice($newprice, $price_base_type, $user, $newvat, $newminprice, $newlevel, $newnpr);
|
||||
$ret=$objectstatic->updatePrice($newprice, $price_base_type, $user, $newvatrateclean, $newminprice, $newlevel, $newnpr, 0, 0, $localtaxes_type, $newdefaultvatcode);
|
||||
}
|
||||
|
||||
if ($ret < 0 || $retm < 0) $error++;
|
||||
else $nbrecordsmodified++;
|
||||
}
|
||||
unset($objectstatic);
|
||||
|
||||
|
||||
$i++;
|
||||
}
|
||||
}
|
||||
@ -164,6 +187,8 @@ if ($action == 'convert')
|
||||
$sql.= ' FROM '.MAIN_DB_PREFIX.'product_fournisseur_price as pfp, '.MAIN_DB_PREFIX.'societe as s';
|
||||
$sql.= ' WHERE pfp.fk_soc = s.rowid AND pfp.entity IN ('.getEntity('product').')';
|
||||
$sql.= " AND tva_tx = '".$db->escape($oldvatrate)."'";
|
||||
if ($vat_src_code_old) $sql.= " AND default_vat_code = '".$vat_src_code_old."'";
|
||||
else " AND default_vat_code = IS NULL";
|
||||
$sql.= " AND s.fk_pays = '".$country_id."'";
|
||||
//print $sql;
|
||||
$resql=$db->query($sql);
|
||||
@ -196,26 +221,33 @@ if ($action == 'convert')
|
||||
//}
|
||||
//if ($newminprice > $newprice) $newminprice=$newprice;
|
||||
$newvat=str_replace('*','',$newvatrate);
|
||||
$localtaxes_type=getLocalTaxesFromRate($newvat, 0, $mysoc, $mysoc);
|
||||
//$newnpr=$objectstatic2->recuperableonly;
|
||||
$newnpr=0;
|
||||
$newdefaultvatcode=$vat_src_code_new;
|
||||
|
||||
$newpercent = $objectstatic2->fourn_remise_percent;
|
||||
$newdeliverydelay = $objectstatic2->delivery_time_days;
|
||||
$newsupplierreputation = $objectstatic2->supplier_reputation;
|
||||
|
||||
$newlevel=0;
|
||||
if (! empty($price_base_type) && ! $updatelevel1)
|
||||
{
|
||||
//print "$objectstatic2->id $newprice, $price_base_type, $newvat, $newminprice, $newlevel, $newnpr<br>\n";
|
||||
$fourn->id=$obj->fk_soc;
|
||||
$ret=$objectstatic2->update_buyprice($obj->qty, $newprice, $user, $price_base_type, $fourn, $obj->fk_availability, $obj->ref_fourn, $newvat);
|
||||
$ret=$objectstatic2->update_buyprice($obj->qty, $newprice, $user, $price_base_type, $fourn, $obj->fk_availability, $obj->ref_fourn, $newvat, '', $newpercent, 0, $newnpr, $newdeliverydelay, $newsupplierreputation, $localtaxes_type, $newdefaultvatcode);
|
||||
}
|
||||
|
||||
if ($ret < 0 || $retm < 0) $error++;
|
||||
else $nbrecordsmodified++;
|
||||
}
|
||||
unset($objectstatic2);
|
||||
|
||||
|
||||
$i++;
|
||||
}
|
||||
}
|
||||
else dol_print_error($db);
|
||||
|
||||
|
||||
if (! $error)
|
||||
{
|
||||
$db->commit();
|
||||
@ -274,24 +306,24 @@ else
|
||||
print '<td align="right" width="60">'.$langs->trans("Value").'</td>'."\n";
|
||||
print '</tr>'."\n";
|
||||
|
||||
|
||||
|
||||
print '<tr class="oddeven">'."\n";
|
||||
print '<td>'.$langs->trans("OldVATRates").'</td>'."\n";
|
||||
print '<td width="60" align="right">'."\n";
|
||||
print $form->load_tva('oldvatrate', $oldvatrate, $mysoc);
|
||||
print $form->load_tva('oldvatrate', $oldvatrate, $mysoc, null, 0, 0, '', false, 1);
|
||||
print '</td>'."\n";
|
||||
print '</tr>'."\n";
|
||||
|
||||
|
||||
|
||||
print '<tr class="oddeven">'."\n";
|
||||
print '<td>'.$langs->trans("NewVATRates").'</td>'."\n";
|
||||
print '<td width="60" align="right">'."\n";
|
||||
print $form->load_tva('newvatrate', $newvatrate, $mysoc);
|
||||
print $form->load_tva('newvatrate', $newvatrate, $mysoc, null, 0, 0, '', false, 1);
|
||||
print '</td>'."\n";
|
||||
print '</tr>'."\n";
|
||||
|
||||
/*
|
||||
|
||||
|
||||
print '<tr class="oddeven">'."\n";
|
||||
print '<td>'.$langs->trans("PriceBaseTypeToChange").'</td>'."\n";
|
||||
print '<td width="60" align="right">'."\n";
|
||||
@ -303,7 +335,7 @@ else
|
||||
print '</table>';
|
||||
|
||||
print '<br>';
|
||||
|
||||
|
||||
// Boutons actions
|
||||
print '<div class="center">';
|
||||
print '<input type="submit" id="convert_vatrate" name="convert_vatrate" value="'.$langs->trans("MassConvert").'" class="button" />';
|
||||
|
||||
@ -329,6 +329,8 @@ class Productcustomerprice extends CommonObject
|
||||
$sql .= " t.recuperableonly,";
|
||||
$sql .= " t.localtax1_tx,";
|
||||
$sql .= " t.localtax2_tx,";
|
||||
$sql .= " t.localtax1_type,";
|
||||
$sql .= " t.localtax2_type,";
|
||||
$sql .= " t.fk_user,";
|
||||
$sql .= " t.import_key,";
|
||||
$sql .= " soc.nom as socname,";
|
||||
@ -386,6 +388,8 @@ class Productcustomerprice extends CommonObject
|
||||
$line->recuperableonly = $obj->recuperableonly;
|
||||
$line->localtax1_tx = $obj->localtax1_tx;
|
||||
$line->localtax2_tx = $obj->localtax2_tx;
|
||||
$line->localtax1_type = $obj->localtax1_type;
|
||||
$line->localtax2_type = $obj->localtax2_type;
|
||||
$line->fk_user = $obj->fk_user;
|
||||
$line->import_key = $obj->import_key;
|
||||
$line->socname = $obj->socname;
|
||||
|
||||
@ -208,7 +208,7 @@ if ($id > 0 || ! empty($ref))
|
||||
$shownav = 1;
|
||||
if ($user->societe_id && ! in_array('product', explode(',',$conf->global->MAIN_MODULES_FOR_EXTERNAL))) $shownav=0;
|
||||
|
||||
dol_banner_tab($object, 'ref', $linkback, $shownav, 'ref', '', '', '', 0, '', '', 1);
|
||||
dol_banner_tab($object, 'ref', $linkback, $shownav, 'ref', '', '', '', 0, '', '', 0);
|
||||
|
||||
if ($object->type!=Product::TYPE_SERVICE || empty($conf->global->PRODUIT_MULTIPRICES))
|
||||
{
|
||||
|
||||
@ -472,7 +472,9 @@ if ($id > 0 || $ref)
|
||||
$default_vat=$object->tva_tx;
|
||||
}
|
||||
}
|
||||
print '<input type="text" class="flat" size="5" name="tva_tx" value="'.(GETPOST("tva_tx")?vatrate(GETPOST("tva_tx")):($default_vat!=''?vatrate($default_vat):'')).'">';
|
||||
$vattosuggest=(GETPOST("tva_tx")?vatrate(GETPOST("tva_tx")):($default_vat!=''?vatrate($default_vat):''));
|
||||
$vattosuggest=preg_replace('/\s*\(.*\)$/','', $vattosuggest);
|
||||
print '<input type="text" class="flat" size="5" name="tva_tx" value="'.$vattosuggest.'">';
|
||||
print '</td></tr>';
|
||||
|
||||
if (! empty($conf->dynamicprices->enabled)) //Only show price mode and expression selector if module is enabled
|
||||
|
||||
@ -107,8 +107,15 @@ if (empty($reshook))
|
||||
$tva_tx_txt = GETPOST('tva_tx', 'alpha'); // tva_tx can be '8.5' or '8.5*' or '8.5 (XXX)' or '8.5* (XXX)'
|
||||
|
||||
// We must define tva_tx, npr and local taxes
|
||||
$tva_tx = $tva_tx_txt;
|
||||
$vatratecode = '';
|
||||
$tva_tx = preg_replace('/[^0-9\.].*$/', '', $tva_tx_txt); // keep remove all after the numbers and dot
|
||||
if (preg_match('/\((.*)\)/', $tva_tx_txt, $reg))
|
||||
{
|
||||
$vat_src_code = $reg[1];
|
||||
$tva_tx = preg_replace('/\s*\(.*\)/', '', $tva_tx_txt); // Remove code into vatrate.
|
||||
}
|
||||
|
||||
$tva_tx = price2num(preg_replace('/\*/', '', $tva_tx)); // keep remove all after the numbers and dot
|
||||
$npr = preg_match('/\*/', $tva_tx_txt) ? 1 : 0;
|
||||
$localtax1 = 0; $localtax2 = 0; $localtax1_type = '0'; $localtax2_type = '0';
|
||||
// If value contains the unique code of vat line (new recommanded method), we use it to find npr and local taxes
|
||||
@ -217,8 +224,15 @@ if (empty($reshook))
|
||||
|
||||
$tva_tx_txt = $newvattx[$i];
|
||||
|
||||
$tva_tx = $tva_tx_txt;
|
||||
$vatratecode = '';
|
||||
$tva_tx = preg_replace('/[^0-9\.].*$/', '', $tva_tx_txt); // keep remove all after the numbers and dot
|
||||
if (preg_match('/\((.*)\)/', $tva_tx_txt, $reg))
|
||||
{
|
||||
$vat_src_code = $reg[1];
|
||||
$tva_tx = preg_replace('/\s*\(.*\)/', '', $tva_tx_txt); // Remove code into vatrate.
|
||||
}
|
||||
$tva_tx = price2num(preg_replace('/\*/', '', $tva_tx)); // keep remove all after the numbers and dot
|
||||
|
||||
$npr = preg_match('/\*/', $tva_tx_txt) ? 1 : 0;
|
||||
$localtax1 = $newlocaltax1_tx[$i];
|
||||
$localtax1_type = $newlocaltax1_type[$i];
|
||||
@ -266,9 +280,15 @@ if (empty($reshook))
|
||||
{
|
||||
$tva_tx_txt = GETPOST('tva_tx', 'alpha'); // tva_tx can be '8.5' or '8.5*' or '8.5 (XXX)' or '8.5* (XXX)'
|
||||
|
||||
$tva_tx = $tva_tx_txt;
|
||||
$vatratecode = '';
|
||||
// We must define tva_tx, npr and local taxes
|
||||
$tva_tx = preg_replace('/[^0-9\.].*$/', '', $tva_tx_txt); // keep remove all after the numbers and dot
|
||||
if (preg_match('/\((.*)\)/', $tva_tx_txt, $reg))
|
||||
{
|
||||
$vat_src_code = $reg[1];
|
||||
$tva_tx = preg_replace('/\s*\(.*\)/', '', $tva_tx_txt); // Remove code into vatrate.
|
||||
}
|
||||
$tva_tx = price2num(preg_replace('/\*/', '', $tva_tx)); // keep remove all after the numbers and dot
|
||||
|
||||
$npr = preg_match('/\*/', $tva_tx_txt) ? 1 : 0;
|
||||
$localtax1 = 0; $localtax2 = 0; $localtax1_type = '0'; $localtax2_type = '0';
|
||||
// If value contains the unique code of vat line (new recommanded method), we use it to find npr and local taxes
|
||||
@ -280,7 +300,7 @@ if (empty($reshook))
|
||||
$sql = "SELECT t.rowid, t.code, t.recuperableonly, t.localtax1, t.localtax2, t.localtax1_type, t.localtax2_type";
|
||||
$sql.= " FROM ".MAIN_DB_PREFIX."c_tva as t, ".MAIN_DB_PREFIX."c_country as c";
|
||||
$sql.= " WHERE t.fk_pays = c.rowid AND c.code = '".$mysoc->country_code."'";
|
||||
$sql.= " AND t.taux = ".((float) $tva_tx)." AND t.active = 1";
|
||||
$sql.= " AND t.taux = ".$tva_tx." AND t.active = 1";
|
||||
$sql.= " AND t.code ='".$vatratecode."'";
|
||||
$resql=$db->query($sql);
|
||||
if ($resql)
|
||||
@ -469,11 +489,17 @@ if (empty($reshook))
|
||||
$prodcustprice->price_min = price2num(GETPOST("price_min"), 'MU');
|
||||
$prodcustprice->price_base_type = GETPOST("price_base_type", 'alpha');
|
||||
|
||||
$tva_tx_txt = GETPOST("tva_tx");
|
||||
$tva_tx_txt = GETPOST("tva_tx",'alpha');
|
||||
|
||||
$tva_tx = $tva_tx_txt;
|
||||
$vatratecode = '';
|
||||
// We must define tva_tx, npr and local taxes
|
||||
$tva_tx = preg_replace('/[^0-9\.].*$/', '', $tva_tx_txt); // keep remove all after the numbers and dot
|
||||
if (preg_match('/\((.*)\)/', $tva_tx_txt, $reg))
|
||||
{
|
||||
$vat_src_code = $reg[1];
|
||||
$tva_tx = preg_replace('/\s*\(.*\)/', '', $tva_tx_txt); // Remove code into vatrate.
|
||||
}
|
||||
$tva_tx = price2num(preg_replace('/\*/', '', $tva_tx)); // keep remove all after the numbers and dot
|
||||
|
||||
$npr = preg_match('/\*/', $tva_tx_txt) ? 1 : 0;
|
||||
$localtax1 = 0; $localtax2 = 0; $localtax1_type = '0'; $localtax2_type = '0';
|
||||
// If value contains the unique code of vat line (new recommanded method), we use it to find npr and local taxes
|
||||
@ -485,7 +511,7 @@ if (empty($reshook))
|
||||
$sql = "SELECT t.rowid, t.code, t.recuperableonly, t.localtax1, t.localtax2, t.localtax1_type, t.localtax2_type";
|
||||
$sql.= " FROM ".MAIN_DB_PREFIX."c_tva as t, ".MAIN_DB_PREFIX."c_country as c";
|
||||
$sql.= " WHERE t.fk_pays = c.rowid AND c.code = '".$mysoc->country_code."'";
|
||||
$sql.= " AND t.taux = ".((float) $tva_tx)." AND t.active = 1";
|
||||
$sql.= " AND t.taux = ".$tva_tx." AND t.active = 1";
|
||||
$sql.= " AND t.code ='".$vatratecode."'";
|
||||
$resql=$db->query($sql);
|
||||
if ($resql)
|
||||
@ -565,9 +591,15 @@ if (empty($reshook))
|
||||
|
||||
$tva_tx_txt = GETPOST("tva_tx");
|
||||
|
||||
$vatratecode='';
|
||||
// We must define tva_tx, npr and local taxes
|
||||
$tva_tx = preg_replace('/[^0-9\.].*$/', '', $tva_tx_txt); // keep remove all after the numbers and dot
|
||||
$tva_tx = $tva_tx_txt;
|
||||
$vatratecode = '';
|
||||
if (preg_match('/\((.*)\)/', $tva_tx_txt, $reg))
|
||||
{
|
||||
$vat_src_code = $reg[1];
|
||||
$tva_tx = preg_replace('/\s*\(.*\)/', '', $tva_tx_txt); // Remove code into vatrate.
|
||||
}
|
||||
$tva_tx = price2num(preg_replace('/\*/', '', $tva_tx)); // keep remove all after the numbers and dot
|
||||
|
||||
$npr = preg_match('/\*/', $tva_tx_txt) ? 1 : 0;
|
||||
$localtax1 = 0; $localtax2 = 0; $localtax1_type = '0'; $localtax2_type = '0';
|
||||
// If value contains the unique code of vat line (new recommanded method), we use it to find npr and local taxes
|
||||
@ -579,7 +611,7 @@ if (empty($reshook))
|
||||
$sql = "SELECT t.rowid, t.code, t.recuperableonly, t.localtax1, t.localtax2, t.localtax1_type, t.localtax2_type";
|
||||
$sql.= " FROM ".MAIN_DB_PREFIX."c_tva as t, ".MAIN_DB_PREFIX."c_country as c";
|
||||
$sql.= " WHERE t.fk_pays = c.rowid AND c.code = '".$mysoc->country_code."'";
|
||||
$sql.= " AND t.taux = ".((float) $tva_tx)." AND t.active = 1";
|
||||
$sql.= " AND t.taux = ".$tva_tx." AND t.active = 1";
|
||||
$sql.= " AND t.code ='".$vatratecode."'";
|
||||
$resql=$db->query($sql);
|
||||
if ($resql)
|
||||
@ -712,17 +744,34 @@ if (! empty($conf->global->PRODUIT_MULTIPRICES))
|
||||
if (! empty($conf->global->PRODUIT_MULTIPRICES_USE_VAT_PER_LEVEL)) // using this option is a bug. kept for backward compatibility
|
||||
{
|
||||
// TVA
|
||||
print '<tr><td>' . $langs->trans("VATRate") . '</td><td colspan="2">' . vatrate($object->multiprices_tva_tx[$soc->price_level], true) . '</td></tr>';
|
||||
print '<tr><td>' . $langs->trans("VATRate") . '</td><td colspan="2">';
|
||||
|
||||
$positiverates='';
|
||||
if (price2num($object->multiprices_tva_tx[$soc->price_level])) $positiverates.=($positiverates?'/':'').price2num($object->multiprices_tva_tx[$soc->price_level]);
|
||||
if (price2num($object->multiprices_localtax1_type[$soc->price_level])) $positiverates.=($positiverates?'/':'').price2num($object->multiprices_localtax1_tx[$soc->price_level]);
|
||||
if (price2num($object->multiprices_localtax2_type[$soc->price_level])) $positiverates.=($positiverates?'/':'').price2num($object->multiprices_localtax2_tx[$soc->price_level]);
|
||||
if (empty($positiverates)) $positiverates='0';
|
||||
echo vatrate($positiverates.($object->default_vat_code?' ('.$object->default_vat_code.')':''), '%', $object->tva_npr);
|
||||
//print vatrate($object->multiprices_tva_tx[$soc->price_level], true);
|
||||
print '</td></tr>';
|
||||
}
|
||||
else
|
||||
{
|
||||
// TVA
|
||||
print '<tr><td>' . $langs->trans("VATRate") . '</td><td>';
|
||||
|
||||
$positiverates='';
|
||||
if (price2num($object->tva_tx)) $positiverates.=($positiverates?'/':'').price2num($object->tva_tx);
|
||||
if (price2num($object->localtax1_type)) $positiverates.=($positiverates?'/':'').price2num($object->localtax1_tx);
|
||||
if (price2num($object->localtax2_type)) $positiverates.=($positiverates?'/':'').price2num($object->localtax2_tx);
|
||||
if (empty($positiverates)) $positiverates='0';
|
||||
echo vatrate($positiverates.($object->default_vat_code?' ('.$object->default_vat_code.')':''), '%', $object->tva_npr);
|
||||
/*
|
||||
if ($object->default_vat_code)
|
||||
{
|
||||
print vatrate($object->tva_tx, true) . ' ('.$object->default_vat_code.')';
|
||||
}
|
||||
else print vatrate($object->tva_tx . ($object->tva_npr ? '*' : ''), true);
|
||||
else print vatrate($object->tva_tx . ($object->tva_npr ? '*' : ''), true);*/
|
||||
print '</td></tr>';
|
||||
}
|
||||
|
||||
@ -740,11 +789,19 @@ if (! empty($conf->global->PRODUIT_MULTIPRICES))
|
||||
{
|
||||
// TVA
|
||||
print '<tr><td class="titlefield">' . $langs->trans("VATRate") . '</td><td>';
|
||||
|
||||
$positiverates='';
|
||||
if (price2num($object->tva_tx)) $positiverates.=($positiverates?'/':'').price2num($object->tva_tx);
|
||||
if (price2num($object->localtax1_type)) $positiverates.=($positiverates?'/':'').price2num($object->localtax1_tx);
|
||||
if (price2num($object->localtax2_type)) $positiverates.=($positiverates?'/':'').price2num($object->localtax2_tx);
|
||||
if (empty($positiverates)) $positiverates='0';
|
||||
echo vatrate($positiverates.($object->default_vat_code?' ('.$object->default_vat_code.')':''), '%', $object->tva_npr);
|
||||
/*
|
||||
if ($object->default_vat_code)
|
||||
{
|
||||
print vatrate($object->tva_tx, true) . ' ('.$object->default_vat_code.')';
|
||||
}
|
||||
else print vatrate($object->tva_tx . ($object->tva_npr ? '*' : ''), true);
|
||||
else print vatrate($object->tva_tx . ($object->tva_npr ? '*' : ''), true);*/
|
||||
print '</td></tr>';
|
||||
}
|
||||
print '</table>';
|
||||
@ -889,11 +946,19 @@ else
|
||||
{
|
||||
// TVA
|
||||
print '<tr><td class="titlefield">' . $langs->trans("VATRate") . '</td><td>';
|
||||
|
||||
$positiverates='';
|
||||
if (price2num($object->tva_tx)) $positiverates.=($positiverates?'/':'').price2num($object->tva_tx);
|
||||
if (price2num($object->localtax1_type)) $positiverates.=($positiverates?'/':'').price2num($object->localtax1_tx);
|
||||
if (price2num($object->localtax2_type)) $positiverates.=($positiverates?'/':'').price2num($object->localtax2_tx);
|
||||
if (empty($positiverates)) $positiverates='0';
|
||||
echo vatrate($positiverates.($object->default_vat_code?' ('.$object->default_vat_code.')':''), '%', $object->tva_npr);
|
||||
/*
|
||||
if ($object->default_vat_code)
|
||||
{
|
||||
print vatrate($object->tva_tx, true) . ' ('.$object->default_vat_code.')';
|
||||
}
|
||||
else print vatrate($object->tva_tx, true, $object->tva_npr, true);
|
||||
else print vatrate($object->tva_tx, true, $object->tva_npr, true);*/
|
||||
print '</td></tr>';
|
||||
|
||||
// Price
|
||||
@ -1314,7 +1379,7 @@ if ($action == 'edit_price' && $object->getRights()->creer)
|
||||
|
||||
if ((empty($conf->global->PRODUIT_CUSTOMER_PRICES) || $action=='showlog_default_price') && ! in_array($action, array('edit_price','edit_vat')))
|
||||
{
|
||||
$sql = "SELECT p.rowid, p.price, p.price_ttc, p.price_base_type, p.tva_tx, p.default_vat_code, p.recuperableonly,";
|
||||
$sql = "SELECT p.rowid, p.price, p.price_ttc, p.price_base_type, p.tva_tx, p.default_vat_code, p.recuperableonly, p.localtax1_tx, p.localtax1_type, p.localtax2_tx, p.localtax2_type,";
|
||||
$sql .= " p.price_level, p.price_min, p.price_min_ttc,p.price_by_qty,";
|
||||
$sql .= " p.date_price as dp, p.fk_price_expression, u.rowid as user_id, u.login";
|
||||
$sql .= " FROM " . MAIN_DB_PREFIX . "product_price as p,";
|
||||
@ -1410,11 +1475,19 @@ if ((empty($conf->global->PRODUIT_CUSTOMER_PRICES) || $action=='showlog_default_
|
||||
if (empty($conf->global->PRODUIT_MULTIPRICES))
|
||||
{
|
||||
print '<td align="right">';
|
||||
|
||||
$positiverates='';
|
||||
if (price2num($objp->tva_tx)) $positiverates.=($positiverates?'/':'').price2num($objp->tva_tx);
|
||||
if (price2num($objp->localtax1_type)) $positiverates.=($positiverates?'/':'').price2num($objp->localtax1_tx);
|
||||
if (price2num($objp->localtax2_type)) $positiverates.=($positiverates?'/':'').price2num($objp->localtax2_tx);
|
||||
if (empty($positiverates)) $positiverates='0';
|
||||
echo vatrate($positiverates.($objp->default_vat_code?' ('.$objp->default_vat_code.')':''), '%', $objp->tva_npr);
|
||||
/*
|
||||
if ($objp->default_vat_code)
|
||||
{
|
||||
print vatrate($objp->tva_tx, true) . ' ('.$objp->default_vat_code.')';
|
||||
}
|
||||
else print vatrate($objp->tva_tx, true, $objp->recuperableonly);
|
||||
else print vatrate($objp->tva_tx, true, $objp->recuperableonly);*/
|
||||
print "</td>";
|
||||
}
|
||||
|
||||
@ -1769,7 +1842,17 @@ if (! empty($conf->global->PRODUIT_CUSTOMER_PRICES))
|
||||
print "<td>" . $staticsoc->getNomUrl(1) . "</td>";
|
||||
print "<td>" . dol_print_date($line->datec, "dayhour") . "</td>";
|
||||
print '<td align="center">' . $langs->trans($line->price_base_type) . "</td>";
|
||||
print '<td align="right">' . vatrate($tva_tx, true, $line->recuperableonly) . "</td>";
|
||||
print '<td align="right">';
|
||||
var_dump($prodcustprice);exit;
|
||||
$positiverates='';
|
||||
if (price2num($objp->tva_tx)) $positiverates.=($positiverates?'/':'').price2num($objp->tva_tx);
|
||||
if (price2num($objp->localtax1_type)) $positiverates.=($positiverates?'/':'').price2num($objp->localtax1_tx);
|
||||
if (price2num($objp->localtax2_type)) $positiverates.=($positiverates?'/':'').price2num($objp->localtax2_tx);
|
||||
if (empty($positiverates)) $positiverates='0';
|
||||
echo vatrate($positiverates.($objp->default_vat_code?' ('.$objp->default_vat_code.')':''), '%', $objp->tva_npr);
|
||||
|
||||
//. vatrate($tva_tx, true, $line->recuperableonly) .
|
||||
print "</td>";
|
||||
print '<td align="right">' . price($line->price) . "</td>";
|
||||
print '<td align="right">' . price($line->price_ttc) . "</td>";
|
||||
|
||||
@ -1873,8 +1956,16 @@ if (! empty($conf->global->PRODUIT_CUSTOMER_PRICES))
|
||||
|
||||
print '<td align="center">' . $langs->trans($object->price_base_type) . "</td>";
|
||||
print '<td align="right">';
|
||||
print vatrate($object->tva_tx, true, $object->recuperableonly);
|
||||
print $object->default_vat_code?' ('.$object->default_vat_code.')':'';
|
||||
|
||||
$positiverates='';
|
||||
if (price2num($object->tva_tx)) $positiverates.=($positiverates?'/':'').price2num($object->tva_tx);
|
||||
if (price2num($object->localtax1_type)) $positiverates.=($positiverates?'/':'').price2num($object->localtax1_tx);
|
||||
if (price2num($object->localtax2_type)) $positiverates.=($positiverates?'/':'').price2num($object->localtax2_tx);
|
||||
if (empty($positiverates)) $positiverates='0';
|
||||
echo vatrate($positiverates.($object->default_vat_code?' ('.$object->default_vat_code.')':''), '%', $object->tva_npr);
|
||||
|
||||
//print vatrate($object->tva_tx, true, $object->tva_npr);
|
||||
//print $object->default_vat_code?' ('.$object->default_vat_code.')':'';
|
||||
print "</td>";
|
||||
|
||||
print '<td align="right">' . price($object->price) . "</td>";
|
||||
@ -1939,7 +2030,16 @@ if (! empty($conf->global->PRODUIT_CUSTOMER_PRICES))
|
||||
print "<td>" . dol_print_date($line->datec, "dayhour") . "</td>";
|
||||
|
||||
print '<td align="center">' . $langs->trans($line->price_base_type) . "</td>";
|
||||
print '<td align="right">' . vatrate($tva_tx, true, $line->recuperableonly) . "</td>";
|
||||
print '<td align="right">';
|
||||
|
||||
$positiverates='';
|
||||
if (price2num($line->tva_tx)) $positiverates.=($positiverates?'/':'').price2num($line->tva_tx);
|
||||
if (price2num($line->localtax1_type)) $positiverates.=($positiverates?'/':'').price2num($line->localtax1_tx);
|
||||
if (price2num($line->localtax2_type)) $positiverates.=($positiverates?'/':'').price2num($line->localtax2_tx);
|
||||
if (empty($positiverates)) $positiverates='0';
|
||||
echo vatrate($positiverates.($line->default_vat_code?' ('.$line->default_vat_code.')':''), '%', $line->tva_npr);
|
||||
|
||||
print "</td>";
|
||||
print '<td align="right">' . price($line->price) . "</td>";
|
||||
print '<td align="right">' . price($line->price_ttc) . "</td>";
|
||||
|
||||
|
||||
@ -205,7 +205,7 @@ $linkback = '<a href="'.DOL_URL_ROOT.'/product/list.php">'.$langs->trans("BackTo
|
||||
$shownav = 1;
|
||||
if ($user->societe_id && ! in_array('product', explode(',',$conf->global->MAIN_MODULES_FOR_EXTERNAL))) $shownav=0;
|
||||
|
||||
dol_banner_tab($object, 'ref', $linkback, shownav, 'ref');
|
||||
dol_banner_tab($object, 'ref', $linkback, shownav, 'ref', '', '', '', 0, '', '', 1);
|
||||
|
||||
dol_fiche_end();
|
||||
|
||||
|
||||
@ -1021,7 +1021,7 @@ class Societe extends CommonObject
|
||||
$sql = 'SELECT s.rowid, s.nom as name, s.name_alias, s.entity, s.ref_ext, s.ref_int, s.address, s.datec as date_creation, s.prefix_comm';
|
||||
$sql .= ', s.status';
|
||||
$sql .= ', s.price_level';
|
||||
$sql .= ', s.tms as date_modification';
|
||||
$sql .= ', s.tms as date_modification, s.fk_user_creat, s.fk_user_modif';
|
||||
$sql .= ', s.phone, s.fax, s.email, s.skype, s.url, s.zip, s.town, s.note_private, s.note_public, s.model_pdf, s.client, s.fournisseur';
|
||||
$sql .= ', s.siren as idprof1, s.siret as idprof2, s.ape as idprof3, s.idprof4, s.idprof5, s.idprof6';
|
||||
$sql .= ', s.capital, s.tva_intra';
|
||||
@ -1087,8 +1087,10 @@ class Societe extends CommonObject
|
||||
$this->ref_ext = $obj->ref_ext;
|
||||
$this->ref_int = $obj->ref_int;
|
||||
|
||||
$this->date_creation = $this->db->jdate($obj->date_creation);
|
||||
$this->date_creation = $this->db->jdate($obj->date_creation);
|
||||
$this->date_modification = $this->db->jdate($obj->date_modification);
|
||||
$this->user_creation = $obj->fk_user_creat;
|
||||
$this->user_modification = $obj->fk_user_modif;
|
||||
|
||||
$this->address = $obj->address;
|
||||
$this->zip = $obj->zip;
|
||||
|
||||
@ -644,6 +644,12 @@ div.myavailability {
|
||||
text-overflow: ellipsis;
|
||||
white-space: nowrap;
|
||||
}
|
||||
.tdoverflowmax200 { /* For tdoverflow, the max-midth become a minimum ! */
|
||||
max-width: 200px;
|
||||
overflow: hidden;
|
||||
text-overflow: ellipsis;
|
||||
white-space: nowrap;
|
||||
}
|
||||
.tdoverflowmax300 { /* For tdoverflow, the max-midth become a minimum ! */
|
||||
max-width: 300px;
|
||||
overflow: hidden;
|
||||
|
||||
@ -644,6 +644,12 @@ div.myavailability {
|
||||
text-overflow: ellipsis;
|
||||
white-space: nowrap;
|
||||
}
|
||||
.tdoverflowmax200 { /* For tdoverflow, the max-midth become a minimum ! */
|
||||
max-width: 200px;
|
||||
overflow: hidden;
|
||||
text-overflow: ellipsis;
|
||||
white-space: nowrap;
|
||||
}
|
||||
.tdoverflowmax300 {
|
||||
max-width: 300px;
|
||||
overflow: hidden;
|
||||
|
||||
Loading…
Reference in New Issue
Block a user