Merge remote-tracking branch 'origin/3.9' into develop

Conflicts:
	htdocs/core/menus/init_menu_auguria.sql
	htdocs/core/menus/standard/eldy.lib.php
This commit is contained in:
Laurent Destailleur 2016-02-19 04:46:11 +01:00
commit 9c8d69eaa9
40 changed files with 686 additions and 193 deletions

View File

@ -1013,14 +1013,14 @@ else
print '<tr><td align="left">'.$langs->trans("CalcLocaltax").': ';
if($conf->global->MAIN_INFO_LOCALTAX_CALC1==0)
{
print $langs->transcountry("CalcLocaltax1",$mysoc->country_code);
print $langs->trans("CalcLocaltax1").' - '.$langs->trans("CalcLocaltax1Desc");
}
else if($conf->global->MAIN_INFO_LOCALTAX_CALC1==1)
{
print $langs->transcountry("CalcLocaltax2",$mysoc->country_code);
print $langs->trans("CalcLocaltax2").' - '.$langs->trans("CalcLocaltax2Desc");
}
else if($conf->global->MAIN_INFO_LOCALTAX_CALC1==2){
print $langs->transcountry("CalcLocaltax3",$mysoc->country_code);
print $langs->trans("CalcLocaltax3").' - '.$langs->trans("CalcLocaltax3Desc");
}
print '</td></tr>';

View File

@ -236,7 +236,7 @@ class Categorie extends CommonObject
$error=0;
dol_syslog(get_class($this).'::create', LOG_DEBUG);
// Clean parameters
$this->label = trim($this->label);
$this->description = trim($this->description);
@ -412,7 +412,7 @@ class Categorie extends CommonObject
// End call triggers
$this->db->commit();
return 1;
}
else
@ -578,12 +578,12 @@ class Categorie extends CommonObject
if ($this->id == -1) return -2;
// For backward compatibility
if ($type == 'societe')
if ($type == 'societe')
{
$type = 'customer';
dol_syslog(get_class($this) . "::add_type(): type 'societe' is deprecated, please use 'customer' instead", LOG_WARNING);
}
elseif ($type == 'fournisseur')
elseif ($type == 'fournisseur')
{
$type = 'supplier';
dol_syslog(get_class($this) . "::add_type(): type 'fournisseur' is deprecated, please use 'supplier' instead", LOG_WARNING);
@ -1138,29 +1138,57 @@ class Categorie extends CommonObject
* Retourne les chemin de la categorie, avec les noms des categories
* separes par $sep (" >> " par defaut)
*
* @param string $sep Separator
* @param string $url Url
* @param string $sep Separator
* @param string $url Url
* @param int $nocolor 0
* @return array
*/
function print_all_ways($sep = " &gt;&gt; ", $url='')
function print_all_ways($sep = " &gt;&gt; ", $url='', $nocolor=0)
{
$ways = array();
foreach ($this->get_all_ways() as $way)
$allways = $this->get_all_ways(); // Load array of categories
foreach ($allways as $way)
{
$w = array();
$i = 0;
foreach ($way as $cat)
{
$i++;
if (empty($nocolor))
{
$forced_color='toreplace';
if ($i == count($way))
{
// Check contrast with background and correct text color
$forced_color='categtextwhite';
if ($cat->color)
{
$hex=$cat->color;
$r = hexdec($hex[0].$hex[1]);
$g = hexdec($hex[2].$hex[3]);
$b = hexdec($hex[4].$hex[5]);
$bright = (max($r, $g, $b) + min($r, $g, $b)) / 510.0; // HSL algorithm
if ($bright >= 0.5) $forced_color='categtextblack'; // Higher than 60%
}
}
}
if ($url == '')
{
$w[] = "<a href='".DOL_URL_ROOT."/categories/viewcat.php?id=".$cat->id."&amp;type=".$cat->type."'>".$cat->label."</a>";
$link = '<a href="'.DOL_URL_ROOT.'/categories/viewcat.php?id='.$cat->id.'&type='.$cat->type.'" class="'.$forced_color .'">';
$linkend='</a>';
$w[] = $link.$cat->label.$linkend;
}
else
{
$w[] = "<a href='".DOL_URL_ROOT."/$url?catid=".$cat->id."'>".$cat->label."</a>";
}
}
$ways[] = implode($sep, $w);
$newcategwithpath = preg_replace('/toreplace/', $forced_color, implode($sep, $w));
$ways[] = $newcategwithpath;
}
return $ways;
@ -1356,6 +1384,7 @@ class Categorie extends CommonObject
/**
* Return name and link of category (with picto)
* Use ->id, ->ref, ->label, ->color
*
* @param int $withpicto 0=No picto, 1=Include picto into link, 2=Only picto
* @param string $option Sur quoi pointe le lien ('', 'xyz')
@ -1369,7 +1398,19 @@ class Categorie extends CommonObject
$result='';
$label=$langs->trans("ShowCategory").': '. ($this->ref?$this->ref:$this->label);
$link = '<a href="'.DOL_URL_ROOT.'/categories/viewcat.php?id='.$this->id.'&type='.$this->type.'" title="'.dol_escape_htmltag($label, 1).'" class="classfortooltip">';
// Check contrast with background and correct text color
$forced_color='categtextwhite';
if ($this->color)
{
$hex=$this->color;
$r = hexdec($hex[0].$hex[1]);
$g = hexdec($hex[2].$hex[3]);
$b = hexdec($hex[4].$hex[5]);
$bright = (max($r, $g, $b) + min($r, $g, $b)) / 510.0; // HSL algorithm
if ($bright >= 0.5) $forced_color='categtextblack'; // Higher than 60%
}
$link = '<a href="'.DOL_URL_ROOT.'/categories/viewcat.php?id='.$this->id.'&type='.$this->type.'" title="'.dol_escape_htmltag($label, 1).'" class="classfortooltip '.$forced_color .'">';
$linkend='</a>';
$picto='category';

View File

@ -189,7 +189,7 @@ print '<table border="0" width="100%" class="border">';
// Path of category
print '<tr><td width="20%" class="notopnoleft">';
$ways = $object->print_all_ways();
$ways = $object->print_all_ways(" &gt;&gt; ", '', 1);
print $langs->trans("Ref").'</td><td>';
print '<a href="'.DOL_URL_ROOT.'/categories/index.php?leftmenu=cat&type='.$type.'">'.$langs->trans("Root").'</a> >> ';
foreach ($ways as $way)

View File

@ -84,12 +84,12 @@ if ($_socid > 0)
if ($objsoc->client == 1) $tabchoice='customer';
if ($objsoc->client == 2) $tabchoice='prospect';
dol_fiche_head($head, $tabchoice, $langs->trans("ThirdParty"), 0, 'company');
print '<form method="POST" action="multiprix.php?id='.$objsoc->id.'">';
print '<input type="hidden" name="token" value="'.$_SESSION['newtoken'].'">';
print '<input type="hidden" name="action" value="setpricelevel">';
dol_fiche_head($head, $tabchoice, $langs->trans("ThirdParty"), 0, 'company');
print '<table width="100%" border="0">';
print '<tr><td valign="top">';
print '<table class="border" width="100%">';
@ -121,12 +121,14 @@ if ($_socid > 0)
print "</td></tr>";
print "</table>";
print '<div align="center"><br><input type="submit" class="button" value="'.$langs->trans("Save").'"></div>';
dol_fiche_end();
print '<div align="center"><input type="submit" class="button" value="'.$langs->trans("Save").'"></div>';
print "</form>";
print "</div>\n";
print '<br>';
print '<br><br>';
/*

View File

@ -2,7 +2,7 @@
/* Copyright (C) 2001-2003 Rodolphe Quiedeville <rodolphe@quiedeville.org>
* Copyright (C) 2004-2014 Laurent Destailleur <eldy@users.sourceforge.net>
* Copyright (C) 2005-2010 Regis Houssin <regis.houssin@capnetworks.com>
* Copyright (C) 2011-2014 Alexandre Spangaro <aspangaro.dolibarr@gmail.com>
* Copyright (C) 2011-2016 Alexandre Spangaro <aspangaro.dolibarr@gmail.com>
* Copyright (C) 2011-2014 Juanjo Menent <jmenent@2byte.es>
* Copyright (C) 2015 Jean-François Ferry <jfefe@aternatik.fr>
*
@ -104,8 +104,7 @@ if ($mode != 'sconly')
print "<br>";
}
if ($conf->tax->enabled)
if (! empty($conf->tax->enabled) && $user->rights->tax->charges->lire)
{
// Social contributions only
if ($mode != 'sconly')
@ -216,7 +215,7 @@ if ($conf->tax->enabled)
}
// VAT
if ($conf->tax->enabled)
if (! empty($conf->tax->enabled) && $user->rights->tax->charges->lire)
{
if (! $mode || $mode != 'sconly')
{
@ -399,16 +398,16 @@ while($j<$numlt)
}
// Payment Salary
if ($conf->salaries->enabled)
if (! empty($conf->salaries->enabled) && $user->rights->salaries->read)
{
if (! $mode || $mode != 'sconly')
{
$sal = new PaymentSalary($db);
print '<br>';
print load_fiche_titre($langs->trans("SalariesPayments").($year?' ('.$langs->trans("Year").' '.$year.')':''), '', '');
print "<br>";
print_fiche_titre($langs->trans("SalariesPayments").($year?' ('.$langs->trans("Year").' '.$year.')':''), '', '');
$sql = "SELECT s.rowid, s.amount, s.label, s.datep as datep, s.datev as datev, s.datesp, s.dateep, s.salary, u.salary as current_salary";
$sql.= " FROM ".MAIN_DB_PREFIX."payment_salary as s, ".MAIN_DB_PREFIX."user as u";

View File

@ -343,7 +343,7 @@ if (empty($reshook))
}
}
$object->oldcopy = clone$object;
$object->oldcopy = clone $object;
$object->old_lastname = GETPOST("old_lastname");
$object->old_firstname = GETPOST("old_firstname");

View File

@ -5206,17 +5206,18 @@ class Form
print '<tr ' . $bc [$var] . '>';
print '<td aling="left">';
print '<input type="radio" name="linkedOrder" value=' . $objp->rowid . '>';
print '</td>';
print '<td align="center">' . $objp->ref . '</td>';
print '<td>' . $objp->ref_client . '</td>';
print '<td>' . price($objp->total_ht) . '</td>';
print '<td>' . $objp->name . '</td>';
print '</td>';
print '</tr>';
$i ++;
}
print '</table>';
print '<div class="center"><input type="submit" class="button" value="' . $langs->trans('ToLink') . '">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;<input type="submit" class="button" name="cancel" value="' . $langs->trans('Cancel') . '"></div>';
print '</form>';
$this->db->free($resqlorderlist);
} else {
@ -5333,11 +5334,11 @@ class Form
print '<tr ' . $bc [$var] . '>';
print '<td aling="left">';
print '<input type="radio" name="linkedOrder" value=' . $objp->rowid . '>';
print '</td>';
print '<td align="center">' . $objp->ref . '</td>';
print '<td>' . $objp->ref_supplier . '</td>';
print '<td>' . price($objp->total_ht) . '</td>';
print '<td>' . $objp->name . '</td>';
print '</td>';
print '</tr>';
$i ++;

View File

@ -595,13 +595,20 @@ class FormOther
*/
static function showColor($color, $textifnotdefined='')
{
$textcolor='FFF';
if ($color)
{
$hex=$color;
$r = hexdec($hex[0].$hex[1]);
$g = hexdec($hex[2].$hex[3]);
$b = hexdec($hex[4].$hex[5]);
$bright = (max($r, $g, $b) + min($r, $g, $b)) / 510.0; // HSL algorithm
if ($bright > 0.6) $textcolor='000';
}
include_once DOL_DOCUMENT_ROOT.'/core/lib/functions2.lib.php';
$color = colorArrayToHex(colorStringToArray($color,array()),'');
$textcolor='000';
$tmpcolorweight=0;
foreach(colorStringToArray($color,array()) as $x) $tmpcolorweight+=$x;
if ($tmpcolorweight < 400) $textcolor='FFF';
if ($color) print '<input type="text" class="colorthumb" disabled style="padding: 1px; margin-top: 0; margin-bottom: 0; color: #'.$textcolor.'; background-color: #'.$color.'" value="'.$color.'">';
else print $textifnotdefined;
}

View File

@ -3398,7 +3398,7 @@ function price2num($amount,$rounding='',$alreadysqlnb=0)
* Return localtax rate for a particular vat, when selling a product with vat $vatrate, from a $thirdparty_buyer to a $thirdparty_seller
* Note: This function applies same rules than get_default_tva
*
* @param float $vatrate Vat rate
* @param float $vatrate Vat rate. Can be '8.5' or '8.5 (8.5NPR)' for example
* @param int $local Local tax to search and return (1 or 2 return only tax rate 1 or tax rate 2)
* @param Societe $thirdparty_buyer Object of buying third party
* @param Societe $thirdparty_seller Object of selling third party
@ -3589,7 +3589,7 @@ function get_localtax_by_third($local)
* Instead this function must be called when adding a line to get the array of localtax and type, and then
* provide it to the function calcul_price_total.
*
* @param float $vatrate VAT Rate
* @param float $vatrate VAT Rate. Value can be '8.5' or '8.5 (8.5NPR)'.
* @param int $local Number of localtax (1 or 2, or 0 to return 1 & 2)
* @param Societe $buyer Company object
* @param Societe $seller Company object
@ -3740,7 +3740,7 @@ function get_product_vat_for_country($idprod, $thirdparty_seller, $idprodfournpr
}
else dol_print_error($db);
}
else $ret=$conf->global->MAIN_VAT_DEFAULT_IF_AUTODETECT_FAILS;
else $ret=$conf->global->MAIN_VAT_DEFAULT_IF_AUTODETECT_FAILS; // Forced value if autodetect fails
}
dol_syslog("get_product_vat_for_country: ret=".$ret);

