Merge branch 'develop' of https://github.com/Dolibarr/dolibarr into develop
Conflicts: htdocs/product/card.php
This commit is contained in:
commit
cd4e104b76
@ -189,7 +189,7 @@ $tabsql[28]= "SELECT h.rowid as rowid, h.code, h.label, h.affect, h.delay, h.new
|
|||||||
$tabsql[29]= "SELECT rowid as rowid, code, label, percent, position, active FROM ".MAIN_DB_PREFIX."c_lead_status";
|
$tabsql[29]= "SELECT rowid as rowid, code, label, percent, position, active FROM ".MAIN_DB_PREFIX."c_lead_status";
|
||||||
$tabsql[30]= "SELECT rowid, code, name, paper_size, orientation, metric, leftmargin, topmargin, nx, ny, spacex, spacey, width, height, font_size, custom_x, custom_y, active FROM ".MAIN_DB_PREFIX."c_format_cards";
|
$tabsql[30]= "SELECT rowid, code, name, paper_size, orientation, metric, leftmargin, topmargin, nx, ny, spacex, spacey, width, height, font_size, custom_x, custom_y, active FROM ".MAIN_DB_PREFIX."c_format_cards";
|
||||||
$tabsql[31]= "SELECT s.rowid as rowid, pcg_version, s.fk_pays as country_id, c.code as country_code, c.label as country, s.label, s.active FROM ".MAIN_DB_PREFIX."accounting_system as s, ".MAIN_DB_PREFIX."c_country as c WHERE s.fk_pays=c.rowid and c.active=1";
|
$tabsql[31]= "SELECT s.rowid as rowid, pcg_version, s.fk_pays as country_id, c.code as country_code, c.label as country, s.label, s.active FROM ".MAIN_DB_PREFIX."accounting_system as s, ".MAIN_DB_PREFIX."c_country as c WHERE s.fk_pays=c.rowid and c.active=1";
|
||||||
$tabsql[32]= "SELECT a.rowid as rowid, a.code as code, a.label, a.range_account, a.position, a.fk_country as country_id, c.code as country_code, c.label as country, a.active FROM ".MAIN_DB_PREFIX."c_accounting_category as a, ".MAIN_DB_PREFIX."c_country as c WHERE a.fk_country=c.rowid and c.active=1";
|
$tabsql[32]= "SELECT a.rowid as rowid, a.code as code, a.label, a.range_account, a.sens, a.category_type, a.formula, a.position as position, a.fk_country as country_id, c.code as country_code, c.label as country, a.active FROM ".MAIN_DB_PREFIX."c_accounting_category as a, ".MAIN_DB_PREFIX."c_country as c WHERE a.fk_country=c.rowid and c.active=1";
|
||||||
$tabsql[33]= "SELECT rowid, pos, code, label, active FROM ".MAIN_DB_PREFIX."c_hrm_department";
|
$tabsql[33]= "SELECT rowid, pos, code, label, active FROM ".MAIN_DB_PREFIX."c_hrm_department";
|
||||||
$tabsql[34]= "SELECT rowid, pos, code, label, c_level, active FROM ".MAIN_DB_PREFIX."c_hrm_function";
|
$tabsql[34]= "SELECT rowid, pos, code, label, c_level, active FROM ".MAIN_DB_PREFIX."c_hrm_function";
|
||||||
|
|
||||||
@ -226,7 +226,7 @@ $tabsqlsort[28]="country ASC, code ASC";
|
|||||||
$tabsqlsort[29]="position ASC";
|
$tabsqlsort[29]="position ASC";
|
||||||
$tabsqlsort[30]="code ASC";
|
$tabsqlsort[30]="code ASC";
|
||||||
$tabsqlsort[31]="pcg_version ASC";
|
$tabsqlsort[31]="pcg_version ASC";
|
||||||
$tabsqlsort[32]="code ASC, label ASC";
|
$tabsqlsort[32]="position ASC";
|
||||||
$tabsqlsort[33]="code ASC";
|
$tabsqlsort[33]="code ASC";
|
||||||
$tabsqlsort[34]="code ASC";
|
$tabsqlsort[34]="code ASC";
|
||||||
|
|
||||||
@ -263,7 +263,7 @@ $tabfield[28]= "code,label,affect,delay,newbymonth,country_id,country";
|
|||||||
$tabfield[29]= "code,label,percent,position";
|
$tabfield[29]= "code,label,percent,position";
|
||||||
$tabfield[30]= "code,name,paper_size,orientation,metric,leftmargin,topmargin,nx,ny,spacex,spacey,width,height,font_size,custom_x,custom_y";
|
$tabfield[30]= "code,name,paper_size,orientation,metric,leftmargin,topmargin,nx,ny,spacex,spacey,width,height,font_size,custom_x,custom_y";
|
||||||
$tabfield[31]= "pcg_version,country_id,country,label";
|
$tabfield[31]= "pcg_version,country_id,country,label";
|
||||||
$tabfield[32]= "code,label,range,position,country_id,country";
|
$tabfield[32]= "code,label,range_account,sens,category_type,formula,position,country_id,country";
|
||||||
$tabfield[33]= "code,label";
|
$tabfield[33]= "code,label";
|
||||||
$tabfield[34]= "code,label";
|
$tabfield[34]= "code,label";
|
||||||
|
|
||||||
@ -300,7 +300,7 @@ $tabfieldvalue[28]= "code,label,affect,delay,newbymonth,country";
|
|||||||
$tabfieldvalue[29]= "code,label,percent,position";
|
$tabfieldvalue[29]= "code,label,percent,position";
|
||||||
$tabfieldvalue[30]= "code,name,paper_size,orientation,metric,leftmargin,topmargin,nx,ny,spacex,spacey,width,height,font_size,custom_x,custom_y";
|
$tabfieldvalue[30]= "code,name,paper_size,orientation,metric,leftmargin,topmargin,nx,ny,spacex,spacey,width,height,font_size,custom_x,custom_y";
|
||||||
$tabfieldvalue[31]= "pcg_version,country,label";
|
$tabfieldvalue[31]= "pcg_version,country,label";
|
||||||
$tabfieldvalue[32]= "code,label,range_account,position,country";
|
$tabfieldvalue[32]= "code,label,range_account,sens,category_type,formula,position,country";
|
||||||
$tabfieldvalue[33]= "code,label";
|
$tabfieldvalue[33]= "code,label";
|
||||||
$tabfieldvalue[34]= "code,label";
|
$tabfieldvalue[34]= "code,label";
|
||||||
|
|
||||||
@ -337,7 +337,7 @@ $tabfieldinsert[28]= "code,label,affect,delay,newbymonth,fk_country";
|
|||||||
$tabfieldinsert[29]= "code,label,percent,position";
|
$tabfieldinsert[29]= "code,label,percent,position";
|
||||||
$tabfieldinsert[30]= "code,name,paper_size,orientation,metric,leftmargin,topmargin,nx,ny,spacex,spacey,width,height,font_size,custom_x,custom_y";
|
$tabfieldinsert[30]= "code,name,paper_size,orientation,metric,leftmargin,topmargin,nx,ny,spacex,spacey,width,height,font_size,custom_x,custom_y";
|
||||||
$tabfieldinsert[31]= "pcg_version,fk_pays,label";
|
$tabfieldinsert[31]= "pcg_version,fk_pays,label";
|
||||||
$tabfieldinsert[32]= "code,label,range_account,position,fk_country";
|
$tabfieldinsert[32]= "code,label,range_account,sens,category_type,formula,position,fk_country";
|
||||||
$tabfieldinsert[33]= "code,label";
|
$tabfieldinsert[33]= "code,label";
|
||||||
$tabfieldinsert[34]= "code,label";
|
$tabfieldinsert[34]= "code,label";
|
||||||
|
|
||||||
@ -585,6 +585,7 @@ if (GETPOST('actionadd') || GETPOST('actionmodify'))
|
|||||||
if ($value == 'localtax1' && empty($_POST['localtax1_type'])) continue;
|
if ($value == 'localtax1' && empty($_POST['localtax1_type'])) continue;
|
||||||
if ($value == 'localtax2' && empty($_POST['localtax2_type'])) continue;
|
if ($value == 'localtax2' && empty($_POST['localtax2_type'])) continue;
|
||||||
if ($value == 'color' && empty($_POST['color'])) continue;
|
if ($value == 'color' && empty($_POST['color'])) continue;
|
||||||
|
if ($value == 'formula' && empty($_POST['formula'])) continue;
|
||||||
if ((! isset($_POST[$value]) || $_POST[$value]=='')
|
if ((! isset($_POST[$value]) || $_POST[$value]=='')
|
||||||
&& (! in_array($listfield[$f], array('decalage','module','accountancy_code','accountancy_code_sell','accountancy_code_buy'))) // Fields that are not mandatory
|
&& (! in_array($listfield[$f], array('decalage','module','accountancy_code','accountancy_code_sell','accountancy_code_buy'))) // Fields that are not mandatory
|
||||||
)
|
)
|
||||||
@ -605,6 +606,7 @@ if (GETPOST('actionadd') || GETPOST('actionmodify'))
|
|||||||
if ($fieldnamekey == 'unicode') $fieldnamekey = 'Unicode';
|
if ($fieldnamekey == 'unicode') $fieldnamekey = 'Unicode';
|
||||||
if ($fieldnamekey == 'deductible') $fieldnamekey = 'Deductible';
|
if ($fieldnamekey == 'deductible') $fieldnamekey = 'Deductible';
|
||||||
if ($fieldnamekey == 'sortorder') $fieldnamekey = 'SortOrder';
|
if ($fieldnamekey == 'sortorder') $fieldnamekey = 'SortOrder';
|
||||||
|
if ($fieldnamekey == 'category_type') $fieldnamekey = 'Calculated';
|
||||||
|
|
||||||
setEventMessages($langs->transnoentities("ErrorFieldRequired", $langs->transnoentities($fieldnamekey)), null, 'errors');
|
setEventMessages($langs->transnoentities("ErrorFieldRequired", $langs->transnoentities($fieldnamekey)), null, 'errors');
|
||||||
}
|
}
|
||||||
@ -999,6 +1001,9 @@ if ($id)
|
|||||||
if ($fieldlist[$field]=='short_label') { $valuetoshow=$langs->trans("ShortLabel"); }
|
if ($fieldlist[$field]=='short_label') { $valuetoshow=$langs->trans("ShortLabel"); }
|
||||||
if ($fieldlist[$field]=='type_template') { $valuetoshow=$langs->trans("TypeOfTemplate"); }
|
if ($fieldlist[$field]=='type_template') { $valuetoshow=$langs->trans("TypeOfTemplate"); }
|
||||||
if ($fieldlist[$field]=='range_account') { $valuetoshow=$langs->trans("Range"); }
|
if ($fieldlist[$field]=='range_account') { $valuetoshow=$langs->trans("Range"); }
|
||||||
|
if ($fieldlist[$field]=='sens') { $valuetoshow=$langs->trans("Sens"); }
|
||||||
|
if ($fieldlist[$field]=='category_type') { $valuetoshow=$langs->trans("Calculated"); }
|
||||||
|
if ($fieldlist[$field]=='formula') { $valuetoshow=$langs->trans("Formula"); }
|
||||||
|
|
||||||
if ($id == 2) // Special cas for state page
|
if ($id == 2) // Special cas for state page
|
||||||
{
|
{
|
||||||
@ -1167,6 +1172,9 @@ if ($id)
|
|||||||
if ($fieldlist[$field]=='short_label') { $valuetoshow=$langs->trans("ShortLabel"); }
|
if ($fieldlist[$field]=='short_label') { $valuetoshow=$langs->trans("ShortLabel"); }
|
||||||
if ($fieldlist[$field]=='type_template') { $valuetoshow=$langs->trans("TypeOfTemplate"); }
|
if ($fieldlist[$field]=='type_template') { $valuetoshow=$langs->trans("TypeOfTemplate"); }
|
||||||
if ($fieldlist[$field]=='range_account') { $valuetoshow=$langs->trans("Range"); }
|
if ($fieldlist[$field]=='range_account') { $valuetoshow=$langs->trans("Range"); }
|
||||||
|
if ($fieldlist[$field]=='sens') { $valuetoshow=$langs->trans("Sens"); }
|
||||||
|
if ($fieldlist[$field]=='category_type') { $valuetoshow=$langs->trans("Calculated"); }
|
||||||
|
if ($fieldlist[$field]=='formula') { $valuetoshow=$langs->trans("Formula"); }
|
||||||
|
|
||||||
// Affiche nom du champ
|
// Affiche nom du champ
|
||||||
if ($showfield)
|
if ($showfield)
|
||||||
@ -1248,7 +1256,7 @@ if ($id)
|
|||||||
$valuetoshow=($key != "Country".strtoupper($obj->country_code)?$obj->country_code." - ".$key:$obj->country);
|
$valuetoshow=($key != "Country".strtoupper($obj->country_code)?$obj->country_code." - ".$key:$obj->country);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
else if ($fieldlist[$field]=='recuperableonly' || $fieldlist[$field]=='fdm' || $fieldlist[$field] == 'deductible') {
|
else if ($fieldlist[$field]=='recuperableonly' || $fieldlist[$field]=='fdm' || $fieldlist[$field] == 'deductible' || $fieldlist[$field] == 'category_type') {
|
||||||
$valuetoshow=yn($valuetoshow);
|
$valuetoshow=yn($valuetoshow);
|
||||||
$align="center";
|
$align="center";
|
||||||
}
|
}
|
||||||
@ -1618,7 +1626,7 @@ function fieldList($fieldlist, $obj='', $tabname='', $context='')
|
|||||||
print 'user<input type="hidden" name="type" value="user">';
|
print 'user<input type="hidden" name="type" value="user">';
|
||||||
print '</td>';
|
print '</td>';
|
||||||
}
|
}
|
||||||
elseif ($fieldlist[$field] == 'recuperableonly' || $fieldlist[$field] == 'fdm' || $fieldlist[$field] == 'deductible') {
|
elseif ($fieldlist[$field] == 'recuperableonly' || $fieldlist[$field] == 'fdm' || $fieldlist[$field] == 'deductible' || $fieldlist[$field] == 'category_type') {
|
||||||
print '<td>';
|
print '<td>';
|
||||||
print $form->selectyesno($fieldlist[$field],(! empty($obj->{$fieldlist[$field]})?$obj->{$fieldlist[$field]}:''),1);
|
print $form->selectyesno($fieldlist[$field],(! empty($obj->{$fieldlist[$field]})?$obj->{$fieldlist[$field]}:''),1);
|
||||||
print '</td>';
|
print '</td>';
|
||||||
@ -1697,7 +1705,7 @@ function fieldList($fieldlist, $obj='', $tabname='', $context='')
|
|||||||
if ($fieldlist[$field]=='position') $size='size="4" ';
|
if ($fieldlist[$field]=='position') $size='size="4" ';
|
||||||
if ($fieldlist[$field]=='libelle') $size='centpercent';
|
if ($fieldlist[$field]=='libelle') $size='centpercent';
|
||||||
if ($fieldlist[$field]=='tracking') $class='centpercent';
|
if ($fieldlist[$field]=='tracking') $class='centpercent';
|
||||||
if ($fieldlist[$field]=='sortorder') $size='size="2" ';
|
if ($fieldlist[$field]=='sortorder' || $fieldlist[$field]=='sens' || $fieldlist[$field]=='category_type') $size='size="2" ';
|
||||||
print '<input type="text" '.$size.' class="flat'.($class?' '.$class:'').'" value="'.(isset($obj->{$fieldlist[$field]})?$obj->{$fieldlist[$field]}:'').'" name="'.$fieldlist[$field].'">';
|
print '<input type="text" '.$size.' class="flat'.($class?' '.$class:'').'" value="'.(isset($obj->{$fieldlist[$field]})?$obj->{$fieldlist[$field]}:'').'" name="'.$fieldlist[$field].'">';
|
||||||
print '</td>';
|
print '</td>';
|
||||||
}
|
}
|
||||||
|
|||||||
@ -1,5 +1,5 @@
|
|||||||
<?php
|
<?php
|
||||||
/* Copyright (C) 2014 Alexandre Spangaro <aspangaro.dolibarr@gmail.com>
|
/* Copyright (C) 2014-2016 Alexandre Spangaro <aspangaro.dolibarr@gmail.com>
|
||||||
*
|
*
|
||||||
* This program is free software; you can redistribute it and/or modify
|
* 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
|
* it under the terms of the GNU General Public License as published by
|
||||||
@ -26,6 +26,7 @@ require '../main.inc.php';
|
|||||||
|
|
||||||
// Class
|
// Class
|
||||||
require_once DOL_DOCUMENT_ROOT.'/core/lib/admin.lib.php';
|
require_once DOL_DOCUMENT_ROOT.'/core/lib/admin.lib.php';
|
||||||
|
if (! empty($conf->accounting->enabled)) require_once DOL_DOCUMENT_ROOT . '/accountancy/class/html.formventilation.class.php';
|
||||||
|
|
||||||
$langs->load("admin");
|
$langs->load("admin");
|
||||||
$langs->load("loan");
|
$langs->load("loan");
|
||||||
@ -76,6 +77,7 @@ if ($action == 'update')
|
|||||||
llxHeader();
|
llxHeader();
|
||||||
|
|
||||||
$form = new Form($db);
|
$form = new Form($db);
|
||||||
|
if (! empty($conf->accounting->enabled)) $formaccountancy = New FormVentilation($db);
|
||||||
|
|
||||||
$linkback='<a href="'.DOL_URL_ROOT.'/admin/modules.php">'.$langs->trans("BackToModuleList").'</a>';
|
$linkback='<a href="'.DOL_URL_ROOT.'/admin/modules.php">'.$langs->trans("BackToModuleList").'</a>';
|
||||||
print load_fiche_titre($langs->trans('ConfigLoan'),$linkback,'title_setup');
|
print load_fiche_titre($langs->trans('ConfigLoan'),$linkback,'title_setup');
|
||||||
@ -104,7 +106,14 @@ foreach ($list as $key)
|
|||||||
|
|
||||||
// Value
|
// Value
|
||||||
print '<td>';
|
print '<td>';
|
||||||
print '<input type="text" size="20" id="'.$key.'" name="'.$key.'" value="'.$conf->global->$key.'">';
|
if (! empty($conf->accounting->enabled))
|
||||||
|
{
|
||||||
|
print $formaccountancy->select_account($conf->global->$key, $key, 1, '', 1, 1);
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
print '<input type="text" size="20" id="'.$key.'" name="'.$key.'" value="'.$conf->global->$key.'">';
|
||||||
|
}
|
||||||
print '</td></tr>';
|
print '</td></tr>';
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@ -715,7 +715,7 @@ if ($resql)
|
|||||||
|
|
||||||
// Get local and virtual stock and store it into cache
|
// Get local and virtual stock and store it into cache
|
||||||
if (empty($productstat_cache[$generic_commande->lines[$lig]->fk_product])) {
|
if (empty($productstat_cache[$generic_commande->lines[$lig]->fk_product])) {
|
||||||
$generic_product->load_stock();
|
$generic_product->load_stock('nobatch');
|
||||||
//$generic_product->load_virtual_stock(); Already included into load_stock
|
//$generic_product->load_virtual_stock(); Already included into load_stock
|
||||||
$productstat_cache[$generic_commande->lines[$lig]->fk_product]['stock_reel'] = $generic_product->stock_reel;
|
$productstat_cache[$generic_commande->lines[$lig]->fk_product]['stock_reel'] = $generic_product->stock_reel;
|
||||||
$productstat_cachevirtual[$generic_commande->lines[$lig]->fk_product]['stock_reel'] = $generic_product->stock_theorique;
|
$productstat_cachevirtual[$generic_commande->lines[$lig]->fk_product]['stock_reel'] = $generic_product->stock_theorique;
|
||||||
@ -723,7 +723,7 @@ if ($resql)
|
|||||||
$generic_product->stock_reel = $productstat_cache[$generic_commande->lines[$lig]->fk_product]['stock_reel'];
|
$generic_product->stock_reel = $productstat_cache[$generic_commande->lines[$lig]->fk_product]['stock_reel'];
|
||||||
$generic_product->stock_theorique = $productstat_cachevirtual[$generic_commande->lines[$lig]->fk_product]['stock_reel'] = $generic_product->stock_theorique;
|
$generic_product->stock_theorique = $productstat_cachevirtual[$generic_commande->lines[$lig]->fk_product]['stock_reel'] = $generic_product->stock_theorique;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (empty($conf->global->SHIPPABLE_ORDER_ICON_IN_LIST)) // Default code. Default is when this option is not set, setting it create strange result
|
if (empty($conf->global->SHIPPABLE_ORDER_ICON_IN_LIST)) // Default code. Default is when this option is not set, setting it create strange result
|
||||||
{
|
{
|
||||||
$text_info .= $generic_commande->lines[$lig]->qty.' X '.$generic_commande->lines[$lig]->ref.' '.dol_trunc($generic_commande->lines[$lig]->product_label, 25);
|
$text_info .= $generic_commande->lines[$lig]->qty.' X '.$generic_commande->lines[$lig]->ref.' '.dol_trunc($generic_commande->lines[$lig]->product_label, 25);
|
||||||
|
|||||||
@ -3,7 +3,7 @@
|
|||||||
* Copyright (C) 2003 Jean-Louis Bergamo <jlb@j1b.org>
|
* Copyright (C) 2003 Jean-Louis Bergamo <jlb@j1b.org>
|
||||||
* Copyright (C) 2004-2015 Laurent Destailleur <eldy@users.sourceforge.net>
|
* Copyright (C) 2004-2015 Laurent Destailleur <eldy@users.sourceforge.net>
|
||||||
* Copyright (C) 2005-2009 Regis Houssin <regis.houssin@capnetworks.com>
|
* Copyright (C) 2005-2009 Regis Houssin <regis.houssin@capnetworks.com>
|
||||||
* Copyright (C) 2014-2015 Alexandre Spangaro <aspangaro.dolibarr@gmail.com>
|
* Copyright (C) 2014-2016 Alexandre Spangaro <aspangaro.dolibarr@gmail.com>
|
||||||
* Copyright (C) 2015 Jean-François Ferry <jfefe@aternatik.fr>
|
* Copyright (C) 2015 Jean-François Ferry <jfefe@aternatik.fr>
|
||||||
* Copyright (C) 2016 Marcos García <marcosgdf@gmail.com>
|
* Copyright (C) 2016 Marcos García <marcosgdf@gmail.com>
|
||||||
*
|
*
|
||||||
@ -34,8 +34,8 @@ require_once DOL_DOCUMENT_ROOT . '/core/class/html.formcompany.class.php';
|
|||||||
require_once DOL_DOCUMENT_ROOT . '/core/class/html.formbank.class.php';
|
require_once DOL_DOCUMENT_ROOT . '/core/class/html.formbank.class.php';
|
||||||
require_once DOL_DOCUMENT_ROOT . '/compta/bank/class/account.class.php';
|
require_once DOL_DOCUMENT_ROOT . '/compta/bank/class/account.class.php';
|
||||||
require_once DOL_DOCUMENT_ROOT . '/core/class/extrafields.class.php';
|
require_once DOL_DOCUMENT_ROOT . '/core/class/extrafields.class.php';
|
||||||
require_once DOL_DOCUMENT_ROOT . '/core/lib/accounting.lib.php';
|
if (! empty($conf->accounting->enabled)) require_once DOL_DOCUMENT_ROOT . '/core/lib/accounting.lib.php';
|
||||||
if (! empty($conf->accounting->enabled)) require_once DOL_DOCUMENT_ROOT.'/accountancy/class/html.formventilation.class.php';
|
if (! empty($conf->accounting->enabled)) require_once DOL_DOCUMENT_ROOT . '/accountancy/class/html.formventilation.class.php';
|
||||||
|
|
||||||
$langs->load("banks");
|
$langs->load("banks");
|
||||||
$langs->load("bills");
|
$langs->load("bills");
|
||||||
@ -675,7 +675,13 @@ else
|
|||||||
print '<table class="border" width="100%">';
|
print '<table class="border" width="100%">';
|
||||||
// Accountancy code
|
// Accountancy code
|
||||||
print '<tr><td class="titlefield">'.$langs->trans("AccountancyCode").'</td>';
|
print '<tr><td class="titlefield">'.$langs->trans("AccountancyCode").'</td>';
|
||||||
print '<td colspan="3">'.length_accountg($account->account_number).'</td></tr>';
|
print '<td colspan="3">';
|
||||||
|
if (! empty($conf->accounting->enabled)) {
|
||||||
|
print length_accountg($account->account_number).'</td></tr>';
|
||||||
|
} else {
|
||||||
|
print $account->account_number;
|
||||||
|
}
|
||||||
|
print '</td></tr>';
|
||||||
|
|
||||||
// Accountancy journal
|
// Accountancy journal
|
||||||
if (! empty($conf->accounting->enabled))
|
if (! empty($conf->accounting->enabled))
|
||||||
|
|||||||
@ -1100,9 +1100,12 @@ class Account extends CommonObject
|
|||||||
*/
|
*/
|
||||||
public static function countAccountToReconcile()
|
public static function countAccountToReconcile()
|
||||||
{
|
{
|
||||||
global $db, $conf, $langs;
|
global $db, $conf, $user;
|
||||||
|
|
||||||
if ($user->societe_id) return 0; // protection pour eviter appel par utilisateur externe
|
//Protection against external users
|
||||||
|
if ($user->societe_id) {
|
||||||
|
return 0;
|
||||||
|
}
|
||||||
|
|
||||||
$nb=0;
|
$nb=0;
|
||||||
|
|
||||||
|
|||||||
@ -153,6 +153,7 @@ $arrayfields=array(
|
|||||||
'f.total_vat'=>array('label'=>$langs->trans("AmountVAT"), 'checked'=>0),
|
'f.total_vat'=>array('label'=>$langs->trans("AmountVAT"), 'checked'=>0),
|
||||||
'f.total_ttc'=>array('label'=>$langs->trans("AmountTTC"), 'checked'=>0),
|
'f.total_ttc'=>array('label'=>$langs->trans("AmountTTC"), 'checked'=>0),
|
||||||
'am'=>array('label'=>$langs->trans("Received"), 'checked'=>0),
|
'am'=>array('label'=>$langs->trans("Received"), 'checked'=>0),
|
||||||
|
'rtp'=>array('label'=>$langs->trans("Rest"), 'checked'=>0),
|
||||||
'f.datec'=>array('label'=>$langs->trans("DateCreation"), 'checked'=>0, 'position'=>500),
|
'f.datec'=>array('label'=>$langs->trans("DateCreation"), 'checked'=>0, 'position'=>500),
|
||||||
'f.tms'=>array('label'=>$langs->trans("DateModificationShort"), 'checked'=>0, 'position'=>500),
|
'f.tms'=>array('label'=>$langs->trans("DateModificationShort"), 'checked'=>0, 'position'=>500),
|
||||||
'f.fk_statut'=>array('label'=>$langs->trans("Status"), 'checked'=>1, 'position'=>1000),
|
'f.fk_statut'=>array('label'=>$langs->trans("Status"), 'checked'=>1, 'position'=>1000),
|
||||||
@ -997,6 +998,7 @@ if ($resql)
|
|||||||
if (! empty($arrayfields['f.total_vat']['checked'])) print_liste_field_titre($arrayfields['f.total_vat']['label'],$_SERVER['PHP_SELF'],'f.tva','',$param,'align="right"',$sortfield,$sortorder);
|
if (! empty($arrayfields['f.total_vat']['checked'])) print_liste_field_titre($arrayfields['f.total_vat']['label'],$_SERVER['PHP_SELF'],'f.tva','',$param,'align="right"',$sortfield,$sortorder);
|
||||||
if (! empty($arrayfields['f.total_ttc']['checked'])) print_liste_field_titre($arrayfields['f.total_ttc']['label'],$_SERVER['PHP_SELF'],'f.total_ttc','',$param,'align="right"',$sortfield,$sortorder);
|
if (! empty($arrayfields['f.total_ttc']['checked'])) print_liste_field_titre($arrayfields['f.total_ttc']['label'],$_SERVER['PHP_SELF'],'f.total_ttc','',$param,'align="right"',$sortfield,$sortorder);
|
||||||
if (! empty($arrayfields['am']['checked'])) print_liste_field_titre($arrayfields['am']['label'],$_SERVER['PHP_SELF'],'am','',$param,'align="right"',$sortfield,$sortorder);
|
if (! empty($arrayfields['am']['checked'])) print_liste_field_titre($arrayfields['am']['label'],$_SERVER['PHP_SELF'],'am','',$param,'align="right"',$sortfield,$sortorder);
|
||||||
|
if (! empty($arrayfields['rtp']['checked'])) print_liste_field_titre($arrayfields['rtp']['label'],$_SERVER['PHP_SELF'],'rtp','',$param,'align="right"',$sortfield,$sortorder);
|
||||||
// Extra fields
|
// Extra fields
|
||||||
if (is_array($extrafields->attribute_label) && count($extrafields->attribute_label))
|
if (is_array($extrafields->attribute_label) && count($extrafields->attribute_label))
|
||||||
{
|
{
|
||||||
@ -1117,6 +1119,11 @@ if ($resql)
|
|||||||
print '<td class="liste_titre" align="right">';
|
print '<td class="liste_titre" align="right">';
|
||||||
print '</td>';
|
print '</td>';
|
||||||
}
|
}
|
||||||
|
if (! empty($arrayfields['rtp']['checked']))
|
||||||
|
{
|
||||||
|
print '<td class="liste_titre" align="right">';
|
||||||
|
print '</td>';
|
||||||
|
}
|
||||||
// Extra fields
|
// Extra fields
|
||||||
if (is_array($extrafields->attribute_label) && count($extrafields->attribute_label))
|
if (is_array($extrafields->attribute_label) && count($extrafields->attribute_label))
|
||||||
{
|
{
|
||||||
@ -1195,6 +1202,7 @@ if ($resql)
|
|||||||
$facturestatic->date_lim_reglement=$db->jdate($obj->datelimite);
|
$facturestatic->date_lim_reglement=$db->jdate($obj->datelimite);
|
||||||
$notetoshow=dol_string_nohtmltag(($user->societe_id>0?$obj->note_public:$obj->note_private),1);
|
$notetoshow=dol_string_nohtmltag(($user->societe_id>0?$obj->note_public:$obj->note_private),1);
|
||||||
$paiement = $facturestatic->getSommePaiement();
|
$paiement = $facturestatic->getSommePaiement();
|
||||||
|
$remaintopay = $obj->total_ttc - $paiement;
|
||||||
|
|
||||||
print '<table class="nobordernopadding"><tr class="nocellnopadd">';
|
print '<table class="nobordernopadding"><tr class="nocellnopadd">';
|
||||||
|
|
||||||
@ -1347,6 +1355,14 @@ if ($resql)
|
|||||||
if (! $i) $totalarray['totalamfield']=$totalarray['nbfield'];
|
if (! $i) $totalarray['totalamfield']=$totalarray['nbfield'];
|
||||||
$totalarray['totalam'] += $paiement;
|
$totalarray['totalam'] += $paiement;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if (! empty($arrayfields['rtp']['checked']))
|
||||||
|
{
|
||||||
|
print '<td align="right">'.(! empty($remaintopay)?price($remaintopay,0,$langs):' ').'</td>';
|
||||||
|
if (! $i) $totalarray['nbfield']++;
|
||||||
|
if (! $i) $totalarray['totalrtpfield']=$totalarray['nbfield'];
|
||||||
|
$totalarray['totalrtp'] += $remaintopay;
|
||||||
|
}
|
||||||
|
|
||||||
// Extra fields
|
// Extra fields
|
||||||
if (is_array($extrafields->attribute_label) && count($extrafields->attribute_label))
|
if (is_array($extrafields->attribute_label) && count($extrafields->attribute_label))
|
||||||
@ -1425,6 +1441,7 @@ if ($resql)
|
|||||||
elseif ($totalarray['totalvatfield'] == $i) print '<td align="right">'.price($totalarray['totalvat']).'</td>';
|
elseif ($totalarray['totalvatfield'] == $i) print '<td align="right">'.price($totalarray['totalvat']).'</td>';
|
||||||
elseif ($totalarray['totalttcfield'] == $i) print '<td align="right">'.price($totalarray['totalttc']).'</td>';
|
elseif ($totalarray['totalttcfield'] == $i) print '<td align="right">'.price($totalarray['totalttc']).'</td>';
|
||||||
elseif ($totalarray['totalamfield'] == $i) print '<td align="right">'.price($totalarray['totalam']).'</td>';
|
elseif ($totalarray['totalamfield'] == $i) print '<td align="right">'.price($totalarray['totalam']).'</td>';
|
||||||
|
elseif ($totalarray['totalrtpfield'] == $i) print '<td align="right">'.price($totalarray['totalrtp']).'</td>';
|
||||||
else print '<td></td>';
|
else print '<td></td>';
|
||||||
}
|
}
|
||||||
print '</tr>';
|
print '</tr>';
|
||||||
|
|||||||
@ -382,7 +382,7 @@ print '</tr>';
|
|||||||
* Charges sociales non deductibles
|
* Charges sociales non deductibles
|
||||||
*/
|
*/
|
||||||
|
|
||||||
print '<tr><td colspan="4">'.$langs->trans("SocialContributions").' ('.$langs->trans("Type").' 0)</td></tr>';
|
print '<tr><td colspan="4">'.$langs->trans("SocialContributionsNondeductibles").'</td></tr>';
|
||||||
|
|
||||||
if ($modecompta == 'CREANCES-DETTES')
|
if ($modecompta == 'CREANCES-DETTES')
|
||||||
{
|
{
|
||||||
@ -456,7 +456,7 @@ print '</tr>';
|
|||||||
* Charges sociales deductibles
|
* Charges sociales deductibles
|
||||||
*/
|
*/
|
||||||
|
|
||||||
print '<tr><td colspan="4">'.$langs->trans("SocialContributions").' ('.$langs->trans("Type").' 1)</td></tr>';
|
print '<tr><td colspan="4">'.$langs->trans("SocialContributionsDeductibles").'</td></tr>';
|
||||||
|
|
||||||
if ($modecompta == 'CREANCES-DETTES')
|
if ($modecompta == 'CREANCES-DETTES')
|
||||||
{
|
{
|
||||||
|
|||||||
@ -107,6 +107,47 @@ class Contact extends CommonObject
|
|||||||
$this->db = $db;
|
$this->db = $db;
|
||||||
$this->statut = 1; // By default, status is enabled
|
$this->statut = 1; // By default, status is enabled
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Load indicators into this->nb for board
|
||||||
|
*
|
||||||
|
* @return int <0 if KO, >0 if OK
|
||||||
|
*/
|
||||||
|
function load_state_board()
|
||||||
|
{
|
||||||
|
global $user;
|
||||||
|
|
||||||
|
$this->nb=array();
|
||||||
|
$clause = "WHERE";
|
||||||
|
|
||||||
|
$sql = "SELECT count(sp.rowid) as nb";
|
||||||
|
$sql.= " FROM ".MAIN_DB_PREFIX."socpeople as sp";
|
||||||
|
$sql.= " LEFT JOIN ".MAIN_DB_PREFIX."societe as s ON (sp.fk_soc = s.rowid)";
|
||||||
|
if (!$user->rights->societe->client->voir && !$user->societe_id)
|
||||||
|
{
|
||||||
|
$sql.= " LEFT JOIN ".MAIN_DB_PREFIX."societe_commerciaux as sc ON s.rowid = sc.fk_soc";
|
||||||
|
$sql.= " WHERE sc.fk_user = " .$user->id;
|
||||||
|
$clause = "AND";
|
||||||
|
}
|
||||||
|
$sql.= ' '.$clause.' s.entity IN ('.getEntity($this->element, 1).')';
|
||||||
|
|
||||||
|
$resql=$this->db->query($sql);
|
||||||
|
if ($resql)
|
||||||
|
{
|
||||||
|
while ($obj=$this->db->fetch_object($resql))
|
||||||
|
{
|
||||||
|
$this->nb["contacts"]=$obj->nb;
|
||||||
|
}
|
||||||
|
$this->db->free($resql);
|
||||||
|
return 1;
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
dol_print_error($this->db);
|
||||||
|
$this->error=$this->db->lasterror();
|
||||||
|
return -1;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Add a contact into database
|
* Add a contact into database
|
||||||
|
|||||||
@ -2057,17 +2057,27 @@ class Form
|
|||||||
{
|
{
|
||||||
global $langs,$conf;
|
global $langs,$conf;
|
||||||
global $price_level, $status, $finished;
|
global $price_level, $status, $finished;
|
||||||
|
|
||||||
|
$selected_input_value='';
|
||||||
if (! empty($conf->use_javascript_ajax) && ! empty($conf->global->PRODUIT_USE_SEARCH_TO_SELECT))
|
if (! empty($conf->use_javascript_ajax) && ! empty($conf->global->PRODUIT_USE_SEARCH_TO_SELECT))
|
||||||
{
|
{
|
||||||
|
if ($selected > 0)
|
||||||
|
{
|
||||||
|
require_once DOL_DOCUMENT_ROOT.'/product/class/product.class.php';
|
||||||
|
$producttmpselect = new Product($this->db);
|
||||||
|
$producttmpselect->fetch($selected);
|
||||||
|
$selected_input_value=$producttmpselect->ref;
|
||||||
|
unset($producttmpselect);
|
||||||
|
}
|
||||||
|
|
||||||
if (!empty($conf->global->SUPPLIER_ORDER_WITH_NOPRICEDEFINED))
|
if (!empty($conf->global->SUPPLIER_ORDER_WITH_NOPRICEDEFINED))
|
||||||
{
|
{
|
||||||
print '<input type="hidden" id="idprod" name="idprod" value="0" />';
|
print '<input type="hidden" id="idprod" name="idprod" value="0" />';
|
||||||
}
|
}
|
||||||
// mode=2 means suppliers products
|
// mode=2 means suppliers products
|
||||||
$urloption=($socid > 0?'socid='.$socid.'&':'').'htmlname='.$htmlname.'&outjson=1&price_level='.$price_level.'&type='.$filtertype.'&mode=2&status='.$status.'&finished='.$finished;
|
$urloption=($socid > 0?'socid='.$socid.'&':'').'htmlname='.$htmlname.'&outjson=1&price_level='.$price_level.'&type='.$filtertype.'&mode=2&status='.$status.'&finished='.$finished;
|
||||||
print ajax_autocompleter('', $htmlname, DOL_URL_ROOT.'/product/ajax/products.php', $urloption, $conf->global->PRODUIT_USE_SEARCH_TO_SELECT, 0, $ajaxoptions);
|
print ajax_autocompleter($selected, $htmlname, DOL_URL_ROOT.'/product/ajax/products.php', $urloption, $conf->global->PRODUIT_USE_SEARCH_TO_SELECT, 0, $ajaxoptions);
|
||||||
print ($hidelabel?'':$langs->trans("RefOrLabel").' : ').'<input type="text" size="20" name="search_'.$htmlname.'" id="search_'.$htmlname.'">';
|
print ($hidelabel?'':$langs->trans("RefOrLabel").' : ').'<input type="text" size="20" name="search_'.$htmlname.'" id="search_'.$htmlname.'" value="'.$selected_input_value.'">';
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
@ -2089,7 +2099,7 @@ class Form
|
|||||||
* @param string $filtertype Filter on product type (''=nofilter, 0=product, 1=service)
|
* @param string $filtertype Filter on product type (''=nofilter, 0=product, 1=service)
|
||||||
* @param string $filtre Pour filtre sql
|
* @param string $filtre Pour filtre sql
|
||||||
* @param string $filterkey Filtre des produits
|
* @param string $filterkey Filtre des produits
|
||||||
* @param int $statut -1=Return all products, 0=Products not on sell, 1=Products on sell
|
* @param int $statut -1=Return all products, 0=Products not on sell, 1=Products on sell (not used here, a filter on tobuy is already hard coded in request)
|
||||||
* @param int $outputmode 0=HTML select string, 1=Array
|
* @param int $outputmode 0=HTML select string, 1=Array
|
||||||
* @param int $limit Limit of line number
|
* @param int $limit Limit of line number
|
||||||
* @return array Array of keys for json
|
* @return array Array of keys for json
|
||||||
@ -2106,7 +2116,7 @@ class Form
|
|||||||
$sql = "SELECT p.rowid, p.label, p.ref, p.price, p.duration, p.fk_product_type,";
|
$sql = "SELECT p.rowid, p.label, p.ref, p.price, p.duration, p.fk_product_type,";
|
||||||
$sql.= " pfp.ref_fourn, pfp.rowid as idprodfournprice, pfp.price as fprice, pfp.quantity, pfp.remise_percent, pfp.remise, pfp.unitprice,";
|
$sql.= " pfp.ref_fourn, pfp.rowid as idprodfournprice, pfp.price as fprice, pfp.quantity, pfp.remise_percent, pfp.remise, pfp.unitprice,";
|
||||||
$sql.= " pfp.fk_supplier_price_expression, pfp.fk_product, pfp.tva_tx, pfp.fk_soc, s.nom as name,";
|
$sql.= " pfp.fk_supplier_price_expression, pfp.fk_product, pfp.tva_tx, pfp.fk_soc, s.nom as name,";
|
||||||
$sql.= " pfp.supplier_reputation";
|
$sql.= " pfp.supplier_reputation";
|
||||||
$sql.= " FROM ".MAIN_DB_PREFIX."product as p";
|
$sql.= " FROM ".MAIN_DB_PREFIX."product as p";
|
||||||
$sql.= " LEFT JOIN ".MAIN_DB_PREFIX."product_fournisseur_price as pfp ON p.rowid = pfp.fk_product";
|
$sql.= " LEFT JOIN ".MAIN_DB_PREFIX."product_fournisseur_price as pfp ON p.rowid = pfp.fk_product";
|
||||||
if ($socid) $sql.= " AND pfp.fk_soc = ".$socid;
|
if ($socid) $sql.= " AND pfp.fk_soc = ".$socid;
|
||||||
|
|||||||
@ -346,7 +346,8 @@ function run_sql($sqlfile,$silent=1,$entity='',$usesavepoint=1,$handler='',$oker
|
|||||||
'DB_ERROR_NO_INDEX_TO_DROP',
|
'DB_ERROR_NO_INDEX_TO_DROP',
|
||||||
'DB_ERROR_CANNOT_CREATE', // Qd contrainte deja existante
|
'DB_ERROR_CANNOT_CREATE', // Qd contrainte deja existante
|
||||||
'DB_ERROR_CANT_DROP_PRIMARY_KEY',
|
'DB_ERROR_CANT_DROP_PRIMARY_KEY',
|
||||||
'DB_ERROR_PRIMARY_KEY_ALREADY_EXISTS'
|
'DB_ERROR_PRIMARY_KEY_ALREADY_EXISTS',
|
||||||
|
'DB_ERROR_22P02'
|
||||||
);
|
);
|
||||||
if ($okerror == 'none') $okerrors=array();
|
if ($okerror == 'none') $okerrors=array();
|
||||||
|
|
||||||
@ -928,7 +929,7 @@ function complete_dictionary_with_modules(&$taborder,&$tabname,&$tablib,&$tabsql
|
|||||||
foreach($objMod->dictionaries['tabcond'] as $val) { $nbtabcond++; $tabcond[] = $val; }
|
foreach($objMod->dictionaries['tabcond'] as $val) { $nbtabcond++; $tabcond[] = $val; }
|
||||||
if (! empty($objMod->dictionaries['tabhelp'])) foreach($objMod->dictionaries['tabhelp'] as $val) { $nbtabhelp++; $tabhelp[] = $val; }
|
if (! empty($objMod->dictionaries['tabhelp'])) foreach($objMod->dictionaries['tabhelp'] as $val) { $nbtabhelp++; $tabhelp[] = $val; }
|
||||||
if (! empty($objMod->dictionaries['tabfieldcheck'])) foreach($objMod->dictionaries['tabfieldcheck'] as $val) { $nbtabfieldcheck++; $tabfieldcheck[] = $val; }
|
if (! empty($objMod->dictionaries['tabfieldcheck'])) foreach($objMod->dictionaries['tabfieldcheck'] as $val) { $nbtabfieldcheck++; $tabfieldcheck[] = $val; }
|
||||||
|
|
||||||
if ($nbtabname != $nbtablib || $nbtablib != $nbtabsql || $nbtabsql != $nbtabsqlsort)
|
if ($nbtabname != $nbtablib || $nbtablib != $nbtabsql || $nbtabsql != $nbtabsqlsort)
|
||||||
{
|
{
|
||||||
print 'Error in descriptor of module '.$const_name.'. Array ->dictionaries has not same number of record for key "tabname", "tablib", "tabsql" and "tabsqlsort"';
|
print 'Error in descriptor of module '.$const_name.'. Array ->dictionaries has not same number of record for key "tabname", "tablib", "tabsql" and "tabsqlsort"';
|
||||||
|
|||||||
@ -136,7 +136,8 @@ function ajax_autocompleter($selected, $htmlname, $url, $urloption='', $minLengt
|
|||||||
minLength: '.$minLength.',
|
minLength: '.$minLength.',
|
||||||
select: function( event, ui ) { // Function ran once new value has been selected into javascript combo
|
select: function( event, ui ) { // Function ran once new value has been selected into javascript combo
|
||||||
console.log("Call change on input '.$htmlname.' because of select definition of autocomplete select call on input#search_'.$htmlname.'");
|
console.log("Call change on input '.$htmlname.' because of select definition of autocomplete select call on input#search_'.$htmlname.'");
|
||||||
$("#'.$htmlname.'").val(ui.item.id).trigger("change"); // Select new value
|
console.log("Selected id = "+ui.item.id+" - If this value is null, it means you select a record with key that is null so selection is not effective");
|
||||||
|
$("#'.$htmlname.'").val(ui.item.id).trigger("change"); // Select new value
|
||||||
// Disable an element
|
// Disable an element
|
||||||
if (options.option_disabled) {
|
if (options.option_disabled) {
|
||||||
if (ui.item.disabled) {
|
if (ui.item.disabled) {
|
||||||
@ -179,7 +180,7 @@ function ajax_autocompleter($selected, $htmlname, $url, $urloption='', $minLengt
|
|||||||
}
|
}
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
console.log("ajax_autocompleter new value selected, we trigger change on original component");
|
console.log("ajax_autocompleter new value selected, we trigger change on original component so field #search_'.$htmlname.'");
|
||||||
$("#search_'.$htmlname.'").trigger("change"); // We have changed value of the combo select, we must be sure to trigger all js hook binded on this event. This is required to trigger other javascript change method binded on original field by other code.
|
$("#search_'.$htmlname.'").trigger("change"); // We have changed value of the combo select, we must be sure to trigger all js hook binded on this event. This is required to trigger other javascript change method binded on original field by other code.
|
||||||
}
|
}
|
||||||
,delay: 500
|
,delay: 500
|
||||||
|
|||||||
@ -89,6 +89,46 @@ class Fichinter extends CommonObject
|
|||||||
$this->statuts_logo[3]='statut4';
|
$this->statuts_logo[3]='statut4';
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Load indicators into this->nb for board
|
||||||
|
*
|
||||||
|
* @return int <0 if KO, >0 if OK
|
||||||
|
*/
|
||||||
|
function load_state_board()
|
||||||
|
{
|
||||||
|
global $user;
|
||||||
|
|
||||||
|
$this->nb=array();
|
||||||
|
$clause = "WHERE";
|
||||||
|
|
||||||
|
$sql = "SELECT count(fi.rowid) as nb";
|
||||||
|
$sql.= " FROM ".MAIN_DB_PREFIX."fichinter as fi";
|
||||||
|
$sql.= " LEFT JOIN ".MAIN_DB_PREFIX."societe as s ON fi.fk_soc = s.rowid";
|
||||||
|
if (!$user->rights->societe->client->voir && !$user->societe_id)
|
||||||
|
{
|
||||||
|
$sql.= " LEFT JOIN ".MAIN_DB_PREFIX."societe_commerciaux as sc ON s.rowid = sc.fk_soc";
|
||||||
|
$sql.= " WHERE sc.fk_user = " .$user->id;
|
||||||
|
$clause = "AND";
|
||||||
|
}
|
||||||
|
$sql.= " ".$clause." fi.entity IN (".getEntity($this->element, 1).")";
|
||||||
|
|
||||||
|
$resql=$this->db->query($sql);
|
||||||
|
if ($resql)
|
||||||
|
{
|
||||||
|
while ($obj=$this->db->fetch_object($resql))
|
||||||
|
{
|
||||||
|
$this->nb["fichinters"]=$obj->nb;
|
||||||
|
}
|
||||||
|
$this->db->free($resql);
|
||||||
|
return 1;
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
dol_print_error($this->db);
|
||||||
|
$this->error=$this->db->error();
|
||||||
|
return -1;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Create an intervention into data base
|
* Create an intervention into data base
|
||||||
|
|||||||
@ -162,6 +162,7 @@ if (empty($user->societe_id))
|
|||||||
! empty($conf->societe->enabled) && $user->rights->societe->lire && empty($conf->global->SOCIETE_DISABLE_CUSTOMERS) && empty($conf->global->SOCIETE_DISABLE_CUSTOMERS_STATS),
|
! empty($conf->societe->enabled) && $user->rights->societe->lire && empty($conf->global->SOCIETE_DISABLE_CUSTOMERS) && empty($conf->global->SOCIETE_DISABLE_CUSTOMERS_STATS),
|
||||||
! empty($conf->societe->enabled) && $user->rights->societe->lire && empty($conf->global->SOCIETE_DISABLE_PROSPECTS) && empty($conf->global->SOCIETE_DISABLE_PROSPECTS_STATS),
|
! empty($conf->societe->enabled) && $user->rights->societe->lire && empty($conf->global->SOCIETE_DISABLE_PROSPECTS) && empty($conf->global->SOCIETE_DISABLE_PROSPECTS_STATS),
|
||||||
! empty($conf->fournisseur->enabled) && $user->rights->fournisseur->lire && empty($conf->global->SOCIETE_DISABLE_SUPPLIERS_STATS),
|
! empty($conf->fournisseur->enabled) && $user->rights->fournisseur->lire && empty($conf->global->SOCIETE_DISABLE_SUPPLIERS_STATS),
|
||||||
|
! empty($conf->societe->enabled) && $user->rights->societe->contact->lire,
|
||||||
! empty($conf->adherent->enabled) && $user->rights->adherent->lire,
|
! empty($conf->adherent->enabled) && $user->rights->adherent->lire,
|
||||||
! empty($conf->product->enabled) && $user->rights->produit->lire,
|
! empty($conf->product->enabled) && $user->rights->produit->lire,
|
||||||
! empty($conf->service->enabled) && $user->rights->service->lire,
|
! empty($conf->service->enabled) && $user->rights->service->lire,
|
||||||
@ -169,6 +170,7 @@ if (empty($user->societe_id))
|
|||||||
! empty($conf->commande->enabled) && $user->rights->commande->lire,
|
! empty($conf->commande->enabled) && $user->rights->commande->lire,
|
||||||
! empty($conf->facture->enabled) && $user->rights->facture->lire,
|
! empty($conf->facture->enabled) && $user->rights->facture->lire,
|
||||||
! empty($conf->contrat->enabled) && $user->rights->contrat->activer,
|
! empty($conf->contrat->enabled) && $user->rights->contrat->activer,
|
||||||
|
! empty($conf->ficheinter->enabled) && $user->rights->ficheinter->lire,
|
||||||
! empty($conf->supplier_order->enabled) && $user->rights->fournisseur->commande->lire && empty($conf->global->SOCIETE_DISABLE_SUPPLIERS_ORDERS_STATS),
|
! empty($conf->supplier_order->enabled) && $user->rights->fournisseur->commande->lire && empty($conf->global->SOCIETE_DISABLE_SUPPLIERS_ORDERS_STATS),
|
||||||
! empty($conf->supplier_invoice->enabled) && $user->rights->fournisseur->facture->lire && empty($conf->global->SOCIETE_DISABLE_SUPPLIERS_INVOICES_STATS),
|
! empty($conf->supplier_invoice->enabled) && $user->rights->fournisseur->facture->lire && empty($conf->global->SOCIETE_DISABLE_SUPPLIERS_INVOICES_STATS),
|
||||||
! empty($conf->supplier_proposal->enabled) && $user->rights->supplier_proposal->lire && empty($conf->global->SOCIETE_DISABLE_SUPPLIERS_PROPOSAL_STATS),
|
! empty($conf->supplier_proposal->enabled) && $user->rights->supplier_proposal->lire && empty($conf->global->SOCIETE_DISABLE_SUPPLIERS_PROPOSAL_STATS),
|
||||||
@ -181,6 +183,7 @@ if (empty($user->societe_id))
|
|||||||
DOL_DOCUMENT_ROOT."/societe/class/client.class.php",
|
DOL_DOCUMENT_ROOT."/societe/class/client.class.php",
|
||||||
DOL_DOCUMENT_ROOT."/societe/class/client.class.php",
|
DOL_DOCUMENT_ROOT."/societe/class/client.class.php",
|
||||||
DOL_DOCUMENT_ROOT."/fourn/class/fournisseur.class.php",
|
DOL_DOCUMENT_ROOT."/fourn/class/fournisseur.class.php",
|
||||||
|
DOL_DOCUMENT_ROOT."/contact/class/contact.class.php",
|
||||||
DOL_DOCUMENT_ROOT."/adherents/class/adherent.class.php",
|
DOL_DOCUMENT_ROOT."/adherents/class/adherent.class.php",
|
||||||
DOL_DOCUMENT_ROOT."/product/class/product.class.php",
|
DOL_DOCUMENT_ROOT."/product/class/product.class.php",
|
||||||
DOL_DOCUMENT_ROOT."/product/class/service.class.php",
|
DOL_DOCUMENT_ROOT."/product/class/service.class.php",
|
||||||
@ -188,6 +191,7 @@ if (empty($user->societe_id))
|
|||||||
DOL_DOCUMENT_ROOT."/commande/class/commande.class.php",
|
DOL_DOCUMENT_ROOT."/commande/class/commande.class.php",
|
||||||
DOL_DOCUMENT_ROOT."/compta/facture/class/facture.class.php",
|
DOL_DOCUMENT_ROOT."/compta/facture/class/facture.class.php",
|
||||||
DOL_DOCUMENT_ROOT."/contrat/class/contrat.class.php",
|
DOL_DOCUMENT_ROOT."/contrat/class/contrat.class.php",
|
||||||
|
DOL_DOCUMENT_ROOT."/fichinter/class/fichinter.class.php",
|
||||||
DOL_DOCUMENT_ROOT."/fourn/class/fournisseur.commande.class.php",
|
DOL_DOCUMENT_ROOT."/fourn/class/fournisseur.commande.class.php",
|
||||||
DOL_DOCUMENT_ROOT."/fourn/class/fournisseur.facture.class.php",
|
DOL_DOCUMENT_ROOT."/fourn/class/fournisseur.facture.class.php",
|
||||||
DOL_DOCUMENT_ROOT."/supplier_proposal/class/supplier_proposal.class.php",
|
DOL_DOCUMENT_ROOT."/supplier_proposal/class/supplier_proposal.class.php",
|
||||||
@ -199,6 +203,7 @@ if (empty($user->societe_id))
|
|||||||
'Client',
|
'Client',
|
||||||
'Client',
|
'Client',
|
||||||
'Fournisseur',
|
'Fournisseur',
|
||||||
|
'Contact',
|
||||||
'Adherent',
|
'Adherent',
|
||||||
'Product',
|
'Product',
|
||||||
'Service',
|
'Service',
|
||||||
@ -206,6 +211,7 @@ if (empty($user->societe_id))
|
|||||||
'Commande',
|
'Commande',
|
||||||
'Facture',
|
'Facture',
|
||||||
'Contrat',
|
'Contrat',
|
||||||
|
'Fichinter',
|
||||||
'CommandeFournisseur',
|
'CommandeFournisseur',
|
||||||
'FactureFournisseur',
|
'FactureFournisseur',
|
||||||
'SupplierProposal',
|
'SupplierProposal',
|
||||||
@ -217,6 +223,7 @@ if (empty($user->societe_id))
|
|||||||
'customers',
|
'customers',
|
||||||
'prospects',
|
'prospects',
|
||||||
'suppliers',
|
'suppliers',
|
||||||
|
'contacts',
|
||||||
'members',
|
'members',
|
||||||
'products',
|
'products',
|
||||||
'services',
|
'services',
|
||||||
@ -224,6 +231,7 @@ if (empty($user->societe_id))
|
|||||||
'orders',
|
'orders',
|
||||||
'invoices',
|
'invoices',
|
||||||
'Contracts',
|
'Contracts',
|
||||||
|
'fichinters',
|
||||||
'supplier_orders',
|
'supplier_orders',
|
||||||
'supplier_invoices',
|
'supplier_invoices',
|
||||||
'askprice',
|
'askprice',
|
||||||
@ -235,6 +243,7 @@ if (empty($user->societe_id))
|
|||||||
'company',
|
'company',
|
||||||
'company',
|
'company',
|
||||||
'company',
|
'company',
|
||||||
|
'contact',
|
||||||
'user',
|
'user',
|
||||||
'product',
|
'product',
|
||||||
'service',
|
'service',
|
||||||
@ -243,6 +252,7 @@ if (empty($user->societe_id))
|
|||||||
'bill',
|
'bill',
|
||||||
'order',
|
'order',
|
||||||
'order',
|
'order',
|
||||||
|
'order',
|
||||||
'bill',
|
'bill',
|
||||||
'propal',
|
'propal',
|
||||||
'trip',
|
'trip',
|
||||||
@ -253,6 +263,7 @@ if (empty($user->societe_id))
|
|||||||
"ThirdPartyCustomersStats",
|
"ThirdPartyCustomersStats",
|
||||||
"ThirdPartyProspectsStats",
|
"ThirdPartyProspectsStats",
|
||||||
"Suppliers",
|
"Suppliers",
|
||||||
|
"Contacts",
|
||||||
"Members",
|
"Members",
|
||||||
"Products",
|
"Products",
|
||||||
"Services",
|
"Services",
|
||||||
@ -260,6 +271,7 @@ if (empty($user->societe_id))
|
|||||||
"CustomersOrders",
|
"CustomersOrders",
|
||||||
"BillsCustomers",
|
"BillsCustomers",
|
||||||
"Contracts",
|
"Contracts",
|
||||||
|
"Interventions",
|
||||||
"SuppliersOrders",
|
"SuppliersOrders",
|
||||||
"SuppliersInvoices",
|
"SuppliersInvoices",
|
||||||
"SupplierProposalShort",
|
"SupplierProposalShort",
|
||||||
@ -272,6 +284,7 @@ if (empty($user->societe_id))
|
|||||||
DOL_URL_ROOT.'/societe/list.php?type=c',
|
DOL_URL_ROOT.'/societe/list.php?type=c',
|
||||||
DOL_URL_ROOT.'/societe/list.php?type=p',
|
DOL_URL_ROOT.'/societe/list.php?type=p',
|
||||||
DOL_URL_ROOT.'/societe/list.php?type=f',
|
DOL_URL_ROOT.'/societe/list.php?type=f',
|
||||||
|
DOL_URL_ROOT.'/contact/list.php',
|
||||||
DOL_URL_ROOT.'/adherents/list.php?statut=1&mainmenu=members',
|
DOL_URL_ROOT.'/adherents/list.php?statut=1&mainmenu=members',
|
||||||
DOL_URL_ROOT.'/product/list.php?type=0&mainmenu=products',
|
DOL_URL_ROOT.'/product/list.php?type=0&mainmenu=products',
|
||||||
DOL_URL_ROOT.'/product/list.php?type=1&mainmenu=products',
|
DOL_URL_ROOT.'/product/list.php?type=1&mainmenu=products',
|
||||||
@ -279,6 +292,7 @@ if (empty($user->societe_id))
|
|||||||
DOL_URL_ROOT.'/commande/list.php?mainmenu=commercial',
|
DOL_URL_ROOT.'/commande/list.php?mainmenu=commercial',
|
||||||
DOL_URL_ROOT.'/compta/facture/list.php?mainmenu=accountancy',
|
DOL_URL_ROOT.'/compta/facture/list.php?mainmenu=accountancy',
|
||||||
DOL_URL_ROOT.'/contrat/list.php',
|
DOL_URL_ROOT.'/contrat/list.php',
|
||||||
|
DOL_URL_ROOT.'/fichinter/list.php',
|
||||||
DOL_URL_ROOT.'/fourn/commande/list.php',
|
DOL_URL_ROOT.'/fourn/commande/list.php',
|
||||||
DOL_URL_ROOT.'/fourn/facture/list.php',
|
DOL_URL_ROOT.'/fourn/facture/list.php',
|
||||||
DOL_URL_ROOT.'/supplier_proposal/list.php',
|
DOL_URL_ROOT.'/supplier_proposal/list.php',
|
||||||
@ -290,6 +304,7 @@ if (empty($user->societe_id))
|
|||||||
"companies",
|
"companies",
|
||||||
"prospects",
|
"prospects",
|
||||||
"suppliers",
|
"suppliers",
|
||||||
|
"companies",
|
||||||
"members",
|
"members",
|
||||||
"products",
|
"products",
|
||||||
"produts",
|
"produts",
|
||||||
@ -298,6 +313,7 @@ if (empty($user->societe_id))
|
|||||||
"bills",
|
"bills",
|
||||||
"supplier_proposal",
|
"supplier_proposal",
|
||||||
"contracts",
|
"contracts",
|
||||||
|
"interventions",
|
||||||
"trips",
|
"trips",
|
||||||
"projects"
|
"projects"
|
||||||
);
|
);
|
||||||
|
|||||||
29
htdocs/install/mysql/data/llx_accounting_category.sql
Normal file
29
htdocs/install/mysql/data/llx_accounting_category.sql
Normal file
@ -0,0 +1,29 @@
|
|||||||
|
-- Copyright (C) 2016 Alexandre Spangaro <aspangaro.dolibarr@gmail.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
|
||||||
|
-- the Free Software Foundation; either version 3 of the License, or
|
||||||
|
-- (at your option) any later version.
|
||||||
|
--
|
||||||
|
-- This program is distributed in the hope that it will be useful,
|
||||||
|
-- but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||||
|
-- MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||||
|
-- GNU General Public License for more details.
|
||||||
|
--
|
||||||
|
-- You should have received a copy of the GNU General Public License
|
||||||
|
-- along with this program. If not, see <http://www.gnu.org/licenses/>.
|
||||||
|
--
|
||||||
|
--
|
||||||
|
|
||||||
|
--
|
||||||
|
-- Ne pas placer de commentaire en fin de ligne, ce fichier est parsé lors
|
||||||
|
-- de l'install et tous les sigles '--' sont supprimés.
|
||||||
|
--
|
||||||
|
|
||||||
|
--
|
||||||
|
-- Categories compte de résultat Français
|
||||||
|
--
|
||||||
|
|
||||||
|
INSERT INTO llx_c_accounting_category (rowid, code, label, range_account, sens, category_type, formula, position, fk_country, active) VALUES ( 1,'VTE','Ventes de marchandises', '707xxx', 0, 0, '', '10', 1, 1);
|
||||||
|
INSERT INTO llx_c_accounting_category (rowid, code, label, range_account, sens, category_type, formula, position, fk_country, active) VALUES ( 2,'MAR','Coût d\'achats marchandises vendues', '603xxx | 607xxx | 609xxx', 0, 0, '', '20', 1, 1);
|
||||||
|
INSERT INTO llx_c_accounting_category (rowid, code, label, range_account, sens, category_type, formula, position, fk_country, active) VALUES ( 3,'MARGE','Marge commerciale', '', 0, 1, '1 + 2', '30', 1, 1);
|
||||||
@ -66,6 +66,8 @@ ALTER TABLE llx_product ADD COLUMN height_units tinyint DEFAULT NULL;
|
|||||||
|
|
||||||
ALTER TABLE llx_product ADD COLUMN default_vat_code varchar(10) after cost_price;
|
ALTER TABLE llx_product ADD COLUMN default_vat_code varchar(10) after cost_price;
|
||||||
|
|
||||||
|
ALTER TABLE llx_product MODIFY COLUMN stock real;
|
||||||
|
|
||||||
CREATE TABLE llx_categorie_user
|
CREATE TABLE llx_categorie_user
|
||||||
(
|
(
|
||||||
fk_categorie integer NOT NULL,
|
fk_categorie integer NOT NULL,
|
||||||
@ -303,19 +305,15 @@ ALTER TABLE llx_contratdet ADD COLUMN multicurrency_total_ht double(24,8) DEFAUL
|
|||||||
ALTER TABLE llx_contratdet ADD COLUMN multicurrency_total_tva double(24,8) DEFAULT 0;
|
ALTER TABLE llx_contratdet ADD COLUMN multicurrency_total_tva double(24,8) DEFAULT 0;
|
||||||
ALTER TABLE llx_contratdet ADD COLUMN multicurrency_total_ttc double(24,8) DEFAULT 0;
|
ALTER TABLE llx_contratdet ADD COLUMN multicurrency_total_ttc double(24,8) DEFAULT 0;
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
ALTER TABLE llx_paiement ADD COLUMN multicurrency_amount double(24,8) DEFAULT 0;
|
ALTER TABLE llx_paiement ADD COLUMN multicurrency_amount double(24,8) DEFAULT 0;
|
||||||
ALTER TABLE llx_paiement_facture ADD COLUMN multicurrency_amount double(24,8) DEFAULT 0;
|
ALTER TABLE llx_paiement_facture ADD COLUMN multicurrency_amount double(24,8) DEFAULT 0;
|
||||||
ALTER TABLE llx_paiementfourn ADD COLUMN multicurrency_amount double(24,8) DEFAULT 0;
|
ALTER TABLE llx_paiementfourn ADD COLUMN multicurrency_amount double(24,8) DEFAULT 0;
|
||||||
ALTER TABLE llx_paiementfourn_facturefourn ADD COLUMN multicurrency_amount double(24,8) DEFAULT 0;
|
ALTER TABLE llx_paiementfourn_facturefourn ADD COLUMN multicurrency_amount double(24,8) DEFAULT 0;
|
||||||
|
|
||||||
ALTER TABLE llx_societe_remise_except ADD COLUMN multicurrency_amount_ht double(24,8) NOT NULL;
|
ALTER TABLE llx_societe_remise_except ADD COLUMN multicurrency_amount_ht double(24,8) DEFAULT 0 NOT NULL;
|
||||||
ALTER TABLE llx_societe_remise_except ADD COLUMN multicurrency_amount_tva double(24,8) DEFAULT 0 NOT NULL;
|
ALTER TABLE llx_societe_remise_except ADD COLUMN multicurrency_amount_tva double(24,8) DEFAULT 0 NOT NULL;
|
||||||
ALTER TABLE llx_societe_remise_except ADD COLUMN multicurrency_amount_ttc double(24,8) DEFAULT 0 NOT NULL;
|
ALTER TABLE llx_societe_remise_except ADD COLUMN multicurrency_amount_ttc double(24,8) DEFAULT 0 NOT NULL;
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
ALTER TABLE llx_supplier_proposal ADD COLUMN fk_multicurrency integer;
|
ALTER TABLE llx_supplier_proposal ADD COLUMN fk_multicurrency integer;
|
||||||
ALTER TABLE llx_supplier_proposal ADD COLUMN multicurrency_code varchar(255);
|
ALTER TABLE llx_supplier_proposal ADD COLUMN multicurrency_code varchar(255);
|
||||||
ALTER TABLE llx_supplier_proposal ADD COLUMN multicurrency_tx double(24,8) DEFAULT 1;
|
ALTER TABLE llx_supplier_proposal ADD COLUMN multicurrency_tx double(24,8) DEFAULT 1;
|
||||||
@ -366,11 +364,18 @@ CREATE TABLE llx_c_accounting_category (
|
|||||||
) ENGINE=innodb;
|
) ENGINE=innodb;
|
||||||
|
|
||||||
ALTER TABLE llx_c_accounting_category ADD UNIQUE INDEX uk_c_accounting_category(code);
|
ALTER TABLE llx_c_accounting_category ADD UNIQUE INDEX uk_c_accounting_category(code);
|
||||||
|
|
||||||
|
INSERT INTO llx_c_accounting_category (rowid, code, label, range_account, sens, category_type, formula, position, fk_country, active) VALUES ( 1,'VTE',"Ventes de marchandises", '707xxx', 0, 0, '', '10', 1, 1);
|
||||||
|
INSERT INTO llx_c_accounting_category (rowid, code, label, range_account, sens, category_type, formula, position, fk_country, active) VALUES ( 2,'MAR',"Coût d'achats marchandises vendues", '603xxx | 607xxx | 609xxx', 0, 0, '', '20', 1, 1);
|
||||||
|
INSERT INTO llx_c_accounting_category (rowid, code, label, range_account, sens, category_type, formula, position, fk_country, active) VALUES ( 3,'MARGE',"Marge commerciale", '', 0, 1, '1 + 2', '30', 1, 1);
|
||||||
|
|
||||||
UPDATE llx_accounting_account SET account_parent = '0' WHERE account_parent = '';
|
UPDATE llx_accounting_account SET account_parent = '0' WHERE account_parent = '';
|
||||||
ALTER TABLE llx_accounting_account MODIFY COLUMN account_parent integer DEFAULT 0;
|
-- VMYSQL4.1 ALTER TABLE llx_accounting_account MODIFY COLUMN account_parent integer DEFAULT 0;
|
||||||
|
-- VPGSQL8.2 ALTER TABLE llx_accounting_account ALTER COLUMN account_parent TYPE integer USING account_parent::integer;
|
||||||
|
|
||||||
|
|
||||||
DROP INDEX uk_bordereau_cheque ON llx_bordereau_cheque;
|
-- VMYSQL4.1 DROP INDEX uk_bordereau_cheque ON llx_bordereau_cheque;
|
||||||
|
-- VPGSQL8.2 DROP INDEX uk_bordereau_cheque;
|
||||||
ALTER TABLE llx_bordereau_cheque CHANGE COLUMN number ref VARCHAR(30) NOT NULL;
|
ALTER TABLE llx_bordereau_cheque CHANGE COLUMN number ref VARCHAR(30) NOT NULL;
|
||||||
CREATE UNIQUE INDEX uk_bordereau_cheque ON llx_bordereau_cheque (ref, entity);
|
CREATE UNIQUE INDEX uk_bordereau_cheque ON llx_bordereau_cheque (ref, entity);
|
||||||
|
|
||||||
|
|||||||
@ -29,7 +29,7 @@ create table llx_accounting_account
|
|||||||
pcg_type varchar(20) NOT NULL,
|
pcg_type varchar(20) NOT NULL,
|
||||||
pcg_subtype varchar(20) NOT NULL,
|
pcg_subtype varchar(20) NOT NULL,
|
||||||
account_number varchar(32) NOT NULL,
|
account_number varchar(32) NOT NULL,
|
||||||
account_parent integer, -- Hierarchic parent
|
account_parent integer DEFAULT 0, -- Hierarchic parent
|
||||||
label varchar(255) NOT NULL,
|
label varchar(255) NOT NULL,
|
||||||
fk_accounting_category integer DEFAULT 0,
|
fk_accounting_category integer DEFAULT 0,
|
||||||
fk_user_author integer DEFAULT NULL,
|
fk_user_author integer DEFAULT NULL,
|
||||||
|
|||||||
@ -79,7 +79,7 @@ create table llx_product
|
|||||||
surface_units tinyint DEFAULT NULL,
|
surface_units tinyint DEFAULT NULL,
|
||||||
volume float DEFAULT NULL,
|
volume float DEFAULT NULL,
|
||||||
volume_units tinyint DEFAULT NULL,
|
volume_units tinyint DEFAULT NULL,
|
||||||
stock integer, -- Current physical stock (dernormalized field)
|
stock real, -- Current physical stock (dernormalized field)
|
||||||
pmp double(24,8) DEFAULT 0 NOT NULL, -- To store valuation of stock calculated using average price method, for this product
|
pmp double(24,8) DEFAULT 0 NOT NULL, -- To store valuation of stock calculated using average price method, for this product
|
||||||
fifo double(24,8), -- To store valuation of stock calculated using fifo method, for this product
|
fifo double(24,8), -- To store valuation of stock calculated using fifo method, for this product
|
||||||
lifo double(24,8), -- To store valuation of stock calculated using lifo method, for this product
|
lifo double(24,8), -- To store valuation of stock calculated using lifo method, for this product
|
||||||
|
|||||||
@ -33,7 +33,7 @@ create table llx_societe_remise_except
|
|||||||
fk_facture integer,
|
fk_facture integer,
|
||||||
fk_facture_source integer,
|
fk_facture_source integer,
|
||||||
description text NOT NULL,
|
description text NOT NULL,
|
||||||
multicurrency_amount_ht double(24,8) NOT NULL,
|
multicurrency_amount_ht double(24,8) DEFAULT 0 NOT NULL,
|
||||||
multicurrency_amount_tva double(24,8) DEFAULT 0 NOT NULL,
|
multicurrency_amount_tva double(24,8) DEFAULT 0 NOT NULL,
|
||||||
multicurrency_amount_ttc double(24,8) DEFAULT 0 NOT NULL
|
multicurrency_amount_ttc double(24,8) DEFAULT 0 NOT NULL
|
||||||
)ENGINE=innodb;
|
)ENGINE=innodb;
|
||||||
|
|||||||
@ -24,8 +24,8 @@ create table llx_stock_mouvement
|
|||||||
datem datetime, -- Date and hour of movement
|
datem datetime, -- Date and hour of movement
|
||||||
fk_product integer NOT NULL, -- Id of product
|
fk_product integer NOT NULL, -- Id of product
|
||||||
batch varchar(30) DEFAULT NULL, -- Lot or serial number
|
batch varchar(30) DEFAULT NULL, -- Lot or serial number
|
||||||
eatby date DEFAULT NULL, -- Eatby date
|
eatby date DEFAULT NULL, -- Eatby date (deprecated, we should get value from batch number in table llx_product_lot)
|
||||||
sellby date DEFAULT NULL, -- Sellby date
|
sellby date DEFAULT NULL, -- Sellby date (deprecated, we should get value from batch number in table llx_product_lot)
|
||||||
fk_entrepot integer NOT NULL, -- Id warehouse
|
fk_entrepot integer NOT NULL, -- Id warehouse
|
||||||
value real, -- Qty of movement
|
value real, -- Qty of movement
|
||||||
price double(24,8) DEFAULT 0, -- Entry price (used to calculate PMP, FIFO or LIFO value)
|
price double(24,8) DEFAULT 0, -- Entry price (used to calculate PMP, FIFO or LIFO value)
|
||||||
|
|||||||
@ -174,6 +174,9 @@ OptionModeProductBuyDesc=Show all products with no accounting account defined fo
|
|||||||
|
|
||||||
## Dictionary
|
## Dictionary
|
||||||
Range=Range of accounting account
|
Range=Range of accounting account
|
||||||
|
Sens=Sens
|
||||||
|
Calculated=Calculated
|
||||||
|
Formula=Formula
|
||||||
|
|
||||||
## Error
|
## Error
|
||||||
ErrorNoAccountingCategoryForThisCountry=No accounting category are available for this country
|
ErrorNoAccountingCategoryForThisCountry=No accounting category are available for this country
|
||||||
@ -59,6 +59,8 @@ SpecialExpensesArea=Area for all special payments
|
|||||||
TaxAndDividendsArea=Sale taxes, social/fiscal taxes contributions and dividends area
|
TaxAndDividendsArea=Sale taxes, social/fiscal taxes contributions and dividends area
|
||||||
SocialContribution=Social or fiscal tax
|
SocialContribution=Social or fiscal tax
|
||||||
SocialContributions=Social or fiscal taxes
|
SocialContributions=Social or fiscal taxes
|
||||||
|
SocialContributionsDeductibles=Deductible social or fiscal taxes
|
||||||
|
SocialContributionsNondeductibles=Nondeductible social or fiscal taxes
|
||||||
MenuSpecialExpenses=Special expenses
|
MenuSpecialExpenses=Special expenses
|
||||||
MenuTaxAndDividends=Taxes and dividends
|
MenuTaxAndDividends=Taxes and dividends
|
||||||
MenuSalaries=Salaries
|
MenuSalaries=Salaries
|
||||||
|
|||||||
@ -8,12 +8,12 @@
|
|||||||
* Copyright (C) 2010-2015 Juanjo Menent <jmenent@2byte.es>
|
* Copyright (C) 2010-2015 Juanjo Menent <jmenent@2byte.es>
|
||||||
* Copyright (C) 2013-2014 Marcos García <marcosgdf@gmail.com>
|
* Copyright (C) 2013-2014 Marcos García <marcosgdf@gmail.com>
|
||||||
* Copyright (C) 2012-2013 Cédric Salvador <csalvador@gpcsolutions.fr>
|
* Copyright (C) 2012-2013 Cédric Salvador <csalvador@gpcsolutions.fr>
|
||||||
* Copyright (C) 2011-2015 Alexandre Spangaro <aspangaro.dolibarr@gmail.com>
|
* Copyright (C) 2011-2016 Alexandre Spangaro <aspangaro.dolibarr@gmail.com>
|
||||||
* Copyright (C) 2014 Cédric Gross <c.gross@kreiz-it.fr>
|
* Copyright (C) 2014 Cédric Gross <c.gross@kreiz-it.fr>
|
||||||
* Copyright (C) 2014-2015 Ferran Marcet <fmarcet@2byte.es>
|
* Copyright (C) 2014-2015 Ferran Marcet <fmarcet@2byte.es>
|
||||||
* Copyright (C) 2015 Jean-François Ferry <jfefe@aternatik.fr>
|
* Copyright (C) 2015 Jean-François Ferry <jfefe@aternatik.fr>
|
||||||
* Copyright (C) 2015 Raphaël Doursenaud <rdoursenaud@gpcsolutions.fr>
|
* Copyright (C) 2015 Raphaël Doursenaud <rdoursenaud@gpcsolutions.fr>
|
||||||
* Copyright (C) 2016 Charlie Benke <charlie@patas-monkey.com>
|
* Copyright (C) 2016 Charlie Benke <charlie@patas-monkey.com>
|
||||||
*
|
*
|
||||||
* This program is free software; you can redistribute it and/or modify
|
* 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
|
* it under the terms of the GNU General Public License as published by
|
||||||
@ -1476,24 +1476,26 @@ else
|
|||||||
}
|
}
|
||||||
|
|
||||||
// Accountancy sell code
|
// Accountancy sell code
|
||||||
if (! empty($conf->accounting->enabled)){
|
print '<tr><td class="nowrap">';
|
||||||
print '<tr><td class="nowrap">';
|
print $langs->trans("ProductAccountancySellCode");
|
||||||
print $langs->trans("ProductAccountancySellCode");
|
print '</td><td colspan="2">';
|
||||||
print '</td><td colspan="2">';
|
if (! empty($conf->accounting->enabled)) {
|
||||||
print length_accountg($object->accountancy_code_sell);
|
print length_accountg($object->accountancy_code_sell);
|
||||||
print '</td></tr>';
|
} else {
|
||||||
}
|
print $object->accountancy_code_sell;
|
||||||
|
}
|
||||||
|
print '</td></tr>';
|
||||||
|
|
||||||
// Accountancy buy code
|
// Accountancy buy code
|
||||||
if (! empty($conf->accounting->enabled)){
|
print '<tr><td class="nowrap">';
|
||||||
print '<tr><td class="nowrap">';
|
print $langs->trans("ProductAccountancyBuyCode");
|
||||||
print $langs->trans("ProductAccountancyBuyCode");
|
print '</td><td colspan="2">';
|
||||||
print '</td><td colspan="2">';
|
if (! empty($conf->accounting->enabled)) {
|
||||||
print length_accountg($object->accountancy_code_buy);
|
print length_accountg($object->accountancy_code_buy);
|
||||||
print '</td></tr>';
|
} else {
|
||||||
}
|
print $object->accountancy_code_buy;
|
||||||
|
}
|
||||||
|
print '</td></tr>';
|
||||||
|
|
||||||
// Status (to sell)
|
// Status (to sell)
|
||||||
/*
|
/*
|
||||||
|
|||||||
@ -1850,7 +1850,7 @@ class Product extends CommonObject
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
// We should not load stock at each fetch. If someone need stock, he must call load_stock after fetch.
|
// We should not load stock during the fetch. If someone need stock of product, he must call load_stock after fetching product.
|
||||||
//$res=$this->load_stock();
|
//$res=$this->load_stock();
|
||||||
// instead we just init the stock_warehouse array
|
// instead we just init the stock_warehouse array
|
||||||
$this->stock_warehouse = array();
|
$this->stock_warehouse = array();
|
||||||
@ -2847,7 +2847,7 @@ class Product extends CommonObject
|
|||||||
|
|
||||||
//print "XXX We add id=".$id." - label=".$label." - nb=".$nb." - multiply=".$multiply." fullpath=".$compl_path.$label."\n";
|
//print "XXX We add id=".$id." - label=".$label." - nb=".$nb." - multiply=".$multiply." fullpath=".$compl_path.$label."\n";
|
||||||
$this->fetch($id); // Load product
|
$this->fetch($id); // Load product
|
||||||
$this->load_stock(); // Load stock
|
$this->load_stock('nobatch,novirtual'); // Load stock to get true this->stock_reel
|
||||||
$this->res[]= array(
|
$this->res[]= array(
|
||||||
'id'=>$id, // Id product
|
'id'=>$id, // Id product
|
||||||
'id_parent'=>$id_parent,
|
'id_parent'=>$id_parent,
|
||||||
|
|||||||
@ -103,6 +103,13 @@ if ($type=='0') $result=restrictedArea($user,'produit','','','','','',$objcanvas
|
|||||||
else if ($type=='1') $result=restrictedArea($user,'service','','','','','',$objcanvas);
|
else if ($type=='1') $result=restrictedArea($user,'service','','','','','',$objcanvas);
|
||||||
else $result=restrictedArea($user,'produit|service','','','','','',$objcanvas);
|
else $result=restrictedArea($user,'produit|service','','','','','',$objcanvas);
|
||||||
|
|
||||||
|
// Define virtualdiffersfromphysical
|
||||||
|
$virtualdiffersfromphysical=0;
|
||||||
|
if (! empty($conf->global->STOCK_CALCULATE_ON_SHIPMENT) || ! empty($conf->global->STOCK_CALCULATE_ON_SUPPLIER_DISPATCH_ORDER))
|
||||||
|
{
|
||||||
|
$virtualdiffersfromphysical=1; // According to increase/decrease stock options, virtual and physical stock may differs.
|
||||||
|
}
|
||||||
|
|
||||||
// List of fields to search into when doing a "search in all"
|
// List of fields to search into when doing a "search in all"
|
||||||
$fieldstosearchall = array(
|
$fieldstosearchall = array(
|
||||||
'p.ref'=>"Ref",
|
'p.ref'=>"Ref",
|
||||||
@ -142,8 +149,9 @@ $arrayfields=array(
|
|||||||
'p.minbuyprice'=>array('label'=>$langs->trans("BuyingPriceMinShort"), 'checked'=>1, 'enabled'=>(! empty($user->rights->fournisseur->lire))),
|
'p.minbuyprice'=>array('label'=>$langs->trans("BuyingPriceMinShort"), 'checked'=>1, 'enabled'=>(! empty($user->rights->fournisseur->lire))),
|
||||||
'p.seuil_stock_alerte'=>array('label'=>$langs->trans("StockLimit"), 'checked'=>0, 'enabled'=>(! empty($conf->stock->enabled) && $user->rights->stock->lire && $contextpage != 'service')),
|
'p.seuil_stock_alerte'=>array('label'=>$langs->trans("StockLimit"), 'checked'=>0, 'enabled'=>(! empty($conf->stock->enabled) && $user->rights->stock->lire && $contextpage != 'service')),
|
||||||
'p.desiredstock'=>array('label'=>$langs->trans("DesiredStock"), 'checked'=>1, 'enabled'=>(! empty($conf->stock->enabled) && $user->rights->stock->lire && $contextpage != 'service')),
|
'p.desiredstock'=>array('label'=>$langs->trans("DesiredStock"), 'checked'=>1, 'enabled'=>(! empty($conf->stock->enabled) && $user->rights->stock->lire && $contextpage != 'service')),
|
||||||
'p.tobatch'=>array('label'=>$langs->trans("ManageLotSerial"), 'checked'=>0, 'enabled'=>(! empty($conf->productbatch->enabled))),
|
|
||||||
'p.stock'=>array('label'=>$langs->trans("PhysicalStock"), 'checked'=>1, 'enabled'=>(! empty($conf->stock->enabled) && $user->rights->stock->lire && $contextpage != 'service')),
|
'p.stock'=>array('label'=>$langs->trans("PhysicalStock"), 'checked'=>1, 'enabled'=>(! empty($conf->stock->enabled) && $user->rights->stock->lire && $contextpage != 'service')),
|
||||||
|
'stock_virtual'=>array('label'=>$langs->trans("VirtualStock"), 'checked'=>1, 'enabled'=>(! empty($conf->stock->enabled) && $user->rights->stock->lire && $contextpage != 'service' && $virtualdiffersfromphysical)),
|
||||||
|
'p.tobatch'=>array('label'=>$langs->trans("ManageLotSerial"), 'checked'=>0, 'enabled'=>(! empty($conf->productbatch->enabled))),
|
||||||
'p.accountancy_code_sell'=>array('label'=>$langs->trans("ProductAccountancySellCode"), 'checked'=>0),
|
'p.accountancy_code_sell'=>array('label'=>$langs->trans("ProductAccountancySellCode"), 'checked'=>0),
|
||||||
'p.accountancy_code_buy'=>array('label'=>$langs->trans("ProductAccountancyBuyCode"), 'checked'=>0),
|
'p.accountancy_code_buy'=>array('label'=>$langs->trans("ProductAccountancyBuyCode"), 'checked'=>0),
|
||||||
'p.datec'=>array('label'=>$langs->trans("DateCreation"), 'checked'=>0, 'position'=>500),
|
'p.datec'=>array('label'=>$langs->trans("DateCreation"), 'checked'=>0, 'position'=>500),
|
||||||
@ -160,6 +168,7 @@ if (is_array($extrafields->attribute_label) && count($extrafields->attribute_lab
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* Actions
|
* Actions
|
||||||
@ -428,8 +437,9 @@ else
|
|||||||
if (! empty($arrayfields['p.minbuyprice']['checked'])) print_liste_field_titre($arrayfields['p.minbuyprice']['label'], $_SERVER["PHP_SELF"],"","",$param,'align="right"',$sortfield,$sortorder);
|
if (! empty($arrayfields['p.minbuyprice']['checked'])) print_liste_field_titre($arrayfields['p.minbuyprice']['label'], $_SERVER["PHP_SELF"],"","",$param,'align="right"',$sortfield,$sortorder);
|
||||||
if (! empty($arrayfields['p.seuil_stock_alerte']['checked'])) print_liste_field_titre($arrayfields['p.seuil_stock_alerte']['label'], $_SERVER["PHP_SELF"],"p.seuil_stock_alerte","",$param,'align="right"',$sortfield,$sortorder);
|
if (! empty($arrayfields['p.seuil_stock_alerte']['checked'])) print_liste_field_titre($arrayfields['p.seuil_stock_alerte']['label'], $_SERVER["PHP_SELF"],"p.seuil_stock_alerte","",$param,'align="right"',$sortfield,$sortorder);
|
||||||
if (! empty($arrayfields['p.desiredstock']['checked'])) print_liste_field_titre($arrayfields['p.desiredstock']['label'], $_SERVER["PHP_SELF"],"p.desiredstock","",$param,'align="right"',$sortfield,$sortorder);
|
if (! empty($arrayfields['p.desiredstock']['checked'])) print_liste_field_titre($arrayfields['p.desiredstock']['label'], $_SERVER["PHP_SELF"],"p.desiredstock","",$param,'align="right"',$sortfield,$sortorder);
|
||||||
if (! empty($arrayfields['p.tobatch']['checked'])) print_liste_field_titre($arrayfields['p.tobatch']['label'], $_SERVER["PHP_SELF"],"p.tobatch","",$param,'align="center"',$sortfield,$sortorder);
|
|
||||||
if (! empty($arrayfields['p.stock']['checked'])) print_liste_field_titre($arrayfields['p.stock']['label'], $_SERVER["PHP_SELF"],"p.stock","",$param,'align="right"',$sortfield,$sortorder);
|
if (! empty($arrayfields['p.stock']['checked'])) print_liste_field_titre($arrayfields['p.stock']['label'], $_SERVER["PHP_SELF"],"p.stock","",$param,'align="right"',$sortfield,$sortorder);
|
||||||
|
if (! empty($arrayfields['stock_virtual']['checked'])) print_liste_field_titre($arrayfields['stock_virtual']['label'], $_SERVER["PHP_SELF"],"","",$param,'align="right"',$sortfield,$sortorder);
|
||||||
|
if (! empty($arrayfields['p.tobatch']['checked'])) print_liste_field_titre($arrayfields['p.tobatch']['label'], $_SERVER["PHP_SELF"],"p.tobatch","",$param,'align="center"',$sortfield,$sortorder);
|
||||||
if (! empty($arrayfields['p.accountancy_code_sell']['checked'])) print_liste_field_titre($arrayfields['p.accountancy_code_sell']['label'], $_SERVER["PHP_SELF"],"p.accountancy_code_sell","",$param,'',$sortfield,$sortorder);
|
if (! empty($arrayfields['p.accountancy_code_sell']['checked'])) print_liste_field_titre($arrayfields['p.accountancy_code_sell']['label'], $_SERVER["PHP_SELF"],"p.accountancy_code_sell","",$param,'',$sortfield,$sortorder);
|
||||||
if (! empty($arrayfields['p.accountancy_code_buy']['checked'])) print_liste_field_titre($arrayfields['p.accountancy_code_buy']['label'], $_SERVER["PHP_SELF"],"p.accountancy_code_buy","",$param,'',$sortfield,$sortorder);
|
if (! empty($arrayfields['p.accountancy_code_buy']['checked'])) print_liste_field_titre($arrayfields['p.accountancy_code_buy']['label'], $_SERVER["PHP_SELF"],"p.accountancy_code_buy","",$param,'',$sortfield,$sortorder);
|
||||||
if (is_array($extrafields->attribute_label) && count($extrafields->attribute_label))
|
if (is_array($extrafields->attribute_label) && count($extrafields->attribute_label))
|
||||||
@ -515,11 +525,13 @@ else
|
|||||||
print ' ';
|
print ' ';
|
||||||
print '</td>';
|
print '</td>';
|
||||||
}
|
}
|
||||||
// To batch
|
|
||||||
if (! empty($arrayfields['p.tobatch']['checked'])) print '<td class="liste_titre center">'.$form->selectyesno($search_tobatch, '', '', '', 1).'</td>';
|
|
||||||
// Stock
|
// Stock
|
||||||
if (! empty($arrayfields['p.stock']['checked'])) print '<td class="liste_titre"> </td>';
|
if (! empty($arrayfields['p.stock']['checked'])) print '<td class="liste_titre"> </td>';
|
||||||
// Accountancy code sell
|
// Stock
|
||||||
|
if (! empty($arrayfields['stock_virtual']['checked'])) print '<td class="liste_titre"> </td>';
|
||||||
|
// To batch
|
||||||
|
if (! empty($arrayfields['p.tobatch']['checked'])) print '<td class="liste_titre center">'.$form->selectyesno($search_tobatch, '', '', '', 1).'</td>';
|
||||||
|
// Accountancy code sell
|
||||||
if (! empty($arrayfields['p.accountancy_code_sell']['checked'])) print '<td class="liste_titre"><input class="flat" type="text" name="search_accountancy_code_sell" size="6" value="'.dol_escape_htmltag($search_accountancy_code_sell).'"></td>';
|
if (! empty($arrayfields['p.accountancy_code_sell']['checked'])) print '<td class="liste_titre"><input class="flat" type="text" name="search_accountancy_code_sell" size="6" value="'.dol_escape_htmltag($search_accountancy_code_sell).'"></td>';
|
||||||
// Accountancy code sell
|
// Accountancy code sell
|
||||||
if (! empty($arrayfields['p.accountancy_code_buy']['checked'])) print '<td class="liste_titre"><input class="flat" type="text" name="search_accountancy_code_buy" size="6" value="'.dol_escape_htmltag($search_accountancy_code_buy).'"></td>';
|
if (! empty($arrayfields['p.accountancy_code_buy']['checked'])) print '<td class="liste_titre"><input class="flat" type="text" name="search_accountancy_code_buy" size="6" value="'.dol_escape_htmltag($search_accountancy_code_buy).'"></td>';
|
||||||
@ -600,7 +612,16 @@ else
|
|||||||
$product_static->status_buy = $objp->tobuy;
|
$product_static->status_buy = $objp->tobuy;
|
||||||
$product_static->status = $objp->tosell;
|
$product_static->status = $objp->tosell;
|
||||||
$product_static->entity = $objp->entity;
|
$product_static->entity = $objp->entity;
|
||||||
|
|
||||||
|
if (! empty($conf->stock->enabled) && $user->rights->stock->lire && $type != 1) // To optimize call of load_stock
|
||||||
|
{
|
||||||
|
if ($objp->fk_product_type != 1) // Not a service
|
||||||
|
{
|
||||||
|
$product_static->load_stock('nobatch'); // Load stock_reel + stock_warehouse. This also call load_virtual_stock()
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
$var=!$var;
|
$var=!$var;
|
||||||
print '<tr '.$bc[$var].'>';
|
print '<tr '.$bc[$var].'>';
|
||||||
|
|
||||||
@ -681,15 +702,6 @@ else
|
|||||||
print '</td>';
|
print '</td>';
|
||||||
}
|
}
|
||||||
|
|
||||||
if (! empty($conf->stock->enabled) && $user->rights->stock->lire && $type != 1) // To optimize call of load_stock
|
|
||||||
{
|
|
||||||
if ($objp->fk_product_type != 1) // Not a service
|
|
||||||
{
|
|
||||||
$product_static->id = $objp->rowid;
|
|
||||||
$product_static->load_stock('nobatch'); // Load stock_reel + stock_warehouse + batch detail. This also call load_virtual_stock()
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
// Limit alert
|
// Limit alert
|
||||||
if (! empty($arrayfields['p.seuil_stock_alerte']['checked']))
|
if (! empty($arrayfields['p.seuil_stock_alerte']['checked']))
|
||||||
{
|
{
|
||||||
@ -710,24 +722,35 @@ else
|
|||||||
}
|
}
|
||||||
print '</td>';
|
print '</td>';
|
||||||
}
|
}
|
||||||
// Lot/Serial
|
|
||||||
if (! empty($arrayfields['p.tobatch']['checked']))
|
|
||||||
{
|
|
||||||
print '<td align="center">';
|
|
||||||
print yn($objp->tobatch);
|
|
||||||
print '</td>';
|
|
||||||
}
|
|
||||||
// Stock
|
// Stock
|
||||||
if (! empty($arrayfields['p.stock']['checked']))
|
if (! empty($arrayfields['p.stock']['checked']))
|
||||||
{
|
{
|
||||||
print '<td align="right">';
|
print '<td align="right">';
|
||||||
if ($objp->fk_product_type != 1)
|
if ($objp->fk_product_type != 1)
|
||||||
{
|
{
|
||||||
if ($product_static->stock_reel < $objp->seuil_stock_alerte) print img_warning($langs->trans("StockTooLow")).' ';
|
if ($objp->seuil_stock_alerte != '' && $product_static->stock_reel < (float) $objp->seuil_stock_alerte) print img_warning($langs->trans("StockTooLow")).' ';
|
||||||
print $product_static->stock_reel;
|
print $product_static->stock_reel;
|
||||||
}
|
}
|
||||||
print '</td>';
|
print '</td>';
|
||||||
}
|
}
|
||||||
|
// Stock
|
||||||
|
if (! empty($arrayfields['stock_virtual']['checked']))
|
||||||
|
{
|
||||||
|
print '<td align="right">';
|
||||||
|
if ($objp->fk_product_type != 1)
|
||||||
|
{
|
||||||
|
if ($objp->seuil_stock_alerte != '' && $product_static->stock_theorique < (float) $objp->seuil_stock_alerte) print img_warning($langs->trans("StockTooLow")).' ';
|
||||||
|
print $product_static->stock_theorique;
|
||||||
|
}
|
||||||
|
print '</td>';
|
||||||
|
}
|
||||||
|
// Lot/Serial
|
||||||
|
if (! empty($arrayfields['p.tobatch']['checked']))
|
||||||
|
{
|
||||||
|
print '<td align="center">';
|
||||||
|
print yn($objp->tobatch);
|
||||||
|
print '</td>';
|
||||||
|
}
|
||||||
// Accountancy code sell
|
// Accountancy code sell
|
||||||
if (! empty($arrayfields['p.accountancy_code_sell']['checked'])) print '<td>'.$objp->accountancy_code_sell.'</td>';
|
if (! empty($arrayfields['p.accountancy_code_sell']['checked'])) print '<td>'.$objp->accountancy_code_sell.'</td>';
|
||||||
// Accountancy code sell
|
// Accountancy code sell
|
||||||
|
|||||||
@ -84,6 +84,13 @@ if (! empty($_POST["button_removefilter_x"]))
|
|||||||
$toolowstock='';
|
$toolowstock='';
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// Define virtualdiffersfromphysical
|
||||||
|
$virtualdiffersfromphysical=0;
|
||||||
|
if (! empty($conf->global->STOCK_CALCULATE_ON_SHIPMENT) || ! empty($conf->global->STOCK_CALCULATE_ON_SUPPLIER_DISPATCH_ORDER))
|
||||||
|
{
|
||||||
|
$virtualdiffersfromphysical=1; // According to increase/decrease stock options, virtual and physical stock may differs.
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
/*
|
/*
|
||||||
@ -192,11 +199,11 @@ if ($resql)
|
|||||||
|
|
||||||
if ($sref || $snom || $sall || GETPOST('search'))
|
if ($sref || $snom || $sall || GETPOST('search'))
|
||||||
{
|
{
|
||||||
print_barre_liste($texte, $page, $_SERVER["PHP_SELF"], "&sref=".$sref."&snom=".$snom."&sall=".$sall."&tosell=".$tosell."&tobuy=".$tobuy.(!empty($search_categ) ? '&search_categ='.$search_categ : '').(!empty($toolowstock) ? '&toolowstock='.$toolowstock : ''), $sortfield, $sortorder,'',$num);
|
print_barre_liste($texte, $page, $_SERVER["PHP_SELF"], "&sref=".$sref."&snom=".$snom."&sall=".$sall."&tosell=".$tosell."&tobuy=".$tobuy.(!empty($search_categ) ? '&search_categ='.$search_categ : '').(!empty($toolowstock) ? '&toolowstock='.$toolowstock : ''), $sortfield, $sortorder,'',$num, 0, 'title_products');
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
print_barre_liste($texte, $page, $_SERVER["PHP_SELF"], "&sref=$sref&snom=$snom&fourn_id=$fourn_id".(isset($type)?"&type=$type":"").(!empty($search_categ) ? '&search_categ='.$search_categ : '').(!empty($toolowstock) ? '&toolowstock='.$toolowstock : ''), $sortfield, $sortorder,'',$num);
|
print_barre_liste($texte, $page, $_SERVER["PHP_SELF"], "&sref=$sref&snom=$snom&fourn_id=$fourn_id".(isset($type)?"&type=$type":"").(!empty($search_categ) ? '&search_categ='.$search_categ : '').(!empty($toolowstock) ? '&toolowstock='.$toolowstock : ''), $sortfield, $sortorder,'',$num, 0, 'title_products');
|
||||||
}
|
}
|
||||||
|
|
||||||
if (! empty($catid))
|
if (! empty($catid))
|
||||||
@ -251,9 +258,8 @@ if ($resql)
|
|||||||
if (! empty($conf->service->enabled) && $type == 1) print_liste_field_titre($langs->trans("Duration"), $_SERVER["PHP_SELF"], "p.duration",$param,"",'align="center"',$sortfield,$sortorder);
|
if (! empty($conf->service->enabled) && $type == 1) print_liste_field_titre($langs->trans("Duration"), $_SERVER["PHP_SELF"], "p.duration",$param,"",'align="center"',$sortfield,$sortorder);
|
||||||
print_liste_field_titre($langs->trans("StockLimit"), $_SERVER["PHP_SELF"], "p.seuil_stock_alerte",$param,"",'align="right"',$sortfield,$sortorder);
|
print_liste_field_titre($langs->trans("StockLimit"), $_SERVER["PHP_SELF"], "p.seuil_stock_alerte",$param,"",'align="right"',$sortfield,$sortorder);
|
||||||
print_liste_field_titre($langs->trans("DesiredStock"), $_SERVER["PHP_SELF"], "p.desiredstock",$param,"",'align="right"',$sortfield,$sortorder);
|
print_liste_field_titre($langs->trans("DesiredStock"), $_SERVER["PHP_SELF"], "p.desiredstock",$param,"",'align="right"',$sortfield,$sortorder);
|
||||||
print_liste_field_titre($langs->trans("PhysicalStock"), $_SERVER["PHP_SELF"], "stock_physique",$param,"",'align="right"',$sortfield,$sortorder);
|
print_liste_field_titre($langs->trans("PhysicalStock"), $_SERVER["PHP_SELF"], "",$param,"",'align="right"',$sortfield,$sortorder);
|
||||||
// TODO Add info of running suppliers/customers orders
|
if ($virtualdiffersfromphysical) print_liste_field_titre($langs->trans("VirtualStock"),$_SERVER["PHP_SELF"], "stock_theorique",$param,"",'align="right"',$sortfield,$sortorder);
|
||||||
//print_liste_field_titre($langs->trans("TheoreticalStock"),$_SERVER["PHP_SELF"], "stock_theorique",$param,"",'align="right"',$sortfield,$sortorder);
|
|
||||||
print_liste_field_titre('');
|
print_liste_field_titre('');
|
||||||
print_liste_field_titre($langs->trans("Status").' ('.$langs->trans("Sell").')',$_SERVER["PHP_SELF"], "p.tosell",$param,"",'align="right"',$sortfield,$sortorder);
|
print_liste_field_titre($langs->trans("Status").' ('.$langs->trans("Sell").')',$_SERVER["PHP_SELF"], "p.tosell",$param,"",'align="right"',$sortfield,$sortorder);
|
||||||
print_liste_field_titre($langs->trans("Status").' ('.$langs->trans("Buy").')',$_SERVER["PHP_SELF"], "p.tobuy",$param,"",'align="right"',$sortfield,$sortorder);
|
print_liste_field_titre($langs->trans("Status").' ('.$langs->trans("Buy").')',$_SERVER["PHP_SELF"], "p.tobuy",$param,"",'align="right"',$sortfield,$sortorder);
|
||||||
@ -267,16 +273,18 @@ if ($resql)
|
|||||||
print '<td class="liste_titre">';
|
print '<td class="liste_titre">';
|
||||||
print '<input class="flat" type="text" name="snom" size="8" value="'.$snom.'">';
|
print '<input class="flat" type="text" name="snom" size="8" value="'.$snom.'">';
|
||||||
print '</td>';
|
print '</td>';
|
||||||
|
// Duration
|
||||||
if (! empty($conf->service->enabled) && $type == 1)
|
if (! empty($conf->service->enabled) && $type == 1)
|
||||||
{
|
{
|
||||||
print '<td class="liste_titre">';
|
print '<td class="liste_titre">';
|
||||||
print ' ';
|
print ' ';
|
||||||
print '</td>';
|
print '</td>';
|
||||||
}
|
}
|
||||||
// Lot/Serial
|
// Stock limit
|
||||||
print '<td class="liste_titre"> </td>';
|
print '<td class="liste_titre"> </td>';
|
||||||
print '<td class="liste_titre" align="right"> </td>';
|
print '<td class="liste_titre" align="right"> </td>';
|
||||||
print '<td class="liste_titre"> </td>';
|
print '<td class="liste_titre"> </td>';
|
||||||
|
if ($virtualdiffersfromphysical) print '<td class="liste_titre"> </td>';
|
||||||
print '<td class="liste_titre"> </td>';
|
print '<td class="liste_titre"> </td>';
|
||||||
print '<td class="liste_titre"> </td>';
|
print '<td class="liste_titre"> </td>';
|
||||||
print '<td class="liste_titre" align="right">';
|
print '<td class="liste_titre" align="right">';
|
||||||
@ -309,15 +317,23 @@ if ($resql)
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
$var=!$var;
|
|
||||||
print '<tr '.$bc[$var].'><td class="nowrap">';
|
|
||||||
$product_static->ref=$objp->ref;
|
$product_static->ref=$objp->ref;
|
||||||
$product_static->id=$objp->rowid;
|
$product_static->id=$objp->rowid;
|
||||||
$product_static->label = $objp->label;
|
$product_static->label = $objp->label;
|
||||||
$product_static->type=$objp->fk_product_type;
|
$product_static->type=$objp->fk_product_type;
|
||||||
$product_static->entity=$objp->entity;
|
$product_static->entity=$objp->entity;
|
||||||
|
if (! empty($conf->stock->enabled) && $user->rights->stock->lire && $type != 1) // To optimize call of load_stock
|
||||||
|
{
|
||||||
|
if ($objp->fk_product_type != 1) // Not a service
|
||||||
|
{
|
||||||
|
$product_static->load_stock('nobatch'); // Load stock_reel + stock_warehouse. This also call load_virtual_stock()
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
$var=!$var;
|
||||||
|
print '<tr '.$bc[$var].'><td class="nowrap">';
|
||||||
print $product_static->getNomUrl(1,'',24);
|
print $product_static->getNomUrl(1,'',24);
|
||||||
//if ($objp->stock_theorique < $objp->seuil_stock_alerte) print ' '.img_warning($langs->trans("StockTooLow"));
|
|
||||||
print '</td>';
|
print '</td>';
|
||||||
print '<td>'.$objp->label.'</td>';
|
print '<td>'.$objp->label.'</td>';
|
||||||
|
|
||||||
@ -333,10 +349,19 @@ if ($resql)
|
|||||||
//print '<td align="right">'.$objp->stock_theorique.'</td>';
|
//print '<td align="right">'.$objp->stock_theorique.'</td>';
|
||||||
print '<td align="right">'.$objp->seuil_stock_alerte.'</td>';
|
print '<td align="right">'.$objp->seuil_stock_alerte.'</td>';
|
||||||
print '<td align="right">'.$objp->desiredstock.'</td>';
|
print '<td align="right">'.$objp->desiredstock.'</td>';
|
||||||
|
// Real stock
|
||||||
print '<td align="right">';
|
print '<td align="right">';
|
||||||
if ($objp->seuil_stock_alerte && ($objp->stock_physique < $objp->seuil_stock_alerte)) print img_warning($langs->trans("StockTooLow")).' ';
|
if ($objp->seuil_stock_alerte != '' && ($objp->stock_physique < $objp->seuil_stock_alerte)) print img_warning($langs->trans("StockTooLow")).' ';
|
||||||
print $objp->stock_physique;
|
print $objp->stock_physique;
|
||||||
print '</td>';
|
print '</td>';
|
||||||
|
// Virtual stock
|
||||||
|
if ($virtualdiffersfromphysical)
|
||||||
|
{
|
||||||
|
print '<td align="right">';
|
||||||
|
if ($objp->seuil_stock_alerte != '' && ($product_static->stock_theorique < $objp->seuil_stock_alerte)) print img_warning($langs->trans("StockTooLow")).' ';
|
||||||
|
print $product_static->stock_theorique;
|
||||||
|
print '</td>';
|
||||||
|
}
|
||||||
print '<td align="right"><a href="'.DOL_URL_ROOT.'/product/stock/mouvement.php?idproduct='.$product_static->id.'">'.$langs->trans("Movements").'</a></td>';
|
print '<td align="right"><a href="'.DOL_URL_ROOT.'/product/stock/mouvement.php?idproduct='.$product_static->id.'">'.$langs->trans("Movements").'</a></td>';
|
||||||
print '<td align="right" class="nowrap">'.$product_static->LibStatut($objp->statut,5,0).'</td>';
|
print '<td align="right" class="nowrap">'.$product_static->LibStatut($objp->statut,5,0).'</td>';
|
||||||
print '<td align="right" class="nowrap">'.$product_static->LibStatut($objp->tobuy,5,1).'</td>';
|
print '<td align="right" class="nowrap">'.$product_static->LibStatut($objp->tobuy,5,1).'</td>';
|
||||||
|
|||||||
@ -204,11 +204,11 @@ if ($resql)
|
|||||||
|
|
||||||
if ($sref || $snom || $sall || GETPOST('search'))
|
if ($sref || $snom || $sall || GETPOST('search'))
|
||||||
{
|
{
|
||||||
print_barre_liste($texte, $page, $_SERVER["PHP_SELF"], "&sref=".$sref."&snom=".$snom."&sall=".$sall."&tosell=".$tosell."&tobuy=".$tobuy, $sortfield, $sortorder,'',$num);
|
print_barre_liste($texte, $page, $_SERVER["PHP_SELF"], "&sref=".$sref."&snom=".$snom."&sall=".$sall."&tosell=".$tosell."&tobuy=".$tobuy, $sortfield, $sortorder,'',$num, 0, 'title_products');
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
print_barre_liste($texte, $page, $_SERVER["PHP_SELF"], "&sref=$sref&snom=$snom&fourn_id=$fourn_id".(isset($type)?"&type=$type":""), $sortfield, $sortorder,'',$num);
|
print_barre_liste($texte, $page, $_SERVER["PHP_SELF"], "&sref=$sref&snom=$snom&fourn_id=$fourn_id".(isset($type)?"&type=$type":""), $sortfield, $sortorder,'',$num, 0, 'title_products');
|
||||||
}
|
}
|
||||||
|
|
||||||
if (! empty($catid))
|
if (! empty($catid))
|
||||||
|
|||||||
@ -252,25 +252,12 @@ class MouvementStock extends CommonObject
|
|||||||
|
|
||||||
// Calculate new PMP.
|
// Calculate new PMP.
|
||||||
$newpmp=0;
|
$newpmp=0;
|
||||||
//$newpmpwarehouse=0;
|
|
||||||
if (! $error)
|
if (! $error)
|
||||||
{
|
{
|
||||||
// Note: PMP is calculated on stock input only (type of movement = 0 or 3). If type == 0 or 3, qty should be > 0.
|
// Note: PMP is calculated on stock input only (type of movement = 0 or 3). If type == 0 or 3, qty should be > 0.
|
||||||
// Note: Price should always be >0 or 0. PMP should be always >0 (calculated on input)
|
// Note: Price should always be >0 or 0. PMP should be always >0 (calculated on input)
|
||||||
if (($type == 0 || $type == 3) && $price > 0)
|
if (($type == 0 || $type == 3) && $price > 0)
|
||||||
{
|
{
|
||||||
// If we will change PMP for the warehouse we edit and the product, we must first check/clean that PMP is defined
|
|
||||||
// on every stock entry with old value (so global updated value will match recalculated value from product_stock)
|
|
||||||
/* $sql = "UPDATE ".MAIN_DB_PREFIX."product_stock SET pmp = ".($oldpmp?$oldpmp:'0');
|
|
||||||
$sql.= " WHERE pmp = 0 AND fk_product = ".$fk_product;
|
|
||||||
dol_syslog(get_class($this)."::_create", LOG_DEBUG);
|
|
||||||
$resql=$this->db->query($sql);
|
|
||||||
if (! $resql)
|
|
||||||
{
|
|
||||||
$this->errors[]=$this->db->lasterror();
|
|
||||||
$error = -4;
|
|
||||||
}
|
|
||||||
*/
|
|
||||||
$oldqtytouse=($oldqty >= 0?$oldqty:0);
|
$oldqtytouse=($oldqty >= 0?$oldqty:0);
|
||||||
// We make a test on oldpmp>0 to avoid to use normal rule on old data with no pmp field defined
|
// We make a test on oldpmp>0 to avoid to use normal rule on old data with no pmp field defined
|
||||||
if ($oldpmp > 0) $newpmp=price2num((($oldqtytouse * $oldpmp) + ($qty * $price)) / ($oldqtytouse + $qty), 'MU');
|
if ($oldpmp > 0) $newpmp=price2num((($oldqtytouse * $oldpmp) + ($qty * $price)) / ($oldqtytouse + $qty), 'MU');
|
||||||
@ -278,13 +265,8 @@ class MouvementStock extends CommonObject
|
|||||||
{
|
{
|
||||||
$newpmp=$price; // For this product, PMP was not yet set. We set it to input price.
|
$newpmp=$price; // For this product, PMP was not yet set. We set it to input price.
|
||||||
}
|
}
|
||||||
/*
|
//print "oldqtytouse=".$oldqtytouse." oldpmp=".$oldpmp." oldqtywarehousetouse=".$oldqtywarehousetouse." ";
|
||||||
$oldqtywarehousetouse=$oldqtywarehouse;
|
//print "qty=".$qty." newpmp=".$newpmp;
|
||||||
if ($oldpmpwarehouse > 0) $newpmpwarehouse=price2num((($oldqtywarehousetouse * $oldpmpwarehouse) + ($qty * $price)) / ($oldqtywarehousetouse + $qty), 'MU');
|
|
||||||
else $newpmpwarehouse=$price;
|
|
||||||
*/
|
|
||||||
//print "oldqtytouse=".$oldqtytouse." oldpmp=".$oldpmp." oldqtywarehousetouse=".$oldqtywarehousetouse." oldpmpwarehouse=".$oldpmpwarehouse." ";
|
|
||||||
//print "qty=".$qty." newpmp=".$newpmp." newpmpwarehouse=".$newpmpwarehouse;
|
|
||||||
//exit;
|
//exit;
|
||||||
}
|
}
|
||||||
else if ($type == 1 || $type == 2)
|
else if ($type == 1 || $type == 2)
|
||||||
@ -295,7 +277,6 @@ class MouvementStock extends CommonObject
|
|||||||
else
|
else
|
||||||
{
|
{
|
||||||
$newpmp = $oldpmp;
|
$newpmp = $oldpmp;
|
||||||
//$newpmpwarehouse = $oldpmpwarehouse;
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -339,11 +320,13 @@ class MouvementStock extends CommonObject
|
|||||||
// Update PMP and denormalized value of stock qty at product level
|
// Update PMP and denormalized value of stock qty at product level
|
||||||
if (! $error)
|
if (! $error)
|
||||||
{
|
{
|
||||||
$sql = "UPDATE ".MAIN_DB_PREFIX."product SET pmp = ".$newpmp.", stock = ".$this->db->ifsql("stock IS NULL", 0, "stock") . " + ".$qty;
|
//$sql = "UPDATE ".MAIN_DB_PREFIX."product SET pmp = ".$newpmp.", stock = ".$this->db->ifsql("stock IS NULL", 0, "stock") . " + ".$qty;
|
||||||
|
//$sql.= " WHERE rowid = ".$fk_product;
|
||||||
|
// Update pmp + denormalized fields because we change content of produt_stock. Warning: Do not use "SET p.stock", does not works with pgsql
|
||||||
|
$sql = "UPDATE ".MAIN_DB_PREFIX."product as p SET p.pmp = ".$newpmp.", ";
|
||||||
|
$sql.= " stock=(SELECT SUM(ps.reel) FROM llx_product_stock ps WHERE ps.fk_product = p.rowid)";
|
||||||
$sql.= " WHERE rowid = ".$fk_product;
|
$sql.= " WHERE rowid = ".$fk_product;
|
||||||
// May be this request is better:
|
print $sql;
|
||||||
// UPDATE llx_product p SET p.stock= (SELECT SUM(ps.reel) FROM llx_product_stock ps WHERE ps.fk_product = p.rowid);
|
|
||||||
|
|
||||||
dol_syslog(get_class($this)."::_create", LOG_DEBUG);
|
dol_syslog(get_class($this)."::_create", LOG_DEBUG);
|
||||||
$resql=$this->db->query($sql);
|
$resql=$this->db->query($sql);
|
||||||
if (! $resql)
|
if (! $resql)
|
||||||
|
|||||||
@ -185,7 +185,7 @@ if ($action == 'createmovements')
|
|||||||
{
|
{
|
||||||
$result=$product->fetch($id_product);
|
$result=$product->fetch($id_product);
|
||||||
|
|
||||||
$product->load_stock(); // Load array product->stock_warehouse
|
$product->load_stock('novirtual'); // Load array product->stock_warehouse
|
||||||
|
|
||||||
// Define value of products moved
|
// Define value of products moved
|
||||||
$pricesrc=0;
|
$pricesrc=0;
|
||||||
|
|||||||
@ -207,11 +207,10 @@ if ($action == "transfert_stock" && ! $cancel)
|
|||||||
|
|
||||||
$db->begin();
|
$db->begin();
|
||||||
|
|
||||||
$product->load_stock(); // Load array product->stock_warehouse
|
$product->load_stock('novirtual'); // Load array product->stock_warehouse
|
||||||
|
|
||||||
// Define value of products moved
|
// Define value of products moved
|
||||||
$pricesrc=0;
|
$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;
|
if (isset($product->pmp)) $pricesrc=$product->pmp;
|
||||||
$pricedest=$pricesrc;
|
$pricedest=$pricesrc;
|
||||||
|
|
||||||
|
|||||||
@ -185,7 +185,7 @@ if ($action == "correct_stock" && ! $cancel)
|
|||||||
// Transfer stock from a warehouse to another warehouse
|
// Transfer stock from a warehouse to another warehouse
|
||||||
if ($action == "transfert_stock" && ! $cancel)
|
if ($action == "transfert_stock" && ! $cancel)
|
||||||
{
|
{
|
||||||
if (! (GETPOST("id_entrepot_source",'int') > 0) || ! (GETPOST("id_entrepot_destination",'int') > 0))
|
if (! (GETPOST("id_entrepot",'int') > 0) || ! (GETPOST("id_entrepot_destination",'int') > 0))
|
||||||
{
|
{
|
||||||
setEventMessages($langs->trans("ErrorFieldRequired", $langs->transnoentitiesnoconv("Warehouse")), null, 'errors');
|
setEventMessages($langs->trans("ErrorFieldRequired", $langs->transnoentitiesnoconv("Warehouse")), null, 'errors');
|
||||||
$error++;
|
$error++;
|
||||||
@ -197,7 +197,7 @@ if ($action == "transfert_stock" && ! $cancel)
|
|||||||
$error++;
|
$error++;
|
||||||
$action='transfert';
|
$action='transfert';
|
||||||
}
|
}
|
||||||
if (GETPOST("id_entrepot_source",'int') == GETPOST("id_entrepot_destination",'int'))
|
if (GETPOST("id_entrepot",'int') == GETPOST("id_entrepot_destination",'int'))
|
||||||
{
|
{
|
||||||
setEventMessages($langs->trans("ErrorSrcAndTargetWarehouseMustDiffers"), null, 'errors');
|
setEventMessages($langs->trans("ErrorSrcAndTargetWarehouseMustDiffers"), null, 'errors');
|
||||||
$error++;
|
$error++;
|
||||||
@ -225,7 +225,7 @@ if ($action == "transfert_stock" && ! $cancel)
|
|||||||
|
|
||||||
$db->begin();
|
$db->begin();
|
||||||
|
|
||||||
$object->load_stock(); // Load array product->stock_warehouse
|
$object->load_stock('novirtual'); // Load array product->stock_warehouse
|
||||||
|
|
||||||
// Define value of products moved
|
// Define value of products moved
|
||||||
$pricesrc=0;
|
$pricesrc=0;
|
||||||
@ -254,7 +254,7 @@ if ($action == "transfert_stock" && ! $cancel)
|
|||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
$srcwarehouseid=GETPOST('id_entrepot_source','int');
|
$srcwarehouseid=GETPOST('id_entrepot','int');
|
||||||
$batch=GETPOST('batch_number');
|
$batch=GETPOST('batch_number');
|
||||||
$eatby=$d_eatby;
|
$eatby=$d_eatby;
|
||||||
$sellby=$d_sellby;
|
$sellby=$d_sellby;
|
||||||
@ -291,7 +291,7 @@ if ($action == "transfert_stock" && ! $cancel)
|
|||||||
// Remove stock
|
// Remove stock
|
||||||
$result1=$object->correct_stock(
|
$result1=$object->correct_stock(
|
||||||
$user,
|
$user,
|
||||||
GETPOST("id_entrepot_source"),
|
GETPOST("id_entrepot"),
|
||||||
GETPOST("nbpiece"),
|
GETPOST("nbpiece"),
|
||||||
1,
|
1,
|
||||||
GETPOST("label"),
|
GETPOST("label"),
|
||||||
@ -390,6 +390,7 @@ if ($id > 0 || $ref)
|
|||||||
{
|
{
|
||||||
$object = new Product($db);
|
$object = new Product($db);
|
||||||
$result = $object->fetch($id,$ref);
|
$result = $object->fetch($id,$ref);
|
||||||
|
|
||||||
$object->load_stock();
|
$object->load_stock();
|
||||||
|
|
||||||
$help_url='EN:Module_Stocks_En|FR:Module_Stock|ES:Módulo_Stocks';
|
$help_url='EN:Module_Stocks_En|FR:Module_Stock|ES:Módulo_Stocks';
|
||||||
@ -480,7 +481,6 @@ if ($id > 0 || $ref)
|
|||||||
print '</td></tr>';
|
print '</td></tr>';
|
||||||
|
|
||||||
// Real stock
|
// Real stock
|
||||||
$object->load_stock();
|
|
||||||
$text_stock_options = '';
|
$text_stock_options = '';
|
||||||
$text_stock_options.= (! empty($conf->global->STOCK_CALCULATE_ON_SHIPMENT)?$langs->trans("DeStockOnShipment").'<br>':'');
|
$text_stock_options.= (! empty($conf->global->STOCK_CALCULATE_ON_SHIPMENT)?$langs->trans("DeStockOnShipment").'<br>':'');
|
||||||
$text_stock_options.= (! empty($conf->global->STOCK_CALCULATE_ON_VALIDATE_ORDER)?$langs->trans("DeStockOnValidateOrder").'<br>':'');
|
$text_stock_options.= (! empty($conf->global->STOCK_CALCULATE_ON_VALIDATE_ORDER)?$langs->trans("DeStockOnValidateOrder").'<br>':'');
|
||||||
@ -702,9 +702,10 @@ if ($resql)
|
|||||||
$entrepotstatic->id=$obj->rowid;
|
$entrepotstatic->id=$obj->rowid;
|
||||||
$entrepotstatic->libelle=$obj->label;
|
$entrepotstatic->libelle=$obj->label;
|
||||||
$entrepotstatic->lieu=$obj->lieu;
|
$entrepotstatic->lieu=$obj->lieu;
|
||||||
|
$stock_real = round($obj->reel, 10);
|
||||||
print '<tr '.$bc[$var].'>';
|
print '<tr '.$bc[$var].'>';
|
||||||
print '<td colspan="4">'.$entrepotstatic->getNomUrl(1).'</td>';
|
print '<td colspan="4">'.$entrepotstatic->getNomUrl(1).'</td>';
|
||||||
print '<td align="right">'.$obj->reel.($obj->reel<0?' '.img_warning():'').'</td>';
|
print '<td align="right">'.$stock_real.($stock_real < 0 ?' '.img_warning():'').'</td>';
|
||||||
// PMP
|
// PMP
|
||||||
print '<td align="right">'.(price2num($object->pmp)?price2num($object->pmp,'MU'):'').'</td>';
|
print '<td align="right">'.(price2num($object->pmp)?price2num($object->pmp,'MU'):'').'</td>';
|
||||||
// Value purchase
|
// Value purchase
|
||||||
|
|||||||
@ -69,6 +69,13 @@ if (!$sortorder) {
|
|||||||
$sortorder = 'ASC';
|
$sortorder = 'ASC';
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// Define virtualdiffersfromphysical
|
||||||
|
$virtualdiffersfromphysical=0;
|
||||||
|
if (! empty($conf->global->STOCK_CALCULATE_ON_SHIPMENT) || ! empty($conf->global->STOCK_CALCULATE_ON_SUPPLIER_DISPATCH_ORDER))
|
||||||
|
{
|
||||||
|
$virtualdiffersfromphysical=1; // According to increase/decrease stock options, virtual and physical stock may differs.
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* Actions
|
* Actions
|
||||||
@ -227,20 +234,6 @@ if ($action == 'order' && isset($_POST['valid']))
|
|||||||
|
|
||||||
$form = new Form($db);
|
$form = new Form($db);
|
||||||
|
|
||||||
$virtualdiffersfromphysical=0;
|
|
||||||
if (! empty($conf->global->STOCK_CALCULATE_ON_SHIPMENT) || ! empty($conf->global->STOCK_CALCULATE_ON_SUPPLIER_DISPATCH_ORDER))
|
|
||||||
{
|
|
||||||
$virtualdiffersfromphysical=1; // According to increase/decrease stock options, virtual and physical stock may differs.
|
|
||||||
}
|
|
||||||
|
|
||||||
$usevirtualstock=-1;
|
|
||||||
if ($virtualdiffersfromphysical)
|
|
||||||
{
|
|
||||||
$usevirtualstock=(! empty($conf->global->STOCK_USE_VIRTUAL_STOCK)?1:0);
|
|
||||||
if ($mode=='virtual') $usevirtualstock=1;
|
|
||||||
if ($mode=='physical') $usevirtualstock=0;
|
|
||||||
}
|
|
||||||
|
|
||||||
$title = $langs->trans('Status');
|
$title = $langs->trans('Status');
|
||||||
|
|
||||||
$sql = 'SELECT p.rowid, p.ref, p.label, p.price,';
|
$sql = 'SELECT p.rowid, p.ref, p.label, p.price,';
|
||||||
|
|||||||
@ -411,7 +411,8 @@ function getProductOrService($authentication,$id='',$ref='',$ref_ext='',$lang=''
|
|||||||
'localtax1_tx' => $product->localtax1_tx,
|
'localtax1_tx' => $product->localtax1_tx,
|
||||||
'localtax2_tx' => $product->localtax2_tx,
|
'localtax2_tx' => $product->localtax2_tx,
|
||||||
|
|
||||||
'stock_real' => $product->stock_reel,
|
'stock_real' => $product->stock_reel,
|
||||||
|
'stock_virtual' => $product->stock_theorique,
|
||||||
'stock_alert' => $product->seuil_stock_alerte,
|
'stock_alert' => $product->seuil_stock_alerte,
|
||||||
'pmp' => $product->pmp,
|
'pmp' => $product->pmp,
|
||||||
'import_key' => $product->import_key,
|
'import_key' => $product->import_key,
|
||||||
@ -572,7 +573,7 @@ function createProductOrService($authentication,$product)
|
|||||||
require_once DOL_DOCUMENT_ROOT.'/product/stock/class/entrepot.class.php';
|
require_once DOL_DOCUMENT_ROOT.'/product/stock/class/entrepot.class.php';
|
||||||
|
|
||||||
$savstockreal=$newobject->stock_reel;
|
$savstockreal=$newobject->stock_reel;
|
||||||
$newobject->load_stock(); // This overwrite ->stock_reel
|
$newobject->load_stock('novirtual,nobatch'); // This overwrite ->stock_reel, surely 0 because we have just created product
|
||||||
$getstockreal = $newobject->stock_reel;
|
$getstockreal = $newobject->stock_reel;
|
||||||
|
|
||||||
if ($savstockreal != $getstockreal)
|
if ($savstockreal != $getstockreal)
|
||||||
@ -741,7 +742,7 @@ function updateProductOrService($authentication,$product)
|
|||||||
require_once DOL_DOCUMENT_ROOT.'/product/stock/class/entrepot.class.php';
|
require_once DOL_DOCUMENT_ROOT.'/product/stock/class/entrepot.class.php';
|
||||||
|
|
||||||
$savstockreal=$newobject->stock_reel;
|
$savstockreal=$newobject->stock_reel;
|
||||||
$newobject->load_stock(); // This overwrite ->stock_reel
|
$newobject->load_stock('novirtual,nobatch'); // This overwrite ->stock_reel
|
||||||
$getstockreal = $newobject->stock_reel;
|
$getstockreal = $newobject->stock_reel;
|
||||||
|
|
||||||
if ($savstockreal != $getstockreal)
|
if ($savstockreal != $getstockreal)
|
||||||
|
|||||||
Loading…
Reference in New Issue
Block a user