Merge remote-tracking branch 'upstream/develop' into socialnetworks
This commit is contained in:
commit
904d0ecaee
@ -1,6 +1,7 @@
|
||||
<?php
|
||||
/* Copyright (C) 2016 Laurent Destailleur <eldy@users.sourceforge.net>
|
||||
* Copyright (C) 2016-2019 Alexandre Spangaro <aspangaro@open-dsi.fr>
|
||||
* Copyright (C) 2019 Frédéric France <frederic.france@netlogic.fr>
|
||||
*
|
||||
* 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
|
||||
@ -50,6 +51,7 @@ $hookmanager->initHooks(array('accountancyindex'));
|
||||
llxHeader('', $langs->trans("AccountancyArea"));
|
||||
|
||||
print load_fiche_titre($langs->trans("AccountancyArea"), '', 'title_accountancy');
|
||||
//dol_fiche_head();
|
||||
|
||||
$step = 0;
|
||||
|
||||
@ -175,6 +177,7 @@ else
|
||||
{
|
||||
print $langs->trans("Module10Desc")."<br>\n";
|
||||
}
|
||||
//dol_fiche_end();
|
||||
|
||||
// End of page
|
||||
llxFooter();
|
||||
|
||||
@ -670,7 +670,7 @@ if (empty($reshook))
|
||||
}
|
||||
|
||||
$qty = GETPOST('qty' . $predef);
|
||||
$remise_percent = GETPOST('remise_percent' . $predef);
|
||||
$remise_percent = (GETPOST('remise_percent'.$predef) != '' ? GETPOST('remise_percent'.$predef) : 0);
|
||||
|
||||
// Extrafields
|
||||
$extrafieldsline = new ExtraFields($db);
|
||||
|
||||
@ -334,6 +334,7 @@ class Link extends CommonObject
|
||||
if($this->db->num_rows($resql) > 0)
|
||||
{
|
||||
$obj = $this->db->fetch_object($resql);
|
||||
$this->id=$obj->rowid;
|
||||
$this->entity = $obj->entity;
|
||||
$this->datea = $this->db->jdate($obj->datea);
|
||||
$this->url = $obj->url;
|
||||
|
||||
@ -826,7 +826,7 @@ function show_projects($conf, $langs, $db, $object, $backtopage = '', $nocreatel
|
||||
}
|
||||
else
|
||||
{
|
||||
print '<tr class="oddeven"><td colspan="5" class="opacitymedium">'.$langs->trans("None").'</td></tr>';
|
||||
print '<tr class="oddeven"><td colspan="8" class="opacitymedium">'.$langs->trans("None").'</td></tr>';
|
||||
}
|
||||
$db->free($result);
|
||||
}
|
||||
|
||||
@ -1262,7 +1262,13 @@ if ($action == 'create')
|
||||
if ($line->fk_product > 0)
|
||||
{
|
||||
print '<!-- Show warehouse selection -->';
|
||||
print $formproduct->selectWarehouses($tmpentrepot_id, 'entl'.$indiceAsked, '', 1, 0, $line->fk_product, '', 1);
|
||||
|
||||
$stockMin = false;
|
||||
if (empty($conf->global->STOCK_ALLOW_NEGATIVE_TRANSFER)) {
|
||||
$stockMin = 0;
|
||||
}
|
||||
print $formproduct->selectWarehouses($tmpentrepot_id, 'entl'.$indiceAsked, '', 1, 0, $line->fk_product, '', 1, 0, array(), 'minwidth200', '', 1, $stockMin, 'stock DESC, e.ref');
|
||||
|
||||
if ($tmpentrepot_id > 0 && $tmpentrepot_id == $warehouse_id)
|
||||
{
|
||||
//print $stock.' '.$quantityToBeDelivered;
|
||||
|
||||
@ -605,8 +605,9 @@ if ($object->id > 0)
|
||||
$sql2.= ' WHERE c.fk_soc = s.rowid';
|
||||
$sql2.= " AND c.entity IN (".getEntity('commande_fournisseur').")";
|
||||
$sql2.= ' AND s.rowid = '.$object->id;
|
||||
// Show orders with status validated, shipping started and delivered (well any order we can bill)
|
||||
$sql2.= " AND c.fk_statut IN (5)";
|
||||
// Show orders with status validated, shipping started and delivered (even if any order we can bill)
|
||||
//$sql2.= " AND c.fk_statut IN (".CommandeFournisseur::STATUS_ORDERSENT.", ".CommandeFournisseur::STATUS_RECEIVED_PARTIALLY.", ".CommandeFournisseur::STATUS_RECEIVED_COMPLETELY.")";
|
||||
$sql2.= " AND c.fk_statut IN (".CommandeFournisseur::STATUS_RECEIVED_COMPLETELY.")";
|
||||
$sql2.= " AND c.billed = 0";
|
||||
// Find order that are not already invoiced
|
||||
// just need to check received status because we have the billed status now
|
||||
@ -826,7 +827,7 @@ if ($object->id > 0)
|
||||
{
|
||||
if (! empty($orders2invoice) && $orders2invoice > 0)
|
||||
{
|
||||
if ($object->status == 1)
|
||||
if ($object->status == 1) // Company is open
|
||||
{
|
||||
print '<div class="inline-block divButAction"><a class="butAction" href="'.DOL_URL_ROOT.'/fourn/commande/orderstoinvoice.php?socid='.$object->id.'">'.$langs->trans("CreateInvoiceForThisCustomer").'</a></div>';
|
||||
}
|
||||
@ -835,7 +836,7 @@ if ($object->id > 0)
|
||||
print '<div class="inline-block divButAction"><a class="butActionRefused classfortooltip" href="#">'.$langs->trans("CreateInvoiceForThisCustomer").'</a></div>';
|
||||
}
|
||||
}
|
||||
else print '<div class="inline-block divButAction"><a class="butActionRefused classfortooltip" title="'.dol_escape_js($langs->trans("NoOrdersToInvoice")).'" href="#">'.$langs->trans("CreateInvoiceForThisCustomer").'</a></div>';
|
||||
else print '<div class="inline-block divButAction"><a class="butActionRefused classfortooltip" title="'.dol_escape_js($langs->trans("NoOrdersToInvoice").' ('.$langs->trans("WithReceptionFinished").')').'" href="#">'.$langs->trans("CreateInvoiceForThisCustomer").'</a></div>';
|
||||
}
|
||||
|
||||
// Add action
|
||||
|
||||
@ -2502,11 +2502,18 @@ elseif (! empty($object->id))
|
||||
{
|
||||
print '<a class="butAction" href="'.$_SERVER["PHP_SELF"].'?id='.$object->id.'&action=classifybilled">'.$langs->trans("ClassifyBilled").'</a>';
|
||||
}
|
||||
elseif (!empty($object->linkedObjectsIds['invoice_supplier']))
|
||||
else
|
||||
{
|
||||
if ($user->rights->fournisseur->facture->creer)
|
||||
if (!empty($object->linkedObjectsIds['invoice_supplier']))
|
||||
{
|
||||
print '<a class="butAction" href="'.$_SERVER["PHP_SELF"].'?id='.$object->id.'&action=classifybilled">'.$langs->trans("ClassifyBilled").'</a>';
|
||||
if ($user->rights->fournisseur->facture->creer)
|
||||
{
|
||||
print '<a class="butAction" href="'.$_SERVER["PHP_SELF"].'?id='.$object->id.'&action=classifybilled">'.$langs->trans("ClassifyBilled").'</a>';
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
print '<a class="butActionRefused" href="#" title="'.dol_escape_htmltag($langs->trans("NeedAtLeastOneInvoice")).'">'.$langs->trans("ClassifyBilled").'</a>';
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@ -1093,7 +1093,7 @@ if ($resql)
|
||||
// Extra fields
|
||||
include DOL_DOCUMENT_ROOT.'/core/tpl/extrafields_list_print_fields.tpl.php';
|
||||
// Fields from hook
|
||||
$parameters=array('arrayfields'=>$arrayfields, 'obj'=>$obj);
|
||||
$parameters=array('arrayfields'=>$arrayfields, 'obj'=>$obj, 'i'=>$i, 'totalarray'=>&$totalarray);
|
||||
$reshook=$hookmanager->executeHooks('printFieldListValue', $parameters); // Note that $action and $object may have been modified by hook
|
||||
print $hookmanager->resPrint;
|
||||
// Date creation
|
||||
@ -1158,6 +1158,8 @@ if ($resql)
|
||||
elseif ($totalarray['totalttcfield'] == $i) print '<td class="right">'.price($totalarray['totalttc']).'</td>';
|
||||
else print '<td></td>';
|
||||
}
|
||||
|
||||
|
||||
print '</tr>';
|
||||
}
|
||||
|
||||
|
||||
@ -73,18 +73,27 @@ $date_endy = dol_mktime(23, 59, 59, $_REQUEST["date_end_delymonth"], $_REQUEST["
|
||||
|
||||
$extrafields = new ExtraFields($db);
|
||||
|
||||
|
||||
// fetch optionals attributes and labels
|
||||
$extralabels=$extrafields->fetch_name_optionals_label('facture_fourn');
|
||||
|
||||
if ($action == 'create')
|
||||
{
|
||||
if (! is_array($selected))
|
||||
if (! GETPOST('createbill'))
|
||||
{
|
||||
$error++;
|
||||
setEventMessages($langs->trans('Error_OrderNotChecked'), null, 'errors');
|
||||
} else {
|
||||
$origin = GETPOST('origin');
|
||||
$originid = GETPOST('originid');
|
||||
$action = '';
|
||||
}
|
||||
else
|
||||
{
|
||||
if (! is_array($selected))
|
||||
{
|
||||
//$error++;
|
||||
setEventMessages($langs->trans('Error_OrderNotChecked'), null, 'errors');
|
||||
$action = '';
|
||||
} else {
|
||||
$origin = GETPOST('origin', 'alpha');
|
||||
$originid = GETPOST('originid', 'int');
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@ -286,7 +295,6 @@ if (($action == 'create' || $action == 'add') && ! $error) {
|
||||
$html = new Form($db);
|
||||
$htmlother = new FormOther($db);
|
||||
$formfile = new FormFile($db);
|
||||
$companystatic = new Societe($db);
|
||||
|
||||
// Mode creation
|
||||
if ($action == 'create' && !$error) {
|
||||
@ -324,6 +332,8 @@ if ($action == 'create' && !$error) {
|
||||
print '<input name="ref_int" type="hidden" value="' . $ref_int . '">';
|
||||
print '<input type="hidden" name="origin" value="' . GETPOST('origin') . '">';
|
||||
print '<input type="hidden" name="originid" value="' . GETPOST('originid') . '">';
|
||||
print '<input type="hidden" name="socid" value="' . $soc->id . '">';
|
||||
|
||||
print '<table class="border" width="100%">';
|
||||
|
||||
// Ref
|
||||
@ -333,13 +343,6 @@ if ($action == 'create' && !$error) {
|
||||
print '<tr><td class="fieldrequired">' . $langs->trans('RefSupplier') . '</td><td><input name="ref_supplier" value="' . dol_escape_htmltag(isset($_POST['ref_supplier']) ? GETPOST('ref_supplier', 'alpha', 2) : '') . '" type="text"></td>';
|
||||
print '</tr>';
|
||||
|
||||
// Third party
|
||||
print '<tr><td class="fieldrequired">' . $langs->trans('Customer') . '</td><td colspan="2">';
|
||||
print $soc->getNomUrl(1);
|
||||
print '<input type="hidden" name="socid" value="' . $soc->id . '">';
|
||||
print '</td>';
|
||||
print '</tr>' . "\n";
|
||||
|
||||
// Date invoice
|
||||
print '<tr><td class="fieldrequired">' . $langs->trans('Date') . '</td><td colspan="2">';
|
||||
print $html->selectDate('', '', '', '', '', "add", 1, 1);
|
||||
@ -387,18 +390,19 @@ if ($action == 'create' && !$error) {
|
||||
|
||||
// Public note
|
||||
print '<tr>';
|
||||
print '<td class="border" valign="top">' . $langs->trans('NotePublic') . '</td>';
|
||||
print '<td valign="top" colspan="2">';
|
||||
print '<td class="tdtop">' . $langs->trans('NotePublic') . '</td>';
|
||||
print '<td colspan="2">';
|
||||
print '<textarea name="note_public" wrap="soft" class="quatrevingtpercent" rows="' . ROWS_3 . '">';
|
||||
|
||||
print $langs->trans("Orders") . ": " . implode(', ', $listoforders);
|
||||
|
||||
print '</textarea></td></tr>';
|
||||
|
||||
// Private note
|
||||
if (empty($user->societe_id)) {
|
||||
print '<tr>';
|
||||
print '<td class="border" valign="top">' . $langs->trans('NotePrivate') . '</td>';
|
||||
print '<td valign="top" colspan="2">';
|
||||
print '<td class="tdtop">' . $langs->trans('NotePrivate') . '</td>';
|
||||
print '<td colspan="2">';
|
||||
print '<textarea name="note" wrap="soft" cols="70" rows="' . ROWS_3 . '">';
|
||||
|
||||
print '</textarea></td></tr>';
|
||||
@ -406,10 +410,10 @@ if ($action == 'create' && !$error) {
|
||||
|
||||
print '</table>';
|
||||
|
||||
while ( $i < $n ) {
|
||||
while ($i < $n) {
|
||||
print '<input type="hidden" name="orders_to_invoice[]" value="' . $orders_id[$i] . '">';
|
||||
|
||||
$i ++;
|
||||
$i++;
|
||||
}
|
||||
|
||||
// Button "Create Draft"
|
||||
@ -465,10 +469,16 @@ if (($action != 'create' && $action != 'add') && !$error) {
|
||||
}
|
||||
|
||||
// Date filter
|
||||
if ($date_start && $date_end)
|
||||
$sql .= " AND c.date_commande >= '" . $db->idate($date_start) . "' AND c.date_commande <= '" . $db->idate($date_end) . "'";
|
||||
if ($date_starty && $date_endy)
|
||||
$sql .= " AND c.date_livraison >= '" . $db->idate($date_starty) . "' AND c.date_livraison <= '" . $db->idate($date_endy) . "'";
|
||||
//$sql.= dolSqlDateFilter("c.date_commande", GETPOST("date_startday", 'int'), GETPOST("date_startmonth", 'int'), GETPOST("date_startyear", 'int'));
|
||||
//$sql.= dolSqlDateFilter("c.date_livraison", $search_deliveryday, $search_deliverymonth, $search_deliveryyear);
|
||||
if ($date_start)
|
||||
$sql .= " AND c.date_commande >= '" . $db->idate($date_start) . "'";
|
||||
if ($date_end)
|
||||
$sql .= " AND c.date_commande <= '" . $db->idate($date_end) . "'";
|
||||
if ($date_starty)
|
||||
$sql .= " AND c.date_livraison >= '" . $db->idate($date_starty) . "'";
|
||||
if ($date_endy)
|
||||
$sql .= " AND c.date_livraison <= '" . $db->idate($date_endy) . "'";
|
||||
|
||||
if (! empty($sref_client)) {
|
||||
$sql .= natural_search('c.ref_supplier', $sref_client);
|
||||
@ -484,21 +494,21 @@ if (($action != 'create' && $action != 'add') && !$error) {
|
||||
}
|
||||
$title = $langs->trans('ListOfSupplierOrders');
|
||||
$title .= ' - ' . $langs->trans('StatusOrderReceivedAllShort');
|
||||
$title .= ' - ' . $soc->getNomUrl(1, 'supplier');
|
||||
|
||||
$num = $db->num_rows($resql);
|
||||
|
||||
print load_fiche_titre($title);
|
||||
|
||||
$i = 0;
|
||||
$period = $html->selectDate($date_start, 'date_start', 0, 0, 1, '', 1, 0) . ' - ' . $html->selectDate($date_end, 'date_end', 0, 0, 1, '', 1, 0);
|
||||
$periodely = $html->selectDate($date_starty, 'date_start_dely', 0, 0, 1, '', 1, 0) . ' - ' . $html->selectDate($date_endy, 'date_end_dely', 0, 0, 1, '', 1, 0);
|
||||
|
||||
if (! empty($socid)) {
|
||||
// Company
|
||||
$companystatic->id = $socid;
|
||||
$companystatic->nom = $soc->nom;
|
||||
print '<h3>' . $companystatic->getNomUrl(1, 'customer') . '</h3>';
|
||||
}
|
||||
|
||||
print '<form name="orders2invoice" method="GET" action="orderstoinvoice.php">';
|
||||
print '<input type="hidden" name="token" value="' . $_SESSION['newtoken'] . '">';
|
||||
print '<input type="hidden" name="socid" value="' . $socid . '">';
|
||||
|
||||
|
||||
print '<table class="noborder" width="100%">';
|
||||
print '<tr class="liste_titre">';
|
||||
print_liste_field_titre('Ref', 'orderstoinvoice.php', 'c.ref', '', '&socid=' . $socid, '', $sortfield, $sortorder);
|
||||
@ -511,10 +521,12 @@ if (($action != 'create' && $action != 'add') && !$error) {
|
||||
|
||||
// Fields title search
|
||||
print '<tr class="liste_titre">';
|
||||
|
||||
print '<td class="liste_titre">';
|
||||
// REF
|
||||
print '<input class="flat" size="10" type="text" name="sref" value="' . $sref . '">';
|
||||
print '</td>';
|
||||
|
||||
// print '<td class="liste_titre">';
|
||||
print '<td class="liste_titre left">';
|
||||
print '<input class="flat" type="text" size="10" name="sref_client" value="' . $sref_client . '">';
|
||||
@ -604,7 +616,7 @@ if (($action != 'create' && $action != 'add') && !$error) {
|
||||
print '<input type="hidden" name="action" value="create">';
|
||||
print '<input type="hidden" name="origin" value="order_supplier"><br>';
|
||||
// print '<a class="butAction" href="index.php">'.$langs->trans("GoBack").'</a>';
|
||||
print '<input type="submit" class="butAction" value="' . $langs->trans("GenerateBill") . '">';
|
||||
print '<input type="submit" class="butAction" name="createbill" value="' . $langs->trans("GenerateBill") . '">';
|
||||
print '</div>';
|
||||
print '</div>';
|
||||
|
||||
|
||||
@ -43,6 +43,7 @@ create table llx_entrepot_extrafields
|
||||
|
||||
ALTER TABLE llx_entrepot_extrafields ADD INDEX idx_entrepot_extrafields (fk_object);
|
||||
|
||||
ALTER TABLE llx_extrafields ADD COLUMN printable boolean DEFAULT FALSE;
|
||||
|
||||
ALTER TABLE llx_facture ADD COLUMN retained_warranty real DEFAULT NULL after situation_final;
|
||||
ALTER TABLE llx_facture ADD COLUMN retained_warranty_date_limit date DEFAULT NULL after retained_warranty;
|
||||
|
||||
@ -36,6 +36,7 @@ create table llx_extrafields
|
||||
alwayseditable integer DEFAULT 0, -- 1 if field can be edited whatever is element status
|
||||
param text, -- extra parameters to define possible values of field
|
||||
list varchar(255) DEFAULT '1', -- visibility of field. 0=Never visible, 1=Visible on list and forms, 2=Visible on list only. Using a negative value means field is not shown by default on list but can be selected for viewing
|
||||
printable boolean DEFAULT FALSE, -- is the extrafield output on documents
|
||||
totalizable boolean DEFAULT FALSE, -- is extrafield totalizable on list
|
||||
langs varchar(64), -- example: fileofmymodule@mymodule
|
||||
help text, -- to store help tooltip
|
||||
|
||||
@ -154,7 +154,7 @@ OptionToSetOrderBilledNotEnabled=Option from module Workflow, to set order to 'B
|
||||
IfValidateInvoiceIsNoOrderStayUnbilled=If invoice validation is 'No', the order will remain to status 'Unbilled' until the invoice is validated.
|
||||
CloseReceivedSupplierOrdersAutomatically=Close order to status "%s" automatically if all products are received.
|
||||
SetShippingMode=Set shipping mode
|
||||
|
||||
WithReceptionFinished=With reception finished
|
||||
#### supplier orders status
|
||||
StatusSupplierOrderCanceledShort=Canceled
|
||||
StatusSupplierOrderDraftShort=Draft
|
||||
@ -181,4 +181,4 @@ StatusSupplierOrderToBill=Delivered
|
||||
StatusSupplierOrderApproved=Approved
|
||||
StatusSupplierOrderRefused=Refused
|
||||
StatusSupplierOrderReceivedPartially=Partially received
|
||||
StatusSupplierOrderReceivedAll=All products received
|
||||
StatusSupplierOrderReceivedAll=All products received
|
||||
|
||||
@ -514,7 +514,7 @@ while ($i < min($num, $limit))
|
||||
// Extra fields
|
||||
include DOL_DOCUMENT_ROOT.'/core/tpl/extrafields_list_print_fields.tpl.php';
|
||||
// Fields from hook
|
||||
$parameters=array('arrayfields'=>$arrayfields, 'obj'=>$obj);
|
||||
$parameters=array('arrayfields'=>$arrayfields, 'obj'=>$obj, 'i'=>$i, 'totalarray'=>&$totalarray);
|
||||
$reshook=$hookmanager->executeHooks('printFieldListValue', $parameters, $object); // Note that $action and $object may have been modified by hook
|
||||
print $hookmanager->resPrint;
|
||||
// Action column
|
||||
|
||||
@ -55,21 +55,24 @@ class FormProduct
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* Load in cache array list of warehouses
|
||||
* If fk_product is not 0, we do not use cache
|
||||
*
|
||||
* @param int $fk_product Add quantity of stock in label for product with id fk_product. Nothing if 0.
|
||||
* @param string $batch Add quantity of batch stock in label for product with batch name batch, batch name precedes batch_id. Nothing if ''.
|
||||
* @param string $status warehouse status filter, following comma separated filter options can be used
|
||||
* 'warehouseopen' = select products from open warehouses,
|
||||
* 'warehouseclosed' = select products from closed warehouses,
|
||||
* 'warehouseinternal' = select products from warehouses for internal correct/transfer only
|
||||
* @param boolean $sumStock sum total stock of a warehouse, default true
|
||||
* @param array $exclude warehouses ids to exclude
|
||||
* @return int Nb of loaded lines, 0 if already loaded, <0 if KO
|
||||
*/
|
||||
public function loadWarehouses($fk_product = 0, $batch = '', $status = '', $sumStock = true, $exclude = '')
|
||||
/**
|
||||
* Load in cache array list of warehouses
|
||||
* If fk_product is not 0, we do not use cache
|
||||
*
|
||||
* @param int $fk_product Add quantity of stock in label for product with id fk_product. Nothing if 0.
|
||||
* @param string $batch Add quantity of batch stock in label for product with batch name batch, batch name precedes batch_id. Nothing if ''.
|
||||
* @param string $status warehouse status filter, following comma separated filter options can be used
|
||||
* 'warehouseopen' = select products from open warehouses,
|
||||
* 'warehouseclosed' = select products from closed warehouses,
|
||||
* 'warehouseinternal' = select products from warehouses for internal correct/transfer only
|
||||
* @param boolean $sumStock sum total stock of a warehouse, default true
|
||||
* @param string $exclude warehouses ids to exclude
|
||||
* @param bool|int $stockMin [=false] Value of minimum stock to filter or false not not filter by minimum stock
|
||||
* @param string $orderBy [='e.ref'] Order by
|
||||
* @return int Nb of loaded lines, 0 if already loaded, <0 if KO
|
||||
* @throws Exception
|
||||
*/
|
||||
public function loadWarehouses($fk_product = 0, $batch = '', $status = '', $sumStock = true, $exclude = '', $stockMin = false, $orderBy = 'e.ref')
|
||||
{
|
||||
global $conf, $langs;
|
||||
|
||||
@ -130,8 +133,26 @@ class FormProduct
|
||||
|
||||
if(!empty($exclude)) $sql.= ' AND e.rowid NOT IN('.$this->db->escape(implode(',', $exclude)).')';
|
||||
|
||||
if ($sumStock && empty($fk_product)) $sql.= " GROUP BY e.rowid, e.ref, e.description, e.fk_parent";
|
||||
$sql.= " ORDER BY e.ref";
|
||||
// minimum stock
|
||||
if ($stockMin !== false) {
|
||||
if (!empty($fk_product)) {
|
||||
if (!empty($batch)) {
|
||||
$sql .= " AND pb.qty > " . $this->db->escape($stockMin);
|
||||
} else {
|
||||
$sql .= " AND ps.reel > " . $this->db->escape($stockMin);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
if ($sumStock && empty($fk_product)) {
|
||||
$sql.= " GROUP BY e.rowid, e.ref, e.description, e.fk_parent";
|
||||
|
||||
// minimum stock
|
||||
if ($stockMin !== false) {
|
||||
$sql .= " HAVING sum(ps.reel) > " . $this->db->escape($stockMin);
|
||||
}
|
||||
}
|
||||
$sql.= " ORDER BY " . $orderBy;
|
||||
|
||||
dol_syslog(get_class($this).'::loadWarehouses', LOG_DEBUG);
|
||||
$resql = $this->db->query($sql);
|
||||
@ -192,25 +213,29 @@ class FormProduct
|
||||
/**
|
||||
* Return list of warehouses
|
||||
*
|
||||
* @param int $selected Id of preselected warehouse ('' for no value, 'ifone'=select value if one value otherwise no value)
|
||||
* @param string $htmlname Name of html select html
|
||||
* @param string $filterstatus warehouse status filter, following comma separated filter options can be used
|
||||
* 'warehouseopen' = select products from open warehouses,
|
||||
* 'warehouseclosed' = select products from closed warehouses,
|
||||
* 'warehouseinternal' = select products from warehouses for internal correct/transfer only
|
||||
* @param int $empty 1=Can be empty, 0 if not
|
||||
* @param int $disabled 1=Select is disabled
|
||||
* @param int $fk_product Add quantity of stock in label for product with id fk_product. Nothing if 0.
|
||||
* @param string $empty_label Empty label if needed (only if $empty=1)
|
||||
* @param int $showstock 1=Show stock count
|
||||
* @param int $forcecombo 1=Force combo iso ajax select2
|
||||
* @param array $events Events to add to select2
|
||||
* @param string $morecss Add more css classes to HTML select
|
||||
* @param array $exclude Warehouses ids to exclude
|
||||
* @param int $showfullpath 1=Show full path of name (parent ref into label), 0=Show only ref of current warehouse
|
||||
* @return string HTML select
|
||||
* @param string|int $selected Id of preselected warehouse ('' for no value, 'ifone'=select value if one value otherwise no value)
|
||||
* @param string $htmlname Name of html select html
|
||||
* @param string $filterstatus warehouse status filter, following comma separated filter options can be used
|
||||
* 'warehouseopen' = select products from open warehouses,
|
||||
* 'warehouseclosed' = select products from closed warehouses,
|
||||
* 'warehouseinternal' = select products from warehouses for internal correct/transfer only
|
||||
* @param int $empty 1=Can be empty, 0 if not
|
||||
* @param int $disabled 1=Select is disabled
|
||||
* @param int $fk_product Add quantity of stock in label for product with id fk_product. Nothing if 0.
|
||||
* @param string $empty_label Empty label if needed (only if $empty=1)
|
||||
* @param int $showstock 1=Show stock count
|
||||
* @param int $forcecombo 1=Force combo iso ajax select2
|
||||
* @param array $events Events to add to select2
|
||||
* @param string $morecss Add more css classes to HTML select
|
||||
* @param string $exclude Warehouses ids to exclude
|
||||
* @param int $showfullpath 1=Show full path of name (parent ref into label), 0=Show only ref of current warehouse
|
||||
* @param bool|int $stockMin [=false] Value of minimum stock to filter or false not not filter by minimum stock
|
||||
* @param string $orderBy [='e.ref'] Order by
|
||||
* @return string HTML select
|
||||
*
|
||||
* @throws Exception
|
||||
*/
|
||||
public function selectWarehouses($selected = '', $htmlname = 'idwarehouse', $filterstatus = '', $empty = 0, $disabled = 0, $fk_product = 0, $empty_label = '', $showstock = 0, $forcecombo = 0, $events = array(), $morecss = 'minwidth200', $exclude = '', $showfullpath = 1)
|
||||
public function selectWarehouses($selected = '', $htmlname = 'idwarehouse', $filterstatus = '', $empty = 0, $disabled = 0, $fk_product = 0, $empty_label = '', $showstock = 0, $forcecombo = 0, $events = array(), $morecss = 'minwidth200', $exclude = '', $showfullpath = 1, $stockMin = false, $orderBy = 'e.ref')
|
||||
{
|
||||
global $conf,$langs,$user;
|
||||
|
||||
@ -218,7 +243,7 @@ class FormProduct
|
||||
|
||||
$out='';
|
||||
if (empty($conf->global->ENTREPOT_EXTRA_STATUS)) $filterstatus = '';
|
||||
$this->loadWarehouses($fk_product, '', $filterstatus, true, $exclude);
|
||||
$this->loadWarehouses($fk_product, '', $filterstatus, true, $exclude, $stockMin, $orderBy);
|
||||
$nbofwarehouses=count($this->cache_warehouses);
|
||||
|
||||
if ($conf->use_javascript_ajax && ! $forcecombo)
|
||||
|
||||
@ -320,8 +320,10 @@ if ($action == "delete") {
|
||||
$resql1 = $db->query($sql);
|
||||
$sql = "DELETE FROM " . MAIN_DB_PREFIX . "facturedet where fk_facture = ".$placeid;
|
||||
$resql2 = $db->query($sql);
|
||||
$sql="UPDATE ".MAIN_DB_PREFIX."facture set fk_soc=".$conf->global->{'CASHDESK_ID_THIRDPARTY'.$_SESSION["takeposterminal"]}." where ref='(PROV-POS".$_SESSION["takeposterminal"]."-".$place.")'";
|
||||
$resql3 = $db->query($sql);
|
||||
|
||||
if ($resql1 && $resql2)
|
||||
if ($resql1 && $resql2 && $resql3)
|
||||
{
|
||||
$db->commit();
|
||||
}
|
||||
|
||||
Loading…
Reference in New Issue
Block a user