Merge branch 'develop' into patch-9

This commit is contained in:
Laurent Destailleur 2018-10-24 12:24:00 +02:00 committed by GitHub
commit 6edaf3a422
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
11 changed files with 48 additions and 37 deletions

View File

@ -716,7 +716,7 @@ class pdf_eratosthene extends ModelePDFCommandes
/**
* Show payments table
*
*
* @param TCPDF $pdf Object PDF
* @param Object $object Object order
* @param int $posy Position y in PDF
@ -727,7 +727,6 @@ class pdf_eratosthene extends ModelePDFCommandes
{
}
/**
* Show miscellaneous information (payment mode, payment term, ...)
*
@ -1177,7 +1176,7 @@ class pdf_eratosthene extends ModelePDFCommandes
/**
* Show table for lines
*
* @param PDF $pdf Object PDF
* @param TCPDF $pdf Object PDF
* @param string $tab_top Top position of table
* @param string $tab_height Height of table (rectangle)
* @param int $nexY Y (not used)
@ -1479,10 +1478,10 @@ class pdf_eratosthene extends ModelePDFCommandes
* Define Array Column Field
*
* @param object $object common object
* @param outputlangs $outputlangs langs
* @param int $hidedetails Do not show line details
* @param int $hidedesc Do not show desc
* @param int $hideref Do not show ref
* @param Translate $outputlangs langs
* @param int $hidedetails Do not show line details
* @param int $hidedesc Do not show desc
* @param int $hideref Do not show ref
* @return null
*/
public function defineColumnField($object,$outputlangs,$hidedetails=0,$hidedesc=0,$hideref=0)

View File