View File

@ -47,7 +47,7 @@
* @param int $info_bits Miscellaneous informations on line
* @param int $type 0/1=Product/service
* @param Societe $seller Thirdparty seller (we need $seller->country_id property). Provided only if seller is the supplier, otherwise $seller will be $mysoc.
* @param array $localtaxes_array Array with localtaxes info (loaded by getLocalTaxesFromRate(vatrate, 0, ...) function).
* @param array $localtaxes_array Array with localtaxes info array('0'=>type1,'1'=>rate1,'2'=>type2,'3'=>rate2) (loaded by getLocalTaxesFromRate(vatrate, 0, ...) function).
* @param integer $progress Situation invoices progress (value from 0 to 100, 100 by default)
* @param double $multicurrency_tx Currency rate (1 by default)
* @return result[ 0=total_ht,
@ -117,7 +117,7 @@ function calcul_price_total($qty, $pu, $remise_percent_ligne, $txtva, $uselocalt
$localtax2_type = $localtaxes_array[2];
$localtax2_rate = $localtaxes_array[3];
}
else // deprecated method. values and type for localtaxes must be provided by caller and loade with getLocalTaxesFromRate
else // deprecated method. values and type for localtaxes must be provided by caller and loaded with getLocalTaxesFromRate
{
$sql = "SELECT taux, localtax1, localtax2, localtax1_type, localtax2_type";
$sql.= " FROM ".MAIN_DB_PREFIX."c_tva as cv";

View File

@ -101,7 +101,7 @@ function product_prepare_head($object)
$head[$h][2] = 'stats';
$h++;
$head[$h][0] = DOL_URL_ROOT."/product/stats/facture.php?id=".$object->id;
$head[$h][0] = DOL_URL_ROOT."/product/stats/facture.php?showmessage=1&id=".$object->id;
$head[$h][1] = $langs->trans('Referers');
$head[$h][2] = 'referers';
$h++;
@ -203,22 +203,25 @@ function product_admin_prepare_head()
*
* @param Product $product Product object
* @param int $socid Thirdparty id
* @return integer
* @return integer NB of lines shown into array
*/
function show_stats_for_company($product,$socid)
{
global $conf,$langs,$user,$db;
$nblines = 0;
print '<tr>';
print '<td align="left" width="25%" valign="top">'.$langs->trans("Referers").'</td>';
print '<td align="right" width="25%">'.$langs->trans("NbOfThirdParties").'</td>';
print '<td align="right" width="25%">'.$langs->trans("NbOfReferers").'</td>';
print '<td align="right" width="25%">'.$langs->trans("NbOfObjectReferers").'</td>';
print '<td align="right" width="25%">'.$langs->trans("TotalQuantity").'</td>';
print '</tr>';
// Propals
if (! empty($conf->propal->enabled) && $user->rights->propale->lire)
{
$nblines++;
$ret=$product->load_stats_propale($socid);
if ($ret < 0) dol_print_error($db);
$langs->load("propal");
@ -236,6 +239,7 @@ function show_stats_for_company($product,$socid)
// Commandes clients
if (! empty($conf->commande->enabled) && $user->rights->commande->lire)
{
$nblines++;
$ret=$product->load_stats_commande($socid);
if ($ret < 0) dol_print_error($db);
$langs->load("orders");
@ -253,6 +257,7 @@ function show_stats_for_company($product,$socid)
// Commandes fournisseurs
if (! empty($conf->fournisseur->enabled) && $user->rights->fournisseur->commande->lire)
{
$nblines++;
$ret=$product->load_stats_commande_fournisseur($socid);
if ($ret < 0) dol_print_error($db);
$langs->load("orders");
@ -270,6 +275,7 @@ function show_stats_for_company($product,$socid)
// Contrats
if (! empty($conf->contrat->enabled) && $user->rights->contrat->lire)
{
$nblines++;
$ret=$product->load_stats_contrat($socid);
if ($ret < 0) dol_print_error($db);
$langs->load("contracts");
@ -287,6 +293,7 @@ function show_stats_for_company($product,$socid)
// Factures clients
if (! empty($conf->facture->enabled) && $user->rights->facture->lire)
{
$nblines++;
$ret=$product->load_stats_facture($socid);
if ($ret < 0) dol_print_error($db);
$langs->load("bills");
@ -304,6 +311,7 @@ function show_stats_for_company($product,$socid)
// Factures fournisseurs
if (! empty($conf->fournisseur->enabled) && $user->rights->fournisseur->facture->lire)
{
$nblines++;
$ret=$product->load_stats_facture_fournisseur($socid);
if ($ret < 0) dol_print_error($db);
$langs->load("bills");
@ -319,7 +327,7 @@ function show_stats_for_company($product,$socid)
print '</tr>';
}
return 0;
return $nblines++;
}

View File

@ -114,7 +114,7 @@ insert into llx_menu (module, enabled, menu_handler, type, rowid, mainmenu, left
insert into llx_menu (module, enabled, menu_handler, type, rowid, mainmenu, leftmenu, fk_menu, url, titre, level, langs, perms, target, usertype, position, entity) values ('', '$conf->stock->enabled', __HANDLER__, 'left', 3102__+MAX_llx_menu__, 'products', '', 3100__+MAX_llx_menu__, '/product/stock/list.php', 'List', 1, 'stocks', '$user->rights->stock->lire', '', 2, 1, __ENTITY__);
insert into llx_menu (module, enabled, menu_handler, type, rowid, mainmenu, leftmenu, fk_menu, url, titre, level, langs, perms, target, usertype, position, entity) values ('', '$conf->stock->enabled', __HANDLER__, 'left', 3104__+MAX_llx_menu__, 'products', '', 3100__+MAX_llx_menu__, '/product/stock/mouvement.php', 'Movements', 1, 'stocks', '$user->rights->stock->mouvement->lire', '', 2, 3, __ENTITY__);
insert into llx_menu (module, enabled, menu_handler, type, rowid, mainmenu, leftmenu, fk_menu, url, titre, level, langs, perms, target, usertype, position, entity) values ('', '$conf->stock->enabled && $conf->supplier_order->enabled', __HANDLER__, 'left', 3105__+MAX_llx_menu__, 'products', '', 3100__+MAX_llx_menu__, '/product/stock/replenish.php', 'Replenishments', 1, 'stocks', '$user->rights->stock->mouvement->creer && $user->rights->fournisseur->lire', '', 2, 4, __ENTITY__);
insert into llx_menu (module, enabled, menu_handler, type, rowid, mainmenu, leftmenu, fk_menu, url, titre, level, langs, perms, target, usertype, position, entity) values ('', '$conf->stock->enabled', __HANDLER__, 'left', 3106__+MAX_llx_menu__, 'products', '', 3100__+MAX_llx_menu__, '/product/stock/massstockmove.php', 'StockTransfer', 1, 'stocks', '$user->rights->stock->mouvement->creer', '', 2, 5, __ENTITY__);
insert into llx_menu (module, enabled, menu_handler, type, rowid, mainmenu, leftmenu, fk_menu, url, titre, level, langs, perms, target, usertype, position, entity) values ('', '$conf->stock->enabled', __HANDLER__, 'left', 3106__+MAX_llx_menu__, 'products', '', 3100__+MAX_llx_menu__, '/product/stock/massstockmove.php', 'MassStockTransferShort', 1, 'stocks', '$user->rights->stock->mouvement->creer', '', 2, 5, __ENTITY__);
-- Product - Categories
insert into llx_menu (module, enabled, menu_handler, type, rowid, mainmenu, leftmenu, fk_menu, url, titre, level, langs, perms, target, usertype, position, entity) values ('', '$conf->categorie->enabled', __HANDLER__, 'left', 3200__+MAX_llx_menu__, 'products', 'cat', 3__+MAX_llx_menu__, '/categories/index.php?leftmenu=cat&amp;type=0', 'Categories', 0, 'categories', '$user->rights->categorie->lire', '', 2, 4, __ENTITY__);
@ -222,9 +222,9 @@ insert into llx_menu (module, enabled, menu_handler, type, rowid, mainmenu, left
-- Journals
-- insert into llx_menu (module, enabled, menu_handler, type, rowid, mainmenu, leftmenu, fk_menu, url, titre, level, langs, perms, target, usertype, position, entity) values ('', '$conf->accounting->enabled', __HANDLER__, 'left', 2420__+MAX_llx_menu__, 'accountancy', 'journal', 2400__+MAX_llx_menu__, '/accountancy/journal/index.php?leftmenu=journal', 'Journaux', 1, 'accountancy', '$user->rights->accounting->comptarapport->lire', '', 0, 7, __ENTITY__);
-- General Ledger
insert into llx_menu (module, enabled, menu_handler, type, rowid, mainmenu, leftmenu, fk_menu, url, titre, level, langs, perms, target, usertype, position, entity) values ('', '$conf->accounting->enabled', __HANDLER__, 'left', 2430__+MAX_llx_menu__, 'accountancy', 'bookkeeping', 2400__+MAX_llx_menu__, '/accountancy/bookkeeping/list.php?leftmenu=bookkeeping', 'Bookkeeping', 1, 'accountancy', '$user->rights->accounting->mouvements->lire', '', 0, 15, __ENTITY__);
insert into llx_menu (module, enabled, menu_handler, type, rowid, mainmenu, leftmenu, fk_menu, url, titre, level, langs, perms, target, usertype, position, entity) values ('', '$conf->accounting->enabled && $leftmenu=="bookkeeping"', __HANDLER__, 'left', 2431__+MAX_llx_menu__, 'accountancy', '', 2430__+MAX_llx_menu__, '/accountancy/bookkeeping/listbyyear.php', 'ByYear', 2, 'accountancy', '$user->rights->accounting->mouvements->lire', '', 0, 16, __ENTITY__);
insert into llx_menu (module, enabled, menu_handler, type, rowid, mainmenu, leftmenu, fk_menu, url, titre, level, langs, perms, target, usertype, position, entity) values ('', '$conf->accounting->enabled && $leftmenu=="bookkeeping"', __HANDLER__, 'left', 2432__+MAX_llx_menu__, 'accountancy', '', 2430__+MAX_llx_menu__, '/accountancy/bookkeeping/balancebymonth.php', 'AccountBalanceByMonth', 2, 'accountancy', '$user->rights->accounting->mouvements->lire', '', 0, 16, __ENTITY__);
insert into llx_menu (module, enabled, menu_handler, type, rowid, mainmenu, leftmenu, fk_menu, url, titre, level, langs, perms, target, usertype, position, entity) values ('', '$conf->accounting->enabled', __HANDLER__, 'left', 2430__+MAX_llx_menu__, 'accountancy', 'bookkeeping', 2400__+MAX_llx_menu__, '/accountancy/bookkeeping/list.php', 'Bookkeeping', 1, 'accountancy', '$user->rights->accounting->mouvements->lire', '', 0, 15, __ENTITY__);
-- Balance
insert into llx_menu (module, enabled, menu_handler, type, rowid, mainmenu, leftmenu, fk_menu, url, titre, level, langs, perms, target, usertype, position, entity) values ('', '$conf->accounting->enabled', __HANDLER__, 'left', 2435__+MAX_llx_menu__, 'accountancy', 'balance', 2400__+MAX_llx_menu__, '/accountancy/bookkeeping/balance.php', 'AccountBalance', 1, 'accountancy', '$user->rights->accounting->mouvements->lire', '', 0, 16, __ENTITY__);
-- Reports
insert into llx_menu (module, enabled, menu_handler, type, rowid, mainmenu, leftmenu, fk_menu, url, titre, level, langs, perms, target, usertype, position, entity) values ('', '$conf->accounting->enabled', __HANDLER__, 'left', 2440__+MAX_llx_menu__, 'accountancy', 'report', 2400__+MAX_llx_menu__, '/compta/resultat/index.php?leftmenu=ca&amp;mainmenu=accountancy', 'Reportings', 1, 'main', '$user->rights->compta->resultat->lire || $user->rights->accounting->comptarapport->lire', '', 0, 17, __ENTITY__);
insert into llx_menu (module, enabled, menu_handler, type, rowid, mainmenu, leftmenu, fk_menu, url, titre, level, langs, perms, target, usertype, position, entity) values ('', '$conf->accounting->enabled && $leftmenu=="ca"', __HANDLER__, 'left', 2441__+MAX_llx_menu__, 'accountancy', '', 2440__+MAX_llx_menu__, '/compta/resultat/index.php?leftmenu=ca', 'ReportInOut', 2, 'main', '$user->rights->compta->resultat->lire || $user->rights->accounting->comptarapport->lire', '', 0, 18, __ENTITY__);

View File

@ -976,10 +976,10 @@ function print_left_eldy_menu($db,$menu_array_before,$menu_array_after,&$tabMenu
}
// General Ledger
if (preg_match('/accountancy/',$leftmenu)) $newmenu->add("/accountancy/bookkeeping/list.php?leftmenu=accountancy_bookkeeping",$langs->trans("Bookkeeping"),1,$user->rights->accounting->mouvements->lire, '', $mainmenu, 'bookkeeping');
if (preg_match('/accountancy_bookkeeping/',$leftmenu)) $newmenu->add("/accountancy/bookkeeping/balance.php?leftmenu=accountancy_bookkeeping",$langs->trans("AccountBalance"),2,$user->rights->accounting->mouvements->lire);
if (preg_match('/accountancy_bookkeeping/',$leftmenu)) $newmenu->add("/accountancy/bookkeeping/listbyyear.php?leftmenu=accountancy_bookkeeping",$langs->trans("ByYear"),2,$user->rights->accounting->mouvements->lire);
if (preg_match('/accountancy_bookkeeping/',$leftmenu)) $newmenu->add("/accountancy/bookkeeping/balancebymonth.php?leftmenu=accountancy_bookkeeping",$langs->trans("AccountBalanceByMonth"),2,$user->rights->accounting->mouvements->lire);
$newmenu->add("/accountancy/bookkeeping/list.php",$langs->trans("Bookkeeping"),1,$user->rights->accounting->mouvements->lire);
// Balance
$newmenu->add("/accountancy/bookkeeping/balance.php",$langs->trans("AccountBalance"),1,$user->rights->accounting->mouvements->lire);
// Reports
$langs->load("compta");
@ -1140,8 +1140,9 @@ function print_left_eldy_menu($db,$menu_array_before,$menu_array_after,&$tabMenu
$newmenu->add("/product/stock/card.php?action=create", $langs->trans("MenuNewWarehouse"), 1, $user->rights->stock->creer);
$newmenu->add("/product/stock/list.php", $langs->trans("List"), 1, $user->rights->stock->lire);
$newmenu->add("/product/stock/mouvement.php", $langs->trans("Movements"), 1, $user->rights->stock->mouvement->lire);
if ($conf->supplier_order->enabled) $newmenu->add("/product/stock/replenish.php", $langs->trans("Replenishment"), 1, $user->rights->stock->mouvement->creer && $user->rights->fournisseur->lire);
$newmenu->add("/product/stock/massstockmove.php", $langs->trans("StockTransfer"), 1, $user->rights->stock->mouvement->creer);
$newmenu->add("/product/stock/massstockmove.php", $langs->trans("MassStockTransferShort"), 1, $user->rights->stock->mouvement->creer);
}
// Expeditions

View File

@ -146,10 +146,11 @@ class pdf_paiement
$num=0;
$lines=array();
// count number of ligne of payement
// count number of lines of payment
$sql = "SELECT p.rowid as prowid";
$sql.= " FROM ".MAIN_DB_PREFIX."paiement as p";
$sql.= " WHERE p.datep BETWEEN '".$this->db->idate(dol_get_first_day($year,$month))."' AND '".$this->db->idate(dol_get_last_day($year,$month))."'";
$sql.= " AND p.entity = " . $conf->entity;
$result = $this->db->query($sql);
if ($result)
{
@ -160,19 +161,23 @@ class pdf_paiement
$sql = "SELECT p.datep as dp, f.facnumber";
//$sql .= ", c.libelle as paiement_type, p.num_paiement";
$sql.= ", c.code as paiement_code, p.num_paiement";
$sql.= ", p.amount as paiement_amount, f.total_ttc as facture_amount ";
$sql.= ", pf.amount as pf_amount , ba.ref as bankaccount ";
$sql.= ", p.amount as paiement_amount, f.total_ttc as facture_amount";
$sql.= ", pf.amount as pf_amount";
if (! empty($conf->banque->enabled))
$sql.= ", ba.ref as bankaccount";
$sql.= ", p.rowid as prowid";
$sql.= " FROM ".MAIN_DB_PREFIX."paiement as p, ".MAIN_DB_PREFIX."facture as f,";
$sql.= " ".MAIN_DB_PREFIX."c_paiement as c, ".MAIN_DB_PREFIX."paiement_facture as pf,";
$sql.= " ".MAIN_DB_PREFIX."bank as b, ".MAIN_DB_PREFIX."bank_account as ba,";
if (! empty($conf->banque->enabled))
$sql.= " ".MAIN_DB_PREFIX."bank as b, ".MAIN_DB_PREFIX."bank_account as ba,";
$sql.= " ".MAIN_DB_PREFIX."societe as s";
if (! $user->rights->societe->client->voir && ! $socid)
{
$sql .= ", ".MAIN_DB_PREFIX."societe_commerciaux as sc";
}
$sql.= " WHERE f.fk_soc = s.rowid AND pf.fk_facture = f.rowid AND pf.fk_paiement = p.rowid";
$sql.= " AND p.fk_bank = b.rowid AND b.fk_account = ba.rowid ";
if (! empty($conf->banque->enabled))
$sql.= " AND p.fk_bank = b.rowid AND b.fk_account = ba.rowid ";
$sql.= " AND f.entity = ".$conf->entity;
$sql.= " AND p.fk_paiement = c.id ";
$sql.= " AND p.datep BETWEEN '".$this->db->idate(dol_get_first_day($year,$month))."' AND '".$this->db->idate(dol_get_last_day($year,$month))."'";

View File

@ -74,7 +74,7 @@ foreach($linkedObjectBlock as $key => $objectlink)
<td></td>
<td></td>
</tr>
-->
</table>
-->
<!-- END PHP TEMPLATE -->

View File

@ -4,7 +4,7 @@
* Copyright (C) 2005-2012 Regis Houssin <regis.houssin@capnetworks.com>
* Copyright (C) 2007 Franky Van Liedekerke <franky.van.liedekerke@telenet.be>
* Copyright (C) 2010-2014 Juanjo Menent <jmenent@2byte.es>
* Copyright (C) 2010-2014 Philippe Grand <philippe.grand@atoo-net.com>
* Copyright (C) 2010-2016 Philippe Grand <philippe.grand@atoo-net.com>
* Copyright (C) 2012-2015 Marcos García <marcosgdf@gmail.com>
* Copyright (C) 2013 Florian Henry <florian.henry@open-concept.pro>
* Copyright (C) 2013 Cédric Salvador <csalvador@gpcsolutions.fr>
@ -53,7 +53,7 @@ class CommandeFournisseur extends CommonOrder
var $id;
/**
* Supplier invoice reference
* Supplier order reference
* @var string
*/
var $ref;
@ -103,7 +103,7 @@ class CommandeFournisseur extends CommonOrder
var $user_approve_id;
var $user_approve_id2; // Used when SUPPLIER_ORDER_DOUBLE_APPROVAL is set
//Incorterms
//Incoterms
var $fk_incoterms;
var $location_incoterms;
var $libelle_incoterms; //Used into tooltip
@ -114,7 +114,7 @@ class CommandeFournisseur extends CommonOrder
* @var CommandeFournisseurLigne[]
*/
public $lines = array();
//Ajout pour supplier_proposal
//Add for supplier_proposal
var $origin;
var $origin_id;
var $linked_objects=array();
@ -260,7 +260,7 @@ class CommandeFournisseur extends CommonOrder
$this->db->free($resql);
// Retreive all extrafield
// Retrieve all extrafields
// fetch optionals attributes and labels
require_once(DOL_DOCUMENT_ROOT.'/core/class/extrafields.class.php');
$extrafields=new ExtraFields($this->db);
@ -416,7 +416,7 @@ class CommandeFournisseur extends CommonOrder
{
$this->db->begin();
// Definition du nom de modele de numerotation de commande
// Definition of supplier order numbering model name
$soc = new Societe($this->db);
$soc->fetch($this->fourn_id);
@ -461,7 +461,7 @@ class CommandeFournisseur extends CommonOrder
// Rename directory if dir was a temporary ref
if (preg_match('/^[\(]?PROV/i', $this->ref))
{
// On renomme repertoire ($this->ref = ancienne ref, $num = nouvelle ref)
// We rename directory ($this->ref = ancienne ref, $num = nouvelle ref)
// in order not to lose the attached files
$oldref = dol_sanitizeFileName($this->ref);
$newref = dol_sanitizeFileName($num);
@ -644,8 +644,8 @@ class CommandeFournisseur extends CommonOrder
/**
* Renvoie la reference de commande suivante non utilisee en fonction du modele
* de numerotation actif defini dans COMMANDE_SUPPLIER_ADDON_NUMBER
* Returns the following order reference not used depending on the numbering model activated
* defined within COMMANDE_SUPPLIER_ADDON_NUMBER
*
* @param Societe $soc objet societe
* @return string reference libre pour la facture

View File

@ -527,7 +527,7 @@ if (empty($action))
$paramlist.=($search_payment_num?"&search_payment_num=".urlencode($search_payment_num):"");
if ($optioncss != '') $paramlist.='&optioncss='.urlencode($optioncss);
print_barre_liste($langs->trans('SupplierPayments'), $page, $_SERVER["PHP_SELF"],$paramlist,$sortfield,$sortorder,'',$num);
print_barre_liste($langs->trans('SupplierPayments'), $page, $_SERVER["PHP_SELF"],$paramlist,$sortfield,$sortorder,'',$num, 0, 'title_accountancy.png');
print '<form method="GET" action="'.$_SERVER["PHP_SELF"].'">';
if ($optioncss != '') print '<input type="hidden" name="optioncss" value="'.$optioncss.'">';

View File

@ -26,6 +26,16 @@
ALTER TABLE llx_don ADD COLUMN fk_country integer NOT NULL DEFAULT 0 after country;
ALTER TABLE llx_product ADD COLUMN localtax1_type varchar(10) NOT NULL DEFAULT '0' after localtax1_tx;
ALTER TABLE llx_product ADD COLUMN localtax2_type varchar(10) NOT NULL DEFAULT '0' after localtax2_tx;
ALTER TABLE llx_product_price ADD COLUMN localtax1_type varchar(10) NOT NULL DEFAULT '0' after localtax1_tx;
ALTER TABLE llx_product_price ADD COLUMN localtax2_type varchar(10) NOT NULL DEFAULT '0' after localtax2_tx;
ALTER TABLE llx_product_customer_price ADD COLUMN localtax1_type varchar(10) NOT NULL DEFAULT '0' after localtax1_tx;
ALTER TABLE llx_product_customer_price ADD COLUMN localtax2_type varchar(10) NOT NULL DEFAULT '0' after localtax2_tx;
ALTER TABLE llx_product_customer_price_log ADD COLUMN localtax1_type varchar(10) NOT NULL DEFAULT '0' after localtax1_tx;
ALTER TABLE llx_product_customer_price_log ADD COLUMN localtax2_type varchar(10) NOT NULL DEFAULT '0' after localtax2_tx;
UPDATE llx_user set api_key = null where api_key = '';

View File

@ -46,8 +46,10 @@ create table llx_product
cost_price double(24,8) DEFAULT NULL, -- Cost price without tax. Can be used for margin calculation.
tva_tx double(6,3), -- Default VAT rate of product
recuperableonly integer NOT NULL DEFAULT '0', -- French NPR VAT
localtax1_tx double(6,3) DEFAULT 0, -- Spanish local VAT 1
localtax2_tx double(6,3) DEFAULT 0, -- Spanish local VAT 2
localtax1_tx double(6,3) DEFAULT 0, --
localtax1_type varchar(10) NOT NULL DEFAULT '0', --
localtax2_tx double(6,3) DEFAULT 0, --
localtax2_type varchar(10) NOT NULL DEFAULT '0', --
fk_user_author integer DEFAULT NULL, -- user making creation
fk_user_modif integer, -- user making last change
tosell tinyint DEFAULT 1, -- Product you sell

View File

@ -36,7 +36,9 @@ create table llx_product_customer_price
tva_tx double(6,3),
recuperableonly integer NOT NULL DEFAULT '0', -- Other NPR VAT
localtax1_tx double(6,3) DEFAULT 0, -- Other local VAT 1
localtax1_type varchar(10) NOT NULL DEFAULT '0',
localtax2_tx double(6,3) DEFAULT 0, -- Other local VAT 2
localtax2_type varchar(10) NOT NULL DEFAULT '0',
fk_user integer,
import_key varchar(14) -- Import key
)ENGINE=innodb;

View File

@ -21,7 +21,7 @@
create table llx_product_customer_price_log
(
rowid integer AUTO_INCREMENT PRIMARY KEY,
entity integer DEFAULT 1 NOT NULL, -- multi company id
entity integer DEFAULT 1 NOT NULL, -- multi company id
datec datetime,
fk_product integer NOT NULL,
fk_soc integer NOT NULL,
@ -33,7 +33,9 @@ create table llx_product_customer_price_log
tva_tx double(6,3),
recuperableonly integer NOT NULL DEFAULT '0', -- Other NPR VAT
localtax1_tx double(6,3) DEFAULT 0, -- Other local VAT 1
localtax1_type varchar(10) NOT NULL DEFAULT '0',
localtax2_tx double(6,3) DEFAULT 0, -- Other local VAT 2
localtax2_type varchar(10) NOT NULL DEFAULT '0',
fk_user integer,
import_key varchar(14) -- Import key
)ENGINE=innodb;

View File

@ -34,7 +34,9 @@ create table llx_product_price
tva_tx double(6,3) NOT NULL,
recuperableonly integer NOT NULL DEFAULT '0',
localtax1_tx double(6,3) DEFAULT 0,
localtax1_type varchar(10) NOT NULL DEFAULT '0',
localtax2_tx double(6,3) DEFAULT 0,
localtax2_type varchar(10) NOT NULL DEFAULT '0',
fk_user_author integer,
tosell tinyint DEFAULT 1,
price_by_qty integer NOT NULL DEFAULT 0,

View File

@ -47,7 +47,7 @@ UpdateAccount=Modification of an accounting account
UpdateMvts=Modification of a movement
WriteBookKeeping=Record accounts in general ledger
Bookkeeping=General ledger
AccountBalanceByMonth=Account balance by month
AccountBalance=Account balance
AccountingVentilation=Breakdown accounting
AccountingVentilationSupplier=Breakdown accounting supplier

View File

@ -1666,7 +1666,7 @@ BackupDumpWizard=Wizard to build database backup dump file
SomethingMakeInstallFromWebNotPossible=Installation of external module is not possible from the web interface for the following reason:
SomethingMakeInstallFromWebNotPossible2=For this reason, process to upgrade described here is only manual steps a privileged user can do.
InstallModuleFromWebHasBeenDisabledByFile=Install of external module from application has been disabled by your administrator. You must ask him to remove the file <strong>%s</strong> to allow this feature.
ConfFileMuseContainCustom=Installing an external module from application save the module files into directory <strong>%s</strong>. To have this directory processed by Dolibarr, you must setup your <strong>conf/conf.php</strong> to have option<br>- <strong>$dolibarr_main_url_root_alt</strong> enabled to value <strong>$dolibarr_main_url_root_alt="/custom"</strong><br>- <strong>$dolibarr_main_document_root_alt</strong> enabled to value <strong>"%s/custom"</strong>
ConfFileMuseContainCustom=Installing an external module from application save the module files into directory <strong>%s</strong>. To have this directory processed by Dolibarr, you must setup your <strong>conf/conf.php</strong> to have option<br><strong>$dolibarr_main_url_root_alt='/custom';</strong><br><strong>$dolibarr_main_document_root_alt='%s/custom';</strong>
HighlightLinesOnMouseHover=Highlight table lines when mouse move passes over
HighlightLinesColor=Highlight color of the line when the mouse passes over (keep empty for no highlight)
TextTitleColor=Color of page title

View File

@ -545,6 +545,7 @@ NbOfCustomers=Number of customers
NbOfLines=Number of lines
NbOfObjects=Number of objects
NbOfReferers=Number of referrers
NbOfObjectReferers=Number of refering objects
Referers=Refering objects
TotalQuantity=Total quantity
DateFromTo=From %s to %s

View File

@ -317,3 +317,4 @@ DefaultPriceRealPriceMayDependOnCustomer=Default price, real price may depend on
WarningSelectOneDocument=Please select at least one document
DefaultUnitToShow=Unit
NbOfQtyInProposals=Qty in proposals
ClinkOnALinkOfColumn=Click on a link of column %s to get a detailed view...

View File

@ -34,7 +34,8 @@ LastMovements=Last movements
Units=Units
Unit=Unit
StockCorrection=Correct stock
StockTransfer=Stock movement
StockTransfer=Transfer stock
MassStockTransferShort=Mass stock transfer
StockMovement=Stock movement
StockMovements=Stock movements
LabelMovement=Movement label

View File

@ -101,10 +101,12 @@ class Product extends CommonObject
var $tva_tx;
//! French VAT NPR (0 or 1)
var $tva_npr=0;
//! Spanish local taxes
//! Other local taxes
var $localtax1_tx;
var $localtax2_tx;
var $localtax1_type;
var $localtax2_type;
//! Stock
var $stock_reel;
//! Cost price
@ -296,7 +298,9 @@ class Product extends CommonObject
//Local taxes
if (empty($this->localtax1_tx)) $this->localtax1_tx = 0;
if (empty($this->localtax2_tx)) $this->localtax2_tx = 0;
if (empty($this->localtax1_type)) $this->localtax1_type = '0';
if (empty($this->localtax2_type)) $this->localtax2_type = '0';
if (empty($this->price)) $this->price = 0;
if (empty($this->price_min)) $this->price_min = 0;
@ -633,6 +637,8 @@ class Product extends CommonObject
if (empty($this->tva_npr)) $this->tva_npr = 0;
if (empty($this->localtax1_tx)) $this->localtax1_tx = 0;
if (empty($this->localtax2_tx)) $this->localtax2_tx = 0;
if (empty($this->localtax1_type)) $this->localtax1_type = '0';
if (empty($this->localtax2_type)) $this->localtax2_type = '0';
if (empty($this->status)) $this->status = 0;
if (empty($this->status_buy)) $this->status_buy = 0;
@ -700,7 +706,9 @@ class Product extends CommonObject
$sql.= ", recuperableonly = " . $this->tva_npr;
$sql.= ", localtax1_tx = " . $this->localtax1_tx;
$sql.= ", localtax2_tx = " . $this->localtax2_tx;
$sql.= ", localtax1_type = " . ($this->localtax1_type!=''?"'".$this->localtax1_type."'":"'0'");
$sql.= ", localtax2_type = " . ($this->localtax2_type!=''?"'".$this->localtax2_type."'":"'0'");
$sql.= ", barcode = ". (empty($this->barcode)?"null":"'".$this->db->escape($this->barcode)."'");
$sql.= ", fk_barcode_type = ". (empty($this->barcode_type)?"null":$this->db->escape($this->barcode_type));
@ -1218,10 +1226,10 @@ class Product extends CommonObject
if (empty($this->price_by_qty)) $this->price_by_qty=0;
// Add new price
$sql = "INSERT INTO ".MAIN_DB_PREFIX."product_price(price_level,date_price,fk_product,fk_user_author,price,price_ttc,price_base_type,tosell,tva_tx,recuperableonly,";
$sql.= " localtax1_tx, localtax2_tx, price_min,price_min_ttc,price_by_qty,entity,fk_price_expression) ";
$sql = "INSERT INTO ".MAIN_DB_PREFIX."product_price(price_level,date_price,fk_product,fk_user_author,price,price_ttc,price_base_type,tosell, tva_tx, recuperableonly,";
$sql.= " localtax1_tx, localtax2_tx, localtax1_type, localtax2_type, price_min,price_min_ttc,price_by_qty,entity,fk_price_expression) ";
$sql.= " VALUES(".($level?$level:1).", '".$this->db->idate($now)."',".$this->id.",".$user->id.",".$this->price.",".$this->price_ttc.",'".$this->price_base_type."',".$this->status.",".$this->tva_tx.",".$this->tva_npr.",";
$sql.= " ".$this->localtax1_tx.",".$this->localtax2_tx.",".$this->price_min.",".$this->price_min_ttc.",".$this->price_by_qty.",".$conf->entity.",".($this->fk_price_expression > 0?$this->fk_price_expression:'null');
$sql.= " ".$this->localtax1_tx.", ".$this->localtax2_tx.", '".$this->localtax1_type."', '".$this->localtax2_type."', ".$this->price_min.",".$this->price_min_ttc.",".$this->price_by_qty.",".$conf->entity.",".($this->fk_price_expression > 0?$this->fk_price_expression:'null');
$sql.= ")";
dol_syslog(get_class($this)."::_log_price", LOG_DEBUG);
@ -1386,15 +1394,16 @@ class Product extends CommonObject
* @param double $newprice New price
* @param string $newpricebase HT or TTC
* @param User $user Object user that make change
* @param double $newvat New VAT Rate
* @param double $newvat New VAT Rate (For example 8.5. Should not be a string)
* @param double $newminprice New price min
* @param int $level 0=standard, >0 = level if multilevel prices
* @param int $newnpr 0=Standard vat rate, 1=Special vat rate for French NPR VAT
* @param int $newpsq 1 if it has price by quantity
* @param int $ignore_autogen Used to avoid infinite loops
* @return int <0 if KO, >0 if OK
* @param array $localtaxes_array Array with localtaxes info array('0'=>type1,'1'=>rate1,'2'=>type2,'3'=>rate2) (loaded by getLocalTaxesFromRate(vatrate, 0, ...) function).
* @return int <0 if KO, >0 if OK
*/
function updatePrice($newprice, $newpricebase, $user, $newvat='',$newminprice='', $level=0, $newnpr=0, $newpsq=0, $ignore_autogen=0)
function updatePrice($newprice, $newpricebase, $user, $newvat='',$newminprice='', $level=0, $newnpr=0, $newpsq=0, $ignore_autogen=0, $localtaxes_array=array())
{
global $conf,$langs;
@ -1463,13 +1472,23 @@ class Product extends CommonObject
}
//print 'x'.$id.'-'.$newprice.'-'.$newpricebase.'-'.$price.'-'.$price_ttc.'-'.$price_min.'-'.$price_min_ttc;
//Local taxes
$localtax1=get_localtax($newvat,1);
$localtax2=get_localtax($newvat,2);
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();
// Ne pas mettre de quote sur les numeriques decimaux.
@ -1482,6 +1501,8 @@ class Product extends CommonObject
$sql.= " price_min_ttc=".$price_min_ttc.",";
$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.= " tva_tx='".price2num($newvat)."',";
$sql.= " recuperableonly='".$newnpr."'";
$sql.= " WHERE rowid = ".$id;
@ -1508,7 +1529,9 @@ class Product extends CommonObject
//Local taxes
$this->localtax1_tx = $localtax1;
$this->localtax2_tx = $localtax2;
$this->localtax1_type = $localtaxtype1;
$this->localtax2_type = $localtaxtype2;
// Price by quantity
$this->price_by_qty = $newpsq;
@ -1579,12 +1602,12 @@ class Product extends CommonObject
}
$sql = "SELECT rowid, ref, ref_ext, label, description, url, note, customcode, fk_country, price, price_ttc,";
$sql.= " price_min, price_min_ttc, price_base_type, cost_price, tva_tx, recuperableonly as tva_npr, localtax1_tx, localtax2_tx, tosell,";
$sql.= " price_min, price_min_ttc, price_base_type, cost_price, tva_tx, recuperableonly as tva_npr, localtax1_tx, localtax2_tx, localtax1_type, localtax2_type, tosell,";
$sql.= " tobuy, fk_product_type, duration, seuil_stock_alerte, canvas,";
$sql.= " weight, weight_units, length, length_units, surface, surface_units, volume, volume_units, barcode, fk_barcode_type, finished,";
$sql.= " accountancy_code_buy, accountancy_code_sell, stock, pmp,";
$sql.= " datec, tms, import_key, entity, desiredstock, tobatch, fk_unit";
$sql.= " , fk_price_expression, price_autogen";
$sql.= " datec, tms, import_key, entity, desiredstock, tobatch, fk_unit,";
$sql.= " fk_price_expression, price_autogen";
$sql.= " FROM ".MAIN_DB_PREFIX."product";
if ($id) $sql.= " WHERE rowid = ".$this->db->escape($id);
else
@ -1626,10 +1649,12 @@ class Product extends CommonObject
$this->tva_tx = $obj->tva_tx;
//! French VAT NPR
$this->tva_npr = $obj->tva_npr;
//! Spanish local taxes
//! Local taxes
$this->localtax1_tx = $obj->localtax1_tx;
$this->localtax2_tx = $obj->localtax2_tx;
$this->localtax1_type = $obj->localtax1_type;
$this->localtax2_type = $obj->localtax2_type;
$this->finished = $obj->finished;
$this->duration = $obj->duration;
$this->duration_value = substr($obj->duration,0,dol_strlen($obj->duration)-1);

View File

@ -42,7 +42,9 @@ class Productcustomerprice extends CommonObject
var $price_base_type;
var $tva_tx;
var $recuperableonly;
var $localtax1_type;
var $localtax1_tx;
var $localtax2_type;
var $localtax2_tx;
var $fk_user;
var $lines = array ();
@ -150,7 +152,9 @@ class Productcustomerprice extends CommonObject
$sql .= "price_base_type,";
$sql .= "tva_tx,";
$sql .= "recuperableonly,";
$sql .= "localtax1_type,";
$sql .= "localtax1_tx,";
$sql .= "localtax2_type,";
$sql .= "localtax2_tx,";
$sql .= "fk_user,";
$sql .= "import_key";
@ -168,7 +172,9 @@ class Productcustomerprice extends CommonObject
$sql .= " " . (! isset($this->price_base_type) ? 'NULL' : "'" . $this->db->escape($this->price_base_type) . "'") . ",";
$sql .= " " . (! isset($this->tva_tx) ? 'NULL' : "'" . $this->tva_tx . "'") . ",";
$sql .= " " . (! isset($this->recuperableonly) ? 'NULL' : "'" . $this->recuperableonly . "'") . ",";
$sql .= " " . (empty($this->localtax1_type) ? "'0'" : "'" . $this->localtax1_type . "'") . ",";
$sql .= " " . (! isset($this->localtax1_tx) ? 'NULL' : "'" . $this->localtax1_tx . "'") . ",";
$sql .= " " . (empty($this->localtax2_type) ? "'0'" : "'" . $this->localtax2_type . "'") . ",";
$sql .= " " . (! isset($this->localtax2_tx) ? 'NULL' : "'" . $this->localtax2_tx . "'") . ",";
$sql .= " " . $user->id . ",";
$sql .= " " . (! isset($this->import_key) ? 'NULL' : "'" . $this->db->escape($this->import_key) . "'") . "";
@ -593,6 +599,8 @@ class Productcustomerprice extends CommonObject
$sql .= "recuperableonly,";
$sql .= "localtax1_tx,";
$sql .= "localtax2_tx,";
$sql .= "localtax1_type,";
$sql .= "localtax2_type,";
$sql .= "fk_user,";
$sql .= "import_key";
@ -612,6 +620,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";
@ -643,6 +653,8 @@ class Productcustomerprice extends CommonObject
$sql .= " recuperableonly=" . (isset($this->recuperableonly) ? $this->recuperableonly : "null") . ",";
$sql .= " localtax1_tx=" . (isset($this->localtax1_tx) ? $this->localtax1_tx : "null") . ",";
$sql .= " localtax2_tx=" . (isset($this->localtax2_tx) ? $this->localtax2_tx : "null") . ",";
$sql .= " localtax1_type=" . (! empty($this->localtax1_type) ? "'".$this->localtax1_type."'": "'0'") . ",";
$sql .= " localtax2_type=" . (! empty($this->localtax2_type) ? "'".$this->localtax2_type."'": "'0'") . ",";
$sql .= " fk_user=" . $user->id . ",";
$sql .= " import_key=" . (isset($this->import_key) ? "'" . $this->db->escape($this->import_key) . "'" : "null") . "";

View File

@ -94,7 +94,43 @@ if (empty($reshook))
if (($action == 'update_vat') && !$cancel && ($user->rights->produit->creer || $user->rights->service->creer))
{
$object->tva_tx = GETPOST('tva_tx');
$tva_tx_txt = GETPOST('tva_tx', 'alpha'); // tva_tx can be '8.5' or '8.5*' or '8.5
$tva_tx_txt;
// 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
$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
if (preg_match('/\((.*)\)/', $tva_tx_txt, $reg))
{
// We look into database using code
$vatratecode=$reg[1];
// Get record from code
$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.code ='".$vatratecode."'";
$resql=$db->query($sql);
if ($resql)
{
$obj = $db->fetch_object($resql);
$npr = $obj->recuperableonly;
$localtax1 = $obj->localtax1;
$localtax2 = $obj->localtax2;
$localtax1_type = $obj->localtax1_type;
$localtax2_type = $obj->localtax2_type;
}
}
$object->tva_tx = $tva_tx;
$object->tva_npr = $npr;
$object->localtax1_tx = $localtax1;
$object->localtax2_tx = $localtax2;
$object->localtax1_type = $localtax1_type;
$object->localtax2_type = $localtax2_type;
$db->begin();
@ -106,7 +142,7 @@ if (empty($reshook))
if ($error)
{
$object->updatePrice($newprice, $newpricebase, $user, $newvat, $newprice_min, $level, $newnpr, $newpsq);
$object->updatePrice($newprice, $newpricebase, $user, $newvat, $newprice_min, $level, $newnpr, $newpsq); // FIXME Bug $newvat and $newnpr not defined
}
if (! $error)
@ -145,31 +181,41 @@ if (empty($reshook))
}
// Multiprices
if (!$error && !empty($conf->global->PRODUIT_MULTIPRICES)) {
if (! $error && ! empty($conf->global->PRODUIT_MULTIPRICES)) {
$newprice = GETPOST('price', 'array');
$newprice_min = GETPOST('price_min', 'array');
$newpricebase = GETPOST('multiprices_base_type', 'array');
$newvattx = GETPOST('tva_tx', 'array');
$newvatnpr = GETPOST('tva_npr', 'array');
$newlocaltax1_tx = GETPOST('localtax1_tx', 'array');
$newlocaltax1_type = GETPOST('localtax1_type', 'array');
$newlocaltax2_tx = GETPOST('localtax2_tx', 'array');
$newlocaltax2_type = GETPOST('localtax2_type', 'array');
//Shall we generate prices using price rules?
$object->price_autogen = GETPOST('usePriceRules') == 'on' ? true : false;
for ($i = 1; $i <= $conf->global->PRODUIT_MULTIPRICES_LIMIT; $i ++) {
for ($i = 1; $i <= $conf->global->PRODUIT_MULTIPRICES_LIMIT; $i ++)
{
if (!isset($newprice[$i])) {
continue;
}
$newnpr = (preg_match('/\*/', $newvattx[$i] ? 1 : 0));
$newvat = str_replace('*', '', $newvattx[$i]);
$tva_tx_txt = $newvattx[$i];
$npr = $newvatnpr[$i];
$localtax1 = $newlocaltax1_tx[$i];
$localtax1_type = $newlocaltax1_type[$i];
$localtax2 = $newlocaltax2_tx[$i];
$localtax2_type = $newlocaltax2_type[$i];
$pricestoupdate[$i] = array(
'price' => $newprice[$i],
'price_min' => $newprice_min[$i],
'price_base_type' => $newpricebase[$i],
'vat_tx' => $newvat,
'npr' => $newnpr
'vat_tx' => $tva_tx,
'npr' => $npr,
'localtaxes_array' => array('0'=>$localtax1_type, '1'=>$localtax1, '2'=>$localtax2_type, '3'=>$localtax2)
);
//If autogeneration is enabled, then we only set the first level
@ -178,12 +224,41 @@ if (empty($reshook))
}
}
} else {
$tva_tx_txt = GETPOST('tva_tx', 'alpha'); // tva_tx can be '8.5' , '8.5*', '8.5 (8.5NPR) *' for example.
// 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
$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
if (preg_match('/\((.*)\)/', $tva_tx_txt, $reg))
{
// We look into database using code
$vatratecode=$reg[1];
// Get record from code
$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.code ='".$vatratecode."'";
$resql=$db->query($sql);
if ($resql)
{
$obj = $db->fetch_object($resql);
$npr = $obj->recuperableonly;
$localtax1 = $obj->localtax1;
$localtax2 = $obj->localtax2;
$localtax1_type = $obj->localtax1_type;
$localtax2_type = $obj->localtax2_type;
}
}
$pricestoupdate[0] = array(
'price' => $_POST ["price"],
'price_min' => $_POST ["price_min"],
'price_base_type' => $_POST ["price_base_type"],
'vat_tx' => str_replace('*', '', $_POST ["tva_tx"]),
'npr' => preg_match('/\*/', $_POST ["tva_tx"]) ? 1 : 0
'price' => $_POST["price"],
'price_min' => $_POST["price_min"],
'price_base_type' => $_POST["price_base_type"],
'vat_tx' => $tva_tx,
'npr' => $npr,
'localtaxes_array' => array('0'=>$localtax1_type, '1'=>$localtax1, '2'=>$localtax2_type, '3'=>$localtax2)
);
}
@ -207,7 +282,7 @@ if (empty($reshook))
break;
}
$res = $object->updatePrice($newprice, $val['price_base_type'], $user, $val['vat_tx'], $newprice_min, $key, $val['npr'], $psq);
$res = $object->updatePrice($newprice, $val['price_base_type'], $user, $val['vat_tx'], $newprice_min, $key, $val['npr'], $psq, 0, $val['localtaxes_array']);
if ($res < 0) {
$error ++;
@ -344,9 +419,43 @@ if (empty($reshook))
$prodcustprice->price = price2num(GETPOST("price"), 'MU');
$prodcustprice->price_min = price2num(GETPOST("price_min"), 'MU');
$prodcustprice->price_base_type = GETPOST("price_base_type", 'alpha');
$prodcustprice->tva_tx = str_replace('*', '', GETPOST("tva_tx"));
$prodcustprice->recuperableonly = (preg_match('/\*/', GETPOST("tva_tx")) ? 1 : 0);
$tva_tx_txt = GETPOST("tva_tx");
// 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
$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
if (preg_match('/\((.*)\)/', $tva_tx_txt, $reg))
{
// We look into database using code
$vatratecode=$reg[1];
// Get record from code
$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.code ='".$vatratecode."'";
$resql=$db->query($sql);
if ($resql)
{
$obj = $db->fetch_object($resql);
$npr = $obj->recuperableonly;
$localtax1 = $obj->localtax1;
$localtax2 = $obj->localtax2;
$localtax1_type = $obj->localtax1_type;
$localtax2_type = $obj->localtax2_type;
}
}
$prodcustprice->tva_tx = $tva_tx;
$prodcustprice->recuperableonly = $npr;
$prodcustprice->localtax1_tx = $localtax1;
$prodcustprice->localtax2_tx = $localtax2;
$prodcustprice->localtax1_type = $localtax1_type;
$prodcustprice->localtax2_type = $localtax2_type;
if (! ($prodcustprice->fk_soc > 0))
{
$langs->load("errors");
@ -383,9 +492,9 @@ if (empty($reshook))
$result = $prodcustprice->delete($user);
if ($result < 0) {
setEventMessages($prodcustprice->error, $prodcustprice->errors, 'mesgs');
setEventMessages($prodcustprice->error, $prodcustprice->errors, 'errors');
} else {
setEventMessages($langs->trans('RecordDeleted'), null, 'errors');
setEventMessages($langs->trans('RecordDeleted'), null, 'mesgs');
}
$action = '';
}
@ -402,9 +511,43 @@ if (empty($reshook))
$prodcustprice->price = price2num(GETPOST("price"), 'MU');
$prodcustprice->price_min = price2num(GETPOST("price_min"), 'MU');
$prodcustprice->price_base_type = GETPOST("price_base_type", 'alpha');
$prodcustprice->tva_tx = str_replace('*', '', GETPOST("tva_tx"));
$prodcustprice->recuperableonly = (preg_match('/\*/', GETPOST("tva_tx")) ? 1 : 0);
$tva_tx_txt = GETPOST("tva_tx");
// 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
$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
if (preg_match('/\((.*)\)/', $tva_tx_txt, $reg))
{
// We look into database using code
$vatratecode=$reg[1];
// Get record from code
$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.code ='".$vatratecode."'";
$resql=$db->query($sql);
if ($resql)
{
$obj = $db->fetch_object($resql);
$npr = $obj->recuperableonly;
$localtax1 = $obj->localtax1;
$localtax2 = $obj->localtax2;
$localtax1_type = $obj->localtax1_type;
$localtax2_type = $obj->localtax2_type;
}
}
$prodcustprice->tva_tx = $tva_tx;
$prodcustprice->recuperableonly = $npr;
$prodcustprice->localtax1_tx = $localtax1;
$prodcustprice->localtax2_tx = $localtax2;
$prodcustprice->localtax1_type = $localtax1_type;
$prodcustprice->localtax2_type = $localtax2_type;
if ($prodcustprice->price_min<$maxpricesupplier && !empty($conf->global->PRODUCT_MINIMUM_RECOMMENDED_PRICE))
{
setEventMessages($langs->trans("MinimumPriceLimit",price($maxpricesupplier,0,'',1,-1,-1,'auto')), null, 'errors');
@ -792,7 +935,7 @@ if ($action == 'edit_vat' && ($user->rights->produit->creer || $user->rights->se
// VAT
print '<tr><td>' . $langs->trans("VATRate") . '</td><td>';
print $form->load_tva("tva_tx", $object->tva_tx, $mysoc, '', $object->id, $object->tva_npr);
print $form->load_tva("tva_tx", $object->tva_tx, $mysoc, '', $object->id, $object->tva_npr, $object->type, false, 1);
print '</td></tr>';
print '</table>';
@ -825,7 +968,7 @@ if ($action == 'edit_price' && $object->getRights()->creer)
// VAT
print '<tr><td>' . $langs->trans("VATRate") . '</td><td colspan="2">';
print $form->load_tva("tva_tx", $object->tva_tx, $mysoc, '', $object->id, $object->tva_npr);
print $form->load_tva("tva_tx", $object->tva_tx, $mysoc, '', $object->id, $object->tva_npr, $object->type, false, 1);
print '</td></tr>';
// Price base
@ -981,11 +1124,16 @@ if ($action == 'edit_price' && $object->getRights()->creer)
// VAT
if (empty($conf->global->PRODUIT_MULTIPRICES_USE_VAT_PER_LEVEL)) {
print '<input type="hidden" name="tva_tx[' . $i . ']" value="' . $object->tva_tx . '">';
print '<input type="hidden" name="tva_tx[' . $i . ']" value="' . $object->tva_tx . '">';
print '<input type="hidden" name="tva_npr[' . $i . ']" value="' . $object->tva_npr . '">';
print '<input type="hidden" name="localtax1_tx[' . $i . ']" value="' . $object->localtax1_tx . '">';
print '<input type="hidden" name="localtax1_type[' . $i . ']" value="' . $object->localtax1_type . '">';
print '<input type="hidden" name="localtax2_tx[' . $i . ']" value="' . $object->localtax2_tx . '">';
print '<input type="hidden" name="localtax2_type[' . $i . ']" value="' . $object->localtax2_type . '">';
} else {
// This option is kept for backward compatibility but has no sense
print '<td style="text-align: center">';
print $form->load_tva("tva_tx[" . $i.']', $object->multiprices_tva_tx[$i], $mysoc, '', $object->id);
print $form->load_tva("tva_tx[" . $i.']', $object->multiprices_tva_tx[$i], $mysoc, '', $object->id, false, $object->type, false, 1);
print '</td>';
}
@ -1205,7 +1353,7 @@ if (! empty($conf->global->PRODUIT_CUSTOMER_PRICES))
// VAT
print '<tr><td class="fieldrequired">' . $langs->trans("VATRate") . '</td><td>';
print $form->load_tva("tva_tx", $object->tva_tx, $mysoc, '', $object->id, $object->tva_npr);
print $form->load_tva("tva_tx", $object->tva_tx, $mysoc, '', $object->id, $object->tva_npr, $object->type, false, 1);
print '</td></tr>';
// Price base
@ -1289,7 +1437,7 @@ if (! empty($conf->global->PRODUIT_CUSTOMER_PRICES))
// VAT
print '<tr><td>' . $langs->trans("VATRate") . '</td><td colspan="2">';
print $form->load_tva("tva_tx", $prodcustprice->tva_tx, $mysoc, '', $object->id, $prodcustprice->recuperableonly);
print $form->load_tva("tva_tx", $prodcustprice->tva_tx, $mysoc, '', $object->id, $prodcustprice->recuperableonly, $object->type, false, 1);
print '</td></tr>';
// Price base

View File

@ -1,6 +1,6 @@
<?php
/* Copyright (C) 2003-2007 Rodolphe Quiedeville <rodolphe@quiedeville.org>
* Copyright (C) 2004-2010 Laurent Destailleur <eldy@users.sourceforge.net>
* Copyright (C) 2004-2016 Laurent Destailleur <eldy@users.sourceforge.net>
* Copyright (C) 2005-2012 Regis Houssin <regis.houssin@capnetworks.com>
* Copyright (C) 2014 Juanjo Menent <jmenent@2byte.es>
* Copyright (C) 2014 Florian Henry <florian.henry@open-concept.pro>
@ -48,7 +48,7 @@ $result=restrictedArea($user,'produit|service',$fieldvalue,'product&product','',
// Initialize technical object to manage hooks of thirdparties. Note that conf->hooks_modules contains array array
$hookmanager->initHooks(array('productstatsinvoice'));
$mesg = '';
$showmessage=GETPOST('showmessage');
$sortfield = GETPOST("sortfield",'alpha');
$sortorder = GETPOST("sortorder",'alpha');
@ -67,6 +67,8 @@ if (GETPOST("button_removefilter_x") || GETPOST("button_removefilter")) {
$search_year='';
}
/*
* View
*/
@ -107,7 +109,7 @@ if ($id > 0 || ! empty($ref))
print '<div class="underbanner clearboth"></div>';
print '<table class="border tableforfield" width="100%">';
show_stats_for_company($product,$socid);
$nboflines = show_stats_for_company($product,$socid);
print "</table>";
@ -116,8 +118,11 @@ if ($id > 0 || ! empty($ref))
dol_fiche_end();
if ($user->rights->facture->lire)
if ($showmessage && $nboflines > 1)
{
print $langs->trans("ClinkOnALinkOfColumn", $langs->transnoentitiesnoconv("Referers"));
}
elseif ($user->rights->facture->lire)
{
$sql = "SELECT DISTINCT s.nom as name, s.rowid as socid, s.code_client,";
$sql.= " f.facnumber, f.datef, f.paye, f.fk_statut as statut, f.rowid as facid,";

View File

@ -325,7 +325,7 @@ $title = $langs->trans('MassMovement');
llxHeader('', $title);
print load_fiche_titre($langs->trans("MassStockMovement"));
print load_fiche_titre($langs->trans("MassStockTransferShort"));
$titletoadd=$langs->trans("Select");
$titletoaddnoent=$langs->transnoentitiesnoconv("Select");

View File

@ -54,16 +54,18 @@ $search_warehouse = trim(GETPOST("search_warehouse"));
$search_inventorycode = trim(GETPOST("search_inventorycode"));
$search_user = trim(GETPOST("search_user"));
$search_batch = trim(GETPOST("search_batch"));
$limit = GETPOST('limit')?GETPOST('limit','int'):$conf->liste_limit;
$page = GETPOST("page",'int');
$sortfield = GETPOST("sortfield",'alpha');
$sortorder = GETPOST("sortorder",'alpha');
if ($page < 0) $page = 0;
$offset = $limit * $page;
if (! $sortfield) $sortfield="m.datem";
if (! $sortorder) $sortorder="DESC";
$pdluoid=GETPOST('pdluoid','int');
if (GETPOST("button_removefilter_x") || GETPOST("button_removefilter")) // Both test are required to be compatible with all browsers
{
$year='';
@ -152,6 +154,171 @@ if ($action == "correct_stock")
if (! $error) $action='';
}
// Transfer stock from a warehouse to another warehouse
if ($action == "transfert_stock" && ! $cancel)
{
$product = new Product($db);
if (! empty($product_id)) $result=$product->fetch($product_id);
if (! (GETPOST("id_entrepot_destination",'int') > 0))
{
setEventMessages($langs->trans("ErrorFieldRequired", $langs->transnoentitiesnoconv("Warehouse")), null, 'errors');
$error++;
$action='transfert';
}
if (empty($product_id))
{
$error++;
setEventMessages($langs->trans("ErrorFieldRequired", $langs->transnoentitiesnoconv("Product")), null, 'errors');
$action='transfert';
}
if (! GETPOST("nbpiece",'int'))
{
setEventMessages($langs->trans("ErrorFieldRequired", $langs->transnoentitiesnoconv("NumberOfUnit")), null, 'errors');
$error++;
$action='transfert';
}
if ($id == GETPOST("id_entrepot_destination",'int'))
{
setEventMessages($langs->trans("ErrorSrcAndTargetWarehouseMustDiffers"), null, 'errors');
$error++;
$action='transfert';
}
if (! empty($conf->productbatch->enabled))
{
$product = new Product($db);
$result=$product->fetch($product_id);
if ($product->hasbatch() && ! GETPOST("batch_number"))
{
setEventMessages($langs->trans("ErrorFieldRequired", $langs->transnoentitiesnoconv("batch_number")), null, 'errors');
$error++;
$action='transfert';
}
}
if (! $error)
{
if ($id)
{
$object = new Entrepot($db);
$result=$object->fetch($id);
$db->begin();
$product->load_stock(); // Load array product->stock_warehouse
// Define value of products moved
$pricesrc=0;
//if (isset($product->stock_warehouse[GETPOST("id_entrepot_source")]->pmp)) $pricesrc=$product->stock_warehouse[GETPOST("id_entrepot_source")]->pmp;
if (isset($product->pmp)) $pricesrc=$product->pmp;
$pricedest=$pricesrc;
if ($product->hasbatch())
{
$pdluo = new Productbatch($db);
if ($pdluoid > 0)
{
$result=$pdluo->fetch($pdluoid);
if ($result)
{
$srcwarehouseid=$pdluo->warehouseid;
$batch=$pdluo->batch;
$eatby=$pdluo->eatby;
$sellby=$pdluo->sellby;
}
else
{
setEventMessages($pdluo->error, $pdluo->errors, 'errors');
$error++;
}
}
else
{
$srcwarehouseid=$id;
$batch=GETPOST('batch_number');
$eatby=$d_eatby;
$sellby=$d_sellby;
}
if (! $error)
{
// Remove stock
$result1=$product->correct_stock_batch(
$user,
$srcwarehouseid,
GETPOST("nbpiece",'int'),
1,
GETPOST("label",'san_alpha'),
$pricesrc,
$eatby,$sellby,$batch,
GETPOST('inventorycode')
);
// Add stock
$result2=$product->correct_stock_batch(
$user,
GETPOST("id_entrepot_destination",'int'),
GETPOST("nbpiece",'int'),
0,
GETPOST("label",'san_alpha'),
$pricedest,
$eatby,$sellby,$batch,
GETPOST('inventorycode')
);
}
}
else
{
// Remove stock
$result1=$product->correct_stock(
$user,
$id,
GETPOST("nbpiece"),
1,
GETPOST("label"),
$pricesrc,
GETPOST('inventorycode')
);
// Add stock
$result2=$product->correct_stock(
$user,
GETPOST("id_entrepot_destination"),
GETPOST("nbpiece"),
0,
GETPOST("label"),
$pricedest,
GETPOST('inventorycode')
);
}
if (! $error && $result1 >= 0 && $result2 >= 0)
{
$db->commit();
if ($backtopage)
{
header("Location: ".$backtopage);
exit;
}
else
{
header("Location: mouvement.php?id=".$object->id);
exit;
}
}
else
{
setEventMessages($product->error, $product->errors, 'errors');
$db->rollback();
$action='transfert';
}
}
}
}
/*
* View
@ -451,7 +618,7 @@ if ($resql)
/* */
/* ************************************************************************** */
if (empty($action) && $id)
if (empty($action) && $id > 0)
{
print "<div class=\"tabsAction\">\n";
@ -460,16 +627,17 @@ if ($resql)
print '<a class="butAction" href="'.$_SERVER["PHP_SELF"].'?id='.$id.'&action=correction">'.$langs->trans("StockCorrection").'</a>';
}
/*if ($user->rights->stock->mouvement->creer)
if ($user->rights->stock->mouvement->creer)
{
print '<a class="butAction" href="'.$_SERVER["PHP_SELF"].'?id='.$id.'&action=transfert">'.$langs->trans("StockMovement").'</a>';
}*/
print '<a class="butAction" href="'.$_SERVER["PHP_SELF"].'?id='.$id.'&action=transfert">'.$langs->trans("StockTransfer").'</a>';
}
print '</div><br>';
}
$param='';
if ($id) $param.='&id='.$id;
if ($id > 0) $param.='&id='.$id;
if ($search_movement) $param.='&search_movement='.urlencode($search_movement);
if ($search_inventorycode) $param.='&search_inventorycode='.urlencode($search_inventorycode);
if ($search_product_ref) $param.='&search_product_ref='.urlencode($search_product_ref);
@ -479,11 +647,11 @@ if ($resql)
if (!empty($snom)) $param.='&snom='.urlencode($snom); // FIXME $snom is not defined
if ($search_user) $param.='&search_user='.urlencode($search_user);
if ($idproduct > 0) $param.='&idproduct='.$idproduct;
if ($id) print_barre_liste($texte, $page, $_SERVER["PHP_SELF"], $param, $sortfield, $sortorder,'',$num, $nbtotalofrecords,'');
if ($id > 0) print_barre_liste($texte, $page, $_SERVER["PHP_SELF"], $param, $sortfield, $sortorder,'',$num, $nbtotalofrecords,'');
else print_barre_liste($texte, $page, $_SERVER["PHP_SELF"], $param, $sortfield, $sortorder,'',$num, $nbtotalofrecords);
print '<form method="get" action="'.$_SERVER["PHP_SELF"].'">';
if ($id) print '<input type="hidden" name="id" value="'.$id.'">';
if ($id > 0) print '<input type="hidden" name="id" value="'.$id.'">';
print '<table class="noborder" width="100%">';
print "<tr class=\"liste_titre\">";
@ -498,7 +666,7 @@ if ($resql)
print_liste_field_titre($langs->trans("l_eatby"),$_SERVER["PHP_SELF"],'m.eatby','',$param,'align="center"',$sortfield,$sortorder);
print_liste_field_titre($langs->trans("l_sellby"),$_SERVER["PHP_SELF"],'m.sellby','',$param,'align="center"',$sortfield,$sortorder);
}
print_liste_field_titre($langs->trans("Warehouse"),$_SERVER["PHP_SELF"], "","",$param,"",$sortfield,$sortorder); // We are on a specific warehouse card, no filter on other should be possible
if (! $id > 0) print_liste_field_titre($langs->trans("Warehouse"),$_SERVER["PHP_SELF"], "","",$param,"",$sortfield,$sortorder); // We are on a specific warehouse card, no filter on other should be possible
print_liste_field_titre($langs->trans("Author"),$_SERVER["PHP_SELF"], "m.fk_user_author","",$param,"",$sortfield,$sortorder);
print_liste_field_titre($langs->trans("InventoryCodeShort"),$_SERVER["PHP_SELF"], "m.inventorycode","",$param,"",$sortfield,$sortorder);
print_liste_field_titre($langs->trans("LabelMovement"),$_SERVER["PHP_SELF"], "m.label","",$param,"",$sortfield,$sortorder);
@ -532,9 +700,12 @@ if ($resql)
print '<td></td>';
}
// Warehouse
print '<td class="liste_titre" align="left">';
print '<input class="flat" type="text" size="8" name="search_warehouse" value="'.($search_warehouse).'">';
print '</td>';
if (! $id > 0)
{
print '<td class="liste_titre" align="left">';
print '<input class="flat" type="text" size="8" name="search_warehouse" value="'.($search_warehouse).'">';
print '</td>';
}
// Author
print '<td class="liste_titre" align="left">';
print '<input class="flat" type="text" size="6" name="search_user" value="'.($search_user).'">';
@ -598,17 +769,20 @@ if ($resql)
// Batch
if (! empty($conf->productbatch->enabled))
{
print '<td align="center">'.$objp->batch.'</td>';
print '<td align="center">'. dol_print_date($objp->eatby,'day') .'</td>';
print '<td align="center">'. dol_print_date($objp->sellby,'day') .'</td>';
print '<td align="center">'.$objp->batch.'</td>';
print '<td align="center">'. dol_print_date($objp->eatby,'day') .'</td>';
print '<td align="center">'. dol_print_date($objp->sellby,'day') .'</td>';
}
// Warehouse
print '<td>';
$warehousestatic->id=$objp->entrepot_id;
$warehousestatic->libelle=$objp->stock;
$warehousestatic->lieu=$objp->lieu;
print $warehousestatic->getNomUrl(1);
print "</td>\n";
if (! $id > 0)
{
print '<td>';
$warehousestatic->id=$objp->entrepot_id;
$warehousestatic->libelle=$objp->stock;
$warehousestatic->lieu=$objp->lieu;
print $warehousestatic->getNomUrl(1);
print "</td>\n";
}
// Author
print '<td>';
$userstatic->id=$objp->fk_user_author;

View File

@ -648,7 +648,7 @@ if (empty($action) && $object->id)
//if (($user->rights->stock->mouvement->creer) && ! $object->hasbatch())
if ($user->rights->stock->mouvement->creer)
{
print '<a class="butAction" href="'.$_SERVER["PHP_SELF"].'?id='.$object->id.'&amp;action=transfert">'.$langs->trans("StockMovement").'</a>';
print '<a class="butAction" href="'.$_SERVER["PHP_SELF"].'?id='.$object->id.'&amp;action=transfert">'.$langs->trans("StockTransfer").'</a>';
}
print '</div>';
@ -753,7 +753,7 @@ if ($resql)
{
print "\n".'<tr><td align="right">';
print img_picto($langs->trans("Tranfer"),'uparrow','class="hideonsmartphone"').' ';
print '<a href="'.$_SERVER["PHP_SELF"].'?id='.$object->id.'&amp;action=transfert&amp;pdluoid='.$pdluo->id.'">'.$langs->trans("StockMovement").'</a>';
print '<a href="'.$_SERVER["PHP_SELF"].'?id='.$object->id.'&amp;action=transfert&amp;pdluoid='.$pdluo->id.'">'.$langs->trans("StockTransfer").'</a>';
// Disabled, because edition of stock content must use the "Correct stock menu".
// Do not use this, or data will be wrong (bad tracking of movement label, inventory code, ...
//print '<a href="'.$_SERVER["PHP_SELF"].'?id='.$id.'&amp;action=editline&amp;lineid='.$pdluo->id.'#'.$pdluo->id.'">';

View File

@ -372,6 +372,8 @@ $head[1][1] = $langs->trans("ReplenishmentOrders");
$head[1][2] = 'replenishorders';
print load_fiche_titre($langs->trans('Replenishment'), '', 'title_generic.png');
print '<form action="'.$_SERVER["PHP_SELF"].'" method="POST" name="formulaire">'.
'<input type="hidden" name="token" value="' .$_SESSION['newtoken'] . '">'.
@ -382,7 +384,7 @@ print '<form action="'.$_SERVER["PHP_SELF"].'" method="POST" name="formulaire">'
'<input type="hidden" name="action" value="order">'.
'<input type="hidden" name="mode" value="' . $mode . '">';
dol_fiche_head($head, 'replenish', $langs->trans('Replenishment'), 0, 'stock');
dol_fiche_head($head, 'replenish', '', 0, '');
print $langs->trans("ReplenishmentStatusDesc").'<br>'."\n";
if ($usevirtualstock == 1)

View File

@ -52,6 +52,8 @@ $texte = $langs->trans('ReplenishmentOrders');
llxHeader('', $texte, $helpurl, '');
print load_fiche_titre($langs->trans('Replenishment'), '', 'title_generic.png');
$head = array();
$head[0][0] = DOL_URL_ROOT.'/product/stock/replenish.php';
$head[0][1] = $langs->trans('Status');
@ -60,7 +62,7 @@ $head[1][0] = DOL_URL_ROOT.'/product/stock/replenishorders.php';
$head[1][1] = $texte;
$head[1][2] = 'replenishorders';
dol_fiche_head($head, 'replenishorders', $langs->trans('Replenishment'), 0, 'stock');
dol_fiche_head($head, 'replenishorders', '', 0, '');
$commandestatic = new CommandeFournisseur($db);
$sref = GETPOST('search_ref', 'alpha');

View File

@ -15,13 +15,13 @@
* along with this program. If not, see <http://www.gnu.org/licenses/>.
*
* $object must be defined
* $product can be defined
*/
?>
<!-- BEGIN PHP TEMPLATE STOCKCORRECTION.TPL.PHP -->
<?php
if (! is_object($product)) $product=$object;
$productref = '';
if ($object->element == 'product') $productref = $object->ref;
$langs->load("productbatch");
@ -81,10 +81,13 @@
print '</tr>';
// Serial / Eat-by date
if ((! empty($conf->productbatch->enabled)) && is_object($product) && $product->hasbatch())
if (! empty($conf->productbatch->enabled) &&
(($object->element == 'product' && $object->hasbatch())
|| ($object->element == 'stock'))
)
{
print '<tr>';
print '<td colspan="2" class="fieldrequired">'.$langs->trans("batch_number").'</td><td colspan="4">';
print '<td colspan="2"'.($object->element == 'stock'?'': ' class="fieldrequired"').'>'.$langs->trans("batch_number").'</td><td colspan="4">';
print '<input type="text" name="batch_number" size="40" value="'.GETPOST("batch_number").'">';
print '</td>';
print '</tr><tr>';
@ -101,7 +104,7 @@
}
// Label of mouvement of id of inventory
$valformovementlabel=((GETPOST("label") && (GETPOST('label') != $langs->trans("MovementCorrectStock",''))) ? GETPOST("label") : $langs->trans("MovementCorrectStock", $product->ref));
$valformovementlabel=((GETPOST("label") && (GETPOST('label') != $langs->trans("MovementCorrectStock",''))) ? GETPOST("label") : $langs->trans("MovementCorrectStock", $productref));
print '<tr>';
print '<td width="20%" colspan="2">'.$langs->trans("MovementLabel").'</td>';
print '<td colspan="2">';

View File

@ -14,17 +14,20 @@
* You should have received a copy of the GNU General Public License
* along with this program. If not, see <http://www.gnu.org/licenses/>.
*
* $product must be defined
* $object must be defined
* $backtopage
*/
?>
<!-- BEGIN PHP TEMPLATE STOCKCORRECTION.TPL.PHP -->
<?php
if (! is_object($product)) $product=$object;
$productref='';
if ($object->element == 'product') $productref = $object->ref;
$langs->load("productbatch");
if (empty($id)) $id = $object->id;
$pdluoid=GETPOST('pdluoid','int');
$pdluo = new Productbatch($db);
@ -44,7 +47,7 @@
print load_fiche_titre($langs->trans("StockTransfer"),'','title_generic.png');
print '<form action="'.$_SERVER["PHP_SELF"].'?id='.$product->id.'" method="post">'."\n";
print '<form action="'.$_SERVER["PHP_SELF"].'?id='.$id.'" method="post">'."\n";
print '<input type="hidden" name="token" value="'.$_SESSION['newtoken'].'">';
print '<input type="hidden" name="action" value="transfert_stock">';
print '<input type="hidden" name="backtopage" value="'.$backtopage.'">';
@ -54,28 +57,37 @@
}
print '<table class="border" width="100%">';
// Source warehouse or product
print '<tr>';
print '<td width="15%" class="fieldrequired">'.$langs->trans("WarehouseSource").'</td><td width="15%">';
if ($pdluoid > 0)
if ($object->element == 'product')
{
print $formproduct->selectWarehouses($pdluo->warehouseid,'id_entrepot_source','',1,1);
print '<td width="15%" class="fieldrequired">'.$langs->trans("WarehouseSource").'</td>';
print '<td width="15%">';
print $formproduct->selectWarehouses((GETPOST("dwid")?GETPOST("dwid",'int'):(GETPOST('id_entrepot')?GETPOST('id_entrepot','int'):'ifone')),'id_entrepot','',1);
print '</td>';
}
else
if ($object->element == 'stock')
{
print $formproduct->selectWarehouses((GETPOST("dwid")?GETPOST("dwid",'int'):(GETPOST('id_entrepot_source')?GETPOST('id_entrepot_source','int'):'ifone')),'id_entrepot_source','',1);
print '<td width="15%" class="fieldrequired">'.$langs->trans("Product").'</td>';
print '<td width="15%">';
print $form->select_produits(GETPOST('product_id'),'product_id',(empty($conf->global->STOCK_SUPPORTS_SERVICES)?'0':''));
print '</td>';
}
print '</td>';
print '<td width="15%" class="fieldrequired">'.$langs->trans("WarehouseTarget").'</td><td width="15%">';
print $formproduct->selectWarehouses(GETPOST('id_entrepot_destination'),'id_entrepot_destination','',1);
print '</td>';
print '<td width="15%" class="fieldrequired">'.$langs->trans("NumberOfUnit").'</td><td width="15%"><input type="text" class="flat" name="nbpiece" size="10" value="'.dol_escape_htmltag(GETPOST("nbpiece")).'"></td>';
print '</tr>';
// Eat-by date
if ((! empty($conf->productbatch->enabled)) && $product->hasbatch())
// Serial / Eat-by date
if (! empty($conf->productbatch->enabled) &&
(($object->element == 'product' && $object->hasbatch())
|| ($object->element == 'stock'))
)
{
print '<tr>';
print '<td class="fieldrequired">'.$langs->trans("batch_number").'</td><td colspan="5">';
print '<td'.($object->element == 'stock'?'': ' class="fieldrequired"').'>'.$langs->trans("batch_number").'</td><td colspan="5">';
print '<input type="text" name="batch_number" size="40"'.($pdluoid > 0 ? ' disabled':'').' value="'.(GETPOST('batch_number')?GETPOST('batch_number'):$pdluo->batch).'">'; // If form was opened for a specific pdluoid, field is disabled
print '</td>';
print '</tr><tr>';
@ -90,7 +102,7 @@
}
// Label
$valformovementlabel=(GETPOST("label")?GETPOST("label"):$langs->trans("MovementTransferStock", $product->ref));
$valformovementlabel=(GETPOST("label")?GETPOST("label"):$langs->trans("MovementTransferStock", $productref));
print '<tr>';
print '<td width="15%">'.$langs->trans("MovementLabel").'</td>';
print '<td colspan="3">';

View File

@ -672,7 +672,7 @@ div.arearef {
margin-bottom: 10px;
}
div.heightref {
min-height: 80px;
min-height: 80px;
}
div.divphotoref {
padding-right: 20px;
@ -1196,8 +1196,8 @@ div.vmenu, td.vmenu {
width: 188px;
}
.menu_contenu {
padding-top: 5px;
.menu_contenu {
padding-top: 5px;
padding-bottom: 2px;
overflow: hidden;
text-overflow: ellipsis;
@ -1268,7 +1268,7 @@ div.blockvmenupair, div.blockvmenuimpair, div.blockvmenubookmarks, div.blockvmen
-moz-box-shadow: 3px 3px 4px #DDD;
-webkit-box-shadow: 3px 3px 4px #DDD;
box-shadow: 3px 3px 4px #DDD;
*/
*/
}
div.blockvmenusearch
@ -2099,7 +2099,7 @@ table.liste, table.noborder, table.formdoc, div.noborder {
border-bottom-width: 1px;
border-bottom-color: #BBB;
border-bottom-style: solid;
margin: 0px 0px 5px 0px;
-moz-box-shadow: 2px 2px 4px #CCC;
@ -3687,22 +3687,31 @@ a span.select2-chosen
overflow: hidden;
}
/* ============================================================================== */
/* For categories */
/* ============================================================================== */
.noborderoncategories {
border: none !important;
border-radius: 5px !important;
box-shadow: none;
-webkit-box-shadow: none !important;
box-shadow: none !important;
color: #fff !important;
}
span.noborderoncategories a, li.noborderoncategories a {
color: #fff !important;
line-height: normal;
vertical-align: top;
}
span.noborderoncategories {
padding: 3px 5px 0px 5px;
}
.categtextwhite, .treeview .categtextwhite.hover {
color: #fff !important;
}
.categtextblack {
color: #000 !important;
}
/* ============================================================================== */
@ -3804,10 +3813,10 @@ a.ui-link, a.ui-link:hover, .ui-btn:hover, span.ui-btn-text:hover, span.ui-btn-i
}
select {
/* display: inline-block; */ /* We can't set this. This disable ability to make */
/* TODO added by jmobile, replace jmobile with pure css*/
/* TODO added by jmobile, replace jmobile with pure css*/
overflow:hidden;
white-space: nowrap;
text-overflow: ellipsis;
text-overflow: ellipsis;
}
.fiche .ui-controlgroup {
margin: 0px;
@ -3985,11 +3994,11 @@ border-top-right-radius: 6px;
@media only screen and (max-width: 767px)
{
.imgopensurveywizard { width:95%; height: auto; }
#tooltip {
position: absolute;
width: <?php print dol_size(350,'width'); ?>px;
}
}
}
@ -4029,14 +4038,14 @@ border-top-right-radius: 6px;
top: 4px;
max-width: 82px;
}
div.mainmenu {
min-width: 20px;
}
.topmenuimage {
background-size: 20px auto;
}
#tooltip {
position: absolute;
width: <?php print dol_size(300,'width'); ?>px;

View File

@ -2816,6 +2816,14 @@ table.dp {
color: rgb(<?php print $colortextlink; ?>);
}
.categtextwhite, .treeview .categtextwhite.hover {
color: #fff !important;
}
.categtextblack {
color: #000 !important;
}
/* ============================================================================== */
/* Afficher/cacher */
/* ============================================================================== */
@ -3525,22 +3533,30 @@ a span.select2-chosen
overflow: hidden;
}
/* ============================================================================== */
/* For categories */
/* ============================================================================== */
.noborderoncategories {
border: none !important;
border-radius: 5px !important;
box-shadow: none;
-webkit-box-shadow: none !important;
box-shadow: none !important;
color: #fff !important;
}
span.noborderoncategories a, li.noborderoncategories a {
color: #fff !important;
line-height: normal;
}
span.noborderoncategories {
padding: 5px 5px 0px 5px;
}
.categtextwhite, .treeview .categtextwhite.hover {
color: #fff !important;
}
.categtextblack {
color: #000 !important;
}
/* ============================================================================== */