@ -273,7 +273,7 @@ class modStock extends DolibarrModules
'e.rowid'=>'IdWarehouse','e.ref'=>'LocationSummary','e.description'=>'DescWareHouse','e.lieu'=>'LieuWareHouse','e.address'=>'Address','e.zip'=>'Zip',
'e.town'=>'Town','p.rowid'=>"ProductId",'p.ref'=>"Ref",'p.fk_product_type'=>"Type",'p.label'=>"Label",'p.description'=>"Description",'p.note'=>"Note",
'p.price'=>"Price",'p.tva_tx'=>'VAT','p.tosell'=>"OnSell",'p.tobuy'=>'OnBuy','p.duration'=>"Duration",'p.datec'=>'DateCreation',
'p.tms'=>'DateModification','sm.rowid'=>'MovementId','sm.value'=>'Qty','sm.datem'=>'DateMovement','sm.label'=>'LabelMovement',
'p.tms'=>'DateModification','sm.rowid'=>'MovementId','sm.value'=>'Qty','sm.datem'=>'DateMovement','sm.label'=>'MovementLabel',
'sm.inventorycode'=>'InventoryCode'
);
$this->export_TypeFields_array[$r]=array(

View File

@ -54,6 +54,7 @@ ALTER TABLE llx_product_fournisseur_price ADD COLUMN desc_fourn text after ref_f
ALTER TABLE llx_user ADD COLUMN dateemploymentend date after dateemployment;
ALTER TABLE llx_stock_mouvement ADD COLUMN fk_project integer;
ALTER TABLE llx_c_field_list ADD COLUMN visible tinyint DEFAULT 1 NOT NULL AFTER search;

View File

@ -33,6 +33,7 @@ create table llx_stock_mouvement
fk_user_author integer, -- Id user making movement
label varchar(255), -- Comment on movement
inventorycode varchar(128), -- Code used to group different movement line into one operation (may be an inventory, a mass picking)
fk_project integer,
fk_origin integer,
origintype varchar(32),
model_pdf varchar(255)

View File

@ -44,7 +44,6 @@ TransferStock=Transfer stock
MassStockTransferShort=Mass stock transfer
StockMovement=Stock movement
StockMovements=Stock movements
LabelMovement=Movement label
NumberOfUnit=Number of units
UnitPurchaseValue=Unit purchase price
StockTooLow=Stock too low
@ -134,6 +133,7 @@ StockMustBeEnoughForInvoice=Stock level must be enough to add product/service to
StockMustBeEnoughForOrder=Stock level must be enough to add product/service to order (check is done on current real stock when adding a line into order whatever the rule for automatic stock change)
StockMustBeEnoughForShipment= Stock level must be enough to add product/service to shipment (check is done on current real stock when adding a line into shipment whatever the rule for automatic stock change)
MovementLabel=Label of movement
TypeMovement=Type of movement
DateMovement=Date of movement
InventoryCode=Movement or inventory code
IsInPackage=Contained into package
@ -204,3 +204,7 @@ ListInventory=List
StockSupportServices=Stock management supports Services
StockSupportServicesDesc=By default, you can stock only product with type "product". If on, and if module service is on, you can also stock a product with type "service"
ReceiveProducts=Receive items
StockIncreaseAfterCorrectTransfer=Increase by correction/transfer
StockDecreaseAfterCorrectTransfer=Decrease by correction/transfer
StockIncrease=Stock increase
StockDecrease=Stock decrease

View File

@ -3488,7 +3488,7 @@ class Product extends CommonObject
*
* @return int Nb of father + child
*/
function hasFatherOrChild()
public function hasFatherOrChild()
{
$nb = 0;
@ -3514,7 +3514,7 @@ class Product extends CommonObject
*
* @return int Number of variants
*/
function hasVariants()
public function hasVariants()
{
$nb = 0;
$sql = "SELECT count(rowid) as nb FROM ".MAIN_DB_PREFIX."product_attribute_combination WHERE fk_product_parent = ".$this->id;
@ -3535,7 +3535,7 @@ class Product extends CommonObject
*
* @return int
*/
function isVariant()
public function isVariant()
{
global $conf;
if (!empty($conf->variants->enabled)) {
@ -3563,7 +3563,7 @@ class Product extends CommonObject
*
* @return array Array of product
*/
function getFather()
public function getFather()
{
$sql = "SELECT p.rowid, p.label as label, p.ref as ref, pa.fk_product_pere as id, p.fk_product_type, pa.qty, pa.incdec, p.entity";
$sql.= " FROM ".MAIN_DB_PREFIX."product_association as pa,";
@ -3604,7 +3604,7 @@ class Product extends CommonObject
* @param int $level Level of recursing call (start to 1)
* @return array Return array(prodid=>array(0=prodid, 1=>qty, 2=> ...)
*/
function getChildsArbo($id, $firstlevelonly=0, $level=1)
public function getChildsArbo($id, $firstlevelonly=0, $level=1)
{
global $alreadyfound;
@ -3692,7 +3692,7 @@ class Product extends CommonObject
* @param int $save_lastsearch_value -1=Auto, 0=No save of lastsearch_values when clicking, 1=Save lastsearch_values whenclicking
* @return string String with URL
*/
function getNomUrl($withpicto=0, $option='', $maxlength=0, $save_lastsearch_value=-1)
public function getNomUrl($withpicto=0, $option='', $maxlength=0, $save_lastsearch_value=-1)
{
global $conf, $langs, $hookmanager;
include_once DOL_DOCUMENT_ROOT.'/core/lib/product.lib.php';
@ -3848,7 +3848,7 @@ class Product extends CommonObject
* @param int $type 0=Sell, 1=Buy, 2=Batch Number management
* @return string Label of status
*/
function getLibStatut($mode=0, $type=0)
public function getLibStatut($mode=0, $type=0)
{
switch ($type)
{

View File

@ -44,6 +44,13 @@ class MouvementStock extends CommonObject
public $product_id;
public $warehouse_id;
public $qty;
/**
* @var int Type of movement
* 0=input (stock increase by a stock transfer), 1=output (stock decrease after by a stock transfer),
* 2=output (stock decrease), 3=input (stock increase)
* Note that qty should be > 0 with 0 or 3, < 0 with 1 or 2.
*/
public $type;
public $tms = '';

View File

@ -161,7 +161,7 @@ if ($action == 'createmovements')
if (! GETPOST("label"))
{
$error++;
setEventMessages($langs->trans("ErrorFieldRequired"),$langs->transnoentitiesnoconv("LabelMovement"), null, 'errors');
setEventMessages($langs->trans("ErrorFieldRequired"),$langs->transnoentitiesnoconv("MovementLabel"), null, 'errors');
}
$db->begin();
@ -451,7 +451,7 @@ print '<table class="noborder" width="100%">';
print '</td>';
print '</tr>';
print '<tr>';
print '<td>'.$langs->trans("LabelMovement").'</td>';
print '<td>'.$langs->trans("MovementLabel").'</td>';
print '<td>';
print '<input type="text" name="label" class="quatrevingtpercent" value="'.dol_escape_htmltag($labelmovement).'">';
print '</td>';

View File

@ -43,7 +43,7 @@ if (! empty($conf->projet->enabled))
}
// Load translation files required by the page
$langs->loadLangs(array('products', 'stocks'));
$langs->loadLangs(array('products', 'stocks', 'orders'));
if (! empty($conf->productbatch->enabled)) $langs->load("productbatch");
// Security check
@ -103,7 +103,7 @@ $arrayfields=array(
'e.ref'=>array('label'=>$langs->trans("Warehouse"), 'checked'=>1, 'enabled'=>(! $id > 0)), // If we are on specific warehouse, we hide it
'm.fk_user_author'=>array('label'=>$langs->trans("Author"), 'checked'=>0),
'm.inventorycode'=>array('label'=>$langs->trans("InventoryCodeShort"), 'checked'=>1),
'm.label'=>array('label'=>$langs->trans("LabelMovement"), 'checked'=>1),
'm.label'=>array('label'=>$langs->trans("MovementLabel"), 'checked'=>1),
'm.type_mouvement'=>array('label'=>$langs->trans("TypeMovement"), 'checked'=>1),
'origin'=>array('label'=>$langs->trans("Origin"), 'checked'=>1),
'm.value'=>array('label'=>$langs->trans("Qty"), 'checked'=>1),
@ -478,11 +478,11 @@ if (! empty($search_movement)) $sql.= natural_search('m.label', $search_mov
if (! empty($search_inventorycode)) $sql.= natural_search('m.inventorycode', $search_inventorycode);
if (! empty($search_product_ref)) $sql.= natural_search('p.ref', $search_product_ref);
if (! empty($search_product)) $sql.= natural_search('p.label', $search_product);
if ($search_warehouse > 0) $sql.= " AND e.rowid = '".$db->escape($search_warehouse)."'";
if ($search_warehouse != '' && $search_warehouse != '-1') $sql.= natural_search('e.rowid', $search_warehouse, 2);
if (! empty($search_user)) $sql.= natural_search('u.login', $search_user);
if (! empty($search_batch)) $sql.= natural_search('m.batch', $search_batch);
if ($search_qty != '') $sql.= natural_search('m.value', $search_qty, 1);
if ($search_type_mouvement) $sql.= " AND m.type_mouvement = '".$db->escape($search_type_mouvement)."'";
if ($search_type_mouvement != '' && $search_type_mouvement != '-1') $sql.= natural_search('m.type_mouvement', $search_type_mouvement, 2);
// Add where from extra fields
include DOL_DOCUMENT_ROOT.'/core/tpl/extrafields_list_search_sql.tpl.php';
// Add where from hooks
@ -579,8 +579,10 @@ if ($resql)
print '<table class="border" width="100%">';
print '<tr>';
// Description
print '<tr><td class="titlefield tdtop">'.$langs->trans("Description").'</td><td>'.dol_htmlentitiesbr($object->description).'</td></tr>';
print '<td class="titlefield tdtop">'.$langs->trans("Description").'</td><td>'.dol_htmlentitiesbr($object->description).'</td></tr>';
$calcproductsunique=$object->nb_different_products();
$calcproducts=$object->nb_products();
@ -841,13 +843,14 @@ if ($resql)
// Type of movement
print '<td class="liste_titre" align="center">';
//print '<input class="flat" type="text" size="3" name="search_type_mouvement" value="'.dol_escape_htmltag($search_type_mouvement).'">';
print '<select name="search_type_mouvement">';
print '<select id="search_type_mouvement" name="search_type_mouvement" class="maxwidth150">';
print '<option value="" '.(($search_type_mouvement=="")?'selected="selected"':'').'></option>';
print '<option value="0" '.(($search_type_mouvement=="0")?'selected="selected"':'').'>0</option>';
print '<option value="1" '.(($search_type_mouvement=="1")?'selected="selected"':'').'>1</option>';
print '<option value="2" '.(($search_type_mouvement=="2")?'selected="selected"':'').'>2</option>';
print '<option value="3" '.(($search_type_mouvement=="3")?'selected="selected"':'').'>3</option>';
print '<option value="0" '.(($search_type_mouvement=="0")?'selected="selected"':'').'>'.$langs->trans('StockIncreaseAfterCorrectTransfer').'</option>';
print '<option value="1" '.(($search_type_mouvement=="1")?'selected="selected"':'').'>'.$langs->trans('StockDecreaseAfterCorrectTransfer').'</option>';
print '<option value="2" '.(($search_type_mouvement=="2")?'selected="selected"':'').'>'.$langs->trans('StockDecrease').'</option>';
print '<option value="3" '.(($search_type_mouvement=="3")?'selected="selected"':'').'>'.$langs->trans('StockIncrease').'</option>';
print '</select>';
print ajax_combobox('search_type_mouvement');
// TODO: add new function $formentrepot->selectTypeOfMovement(...) like
// print $formproduct->selectWarehouses($search_warehouse, 'search_warehouse', 'warehouseopen,warehouseinternal', 1, 0, 0, '', 0, 0, null, 'maxwidth200');
print '</td>';
@ -966,7 +969,7 @@ if ($resql)
$origin = '';
}
print "<tr>";
print '<tr class="oddeven">';
// Id movement
if (! empty($arrayfields['m.rowid']['checked']))
{
@ -980,7 +983,7 @@ if ($resql)
if (! empty($arrayfields['p.ref']['checked']))
{
// Product ref
print '<td>';
print '<td class="nowraponall">';
print $productstatic->getNomUrl(1,'stock',16);
print "</td>\n";
}
@ -997,7 +1000,7 @@ if ($resql)
}
if (! empty($arrayfields['m.batch']['checked']))
{
print '<td align="center">';
print '<td class="center nowraponall">';
if ($productlot->id > 0) print $productlot->getNomUrl(1);
else print $productlot->batch; // the id may not be defined if movement was entered when lot was not saved or if lot was removed after movement.
print '</td>';
@ -1050,7 +1053,7 @@ if ($resql)
if (! empty($arrayfields['origin']['checked']))
{
// Origin of movement
print '<td>'.$origin.'</td>';
print '<td class="nowraponall">'.$origin.'</td>';
}
if (! empty($arrayfields['m.value']['checked']))
{

View File

@ -288,8 +288,6 @@ class SocieteAccount extends CommonObject
*/
public function getCustomerAccount($id, $site, $status=0)
{
global $conf;
$sql = "SELECT sa.key_account as key_account, sa.entity";
$sql.= " FROM " . MAIN_DB_PREFIX . "societe_account as sa";
$sql.= " WHERE sa.fk_soc = " . $id;
@ -298,7 +296,7 @@ class SocieteAccount extends CommonObject
$sql.= " AND key_account IS NOT NULL AND key_account <> ''";
//$sql.= " ORDER BY sa.key_account DESC";
dol_syslog(get_class($this) . "::getCustomerAccount Try to find the system customer id of thirdparty id=".$id." (exemple: cus_.... for stripe)", LOG_DEBUG);
dol_syslog(get_class($this) . "::getCustomerAccount Try to find the first system customer id for ".$site." of thirdparty id=".$id." (exemple: cus_.... for stripe)", LOG_DEBUG);
$result = $this->db->query($sql);
if ($result) {
if ($this->db->num_rows($result)) {

View File

@ -122,8 +122,6 @@ class Stripe extends CommonObject
*/
public function getStripeCustomerAccount($id, $status=0)
{
global $conf;
include_once DOL_DOCUMENT_ROOT.'/societe/class/societeaccount.class.php';
$societeaccount = new SocieteAccount($this->db);
return $societeaccount->getCustomerAccount($id, 'stripe', $status); // Get thirdparty cus_...